hello all,
I tried following the instruction to install XO from source at https://xen-orchestra.com/docs/from_the_sources.html.
My target OS is a openSUSE 15.1. I start documenting the steps I followed, maybe can be of help to others:
I installed the prerequisites:
zypper install -t pattern devel_basis
zypper install redis git libvhdi-tools libpng16-devel python
I installed npm and node with the n script with a non root user (username xo):
curl -L https://raw.githubusercontent.com/tj/n/master/bin/n -o n
N_PREFIX=/home/xo/ n latest
I installed yarn with xo user:
curl -oyarn-install.sh -L https://yarnpkg.com/install.sh
./yarn-install.sh
then as documented I cloned git and tried building with yarn:
git clone -b master http://github.com/vatesfr/xen-orchestra
cd xen-orchestra
yarn
yarn build
then build process is much more complex than I expected (javascript dev are really crazy) and in my case it failed. I bonked my head against the wall trying to debug something I never saw. The major problem seemed to be babel that throw an OOM, at first I was thinking about bad libraries and regression but in the end I found out how to increase the heap of node. The other error seemed a regression in my node version, maybe I should switch to LTS instead of latest (I have installed 13.10.1).
I lost a lot of time trying different approach, I will post here just the solution for my case, it's not a patch for everyone:
diff --git a/package.json b/package.json
index 9e44def0b..4d3be801d 100644
--- a/package.json
+++ b/package.json
@@ -60,7 +60,7 @@
},
"private": true,
"scripts": {
- "build": "scripts/run-script --parallel build",
+ "build": "scripts/run-script build",
"clean": "scripts/run-script --parallel clean",
"dev": "scripts/run-script --parallel dev",
"dev-test": "jest --bail --watch \"^(?!.*\\.integ\\.spec\\.js$)\"",
diff --git a/packages/xo-web/gulpfile.js b/packages/xo-web/gulpfile.js
index 45feff969..6d32068d9 100644
--- a/packages/xo-web/gulpfile.js
+++ b/packages/xo-web/gulpfile.js
@@ -270,6 +270,7 @@ gulp.task(function buildScripts() {
)
})
+
gulp.task(function buildStyles() {
return pipe(
src('index.scss', { sourcemaps: true }),
@@ -295,9 +296,14 @@ gulp.task(function copyAssets() {
)
})
+//gulp.task(
+// 'build',
+// gulp.parallel('buildPages', 'buildScripts', 'buildStyles', 'copyAssets')
+//)
+
gulp.task(
'build',
- gulp.parallel('buildPages', 'buildScripts', 'buildStyles', 'copyAssets')
+ gulp.series('buildPages', 'buildScripts', 'buildStyles', 'copyAssets', function (done) { done();})
)
// -------------------------------------------------------------------
diff --git a/packages/xo-web/package.json b/packages/xo-web/package.json
index 57c99d193..e6530a154 100644
--- a/packages/xo-web/package.json
+++ b/packages/xo-web/package.json
@@ -148,7 +148,7 @@
"xo-vmdk-to-vhd": "^0.1.8"
},
"scripts": {
- "build": "NODE_ENV=production gulp build",
+ "build": "NODE_ENV=production gulp build --max-old-space-size=1024",
"clean": "gulp clean",
"dev": "NODE_ENV=development gulp build",
"prebuild": "yarn run clean && index-modules --auto src",
probably you can avoid the serialization in the gulpfile, I used it to debug.
who on earth wrote a build system in javascript? IMHO Satan himself.
anyway, I reached the end and the build was successful, I just ignore a couple of optional dependencies that does not work, I just remember one is bcrypt, I forgot the other and don't know how to recheck.
now it's as simple ad creating a configuration (default) for redis and start it. and then start yarn.
for the start I have to switch to root, I wanted to try with xo user but I see that the at the start xo-server look for a lot of command requiring root privileges, I wasn't in the mood of hacking to wrap all of them with a sudo script. I don't know if there is a smarter approach. so as root I loaded the PATH variable to look for the yarn and node binaries and with yarn start all works. login ok and first round clicking between webpages all ok.
now one question, how do you export the built application to /usr/local or /opt or other directory to actually make an installation? I don't see any procedure. I suppose I have to copy the packeges directory in place. it's so?