XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    first attemp with XOCE

    Scheduled Pinned Locked Moved Xen Orchestra
    12 Posts 4 Posters 1.1k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N Offline
      nackstein
      last edited by nackstein

      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?

      DanpD 1 Reply Last reply Reply Quote 0
      • BenjiReisB Offline
        BenjiReis Vates 🪐 XCP-ng Team
        last edited by

        Hi!

        @nackstein said in first attemp with XOCE:

        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).

        FYI: The doc specifically mention to use node v8 so that might be a cause of a build problem.

        N 1 Reply Last reply Reply Quote 0
        • N Offline
          nackstein
          last edited by nackstein

          it seems that the git diff didn't include a modification I made, maybe the file isn't tracked.

          in file @xen-orchestra/audit-core/node_modules/@babel/helper-compilation-targets/package.json
          I had to modify the exports:

          "exports": {
            ".": "./lib/index.js"
          },
          

          the original was like (not sure):

          "exports": none
          

          but was throwing error during build:

          Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main resolved
          
          BenjiReisB 1 Reply Last reply Reply Quote 0
          • N Offline
            nackstein @BenjiReis
            last edited by

            @BenjiReis yes but XOA is using v12.16.1 so I believed the documentation was a little old. I will try to build from scratch with the LTS that is 12.16.1.

            1 Reply Last reply Reply Quote 0
            • BenjiReisB Offline
              BenjiReis Vates 🪐 XCP-ng Team @nackstein
              last edited by BenjiReis

              @nackstein Please use markdown when quoting code for readability 🙂

              1 Reply Last reply Reply Quote 0
              • olivierlambertO Offline
                olivierlambert Vates 🪐 Co-Founder CEO
                last edited by olivierlambert

                It seems you are really angry again JS dev/build system, but you missed the a sentence that's in bold in the documentation 😉 For instance, Node version. Please take time to read the doc carefully before going further, or you'll lose your time 🙂

                edit: our doc should be considered as "source of truth" for your installation

                edit 2: XOA is a bit different, we can provide a coherent solution with the environment, until we decide we are sure with Node 12, we keep the version on 8.

                N 1 Reply Last reply Reply Quote 1
                • N Offline
                  nackstein @olivierlambert
                  last edited by

                  @olivierlambert ok thanks for the clarification. I was deliberating exploring new territories. I don't like the build system in javascript but maybe it's useful on windows platform so you don't have to port make and shell script. to me it's a new complicated thing to just execute some command in a pipe. Anyway my post was sarcastic, I don't want to blame anyone.

                  1 Reply Last reply Reply Quote 0
                  • olivierlambertO Offline
                    olivierlambert Vates 🪐 Co-Founder CEO
                    last edited by

                    No worries 😉 Just telling you that following the doc will save you a lot of time!

                    1 Reply Last reply Reply Quote 0
                    • DanpD Online
                      Danp Pro Support Team @nackstein
                      last edited by

                      @nackstein said in first attemp with XOCE:

                      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 build

                      Did you issue the yarn command prior to the yarn build? If not, that would explain the missing dependencies.

                      N 1 Reply Last reply Reply Quote 0
                      • N Offline
                        nackstein @Danp
                        last edited by

                        @Danp oh yes, I just forgot to post it here. I'm going to edit my post. thanks.
                        I think the broken dependency is due to bcrypt 2.x that come only in 64 npm version and by using a too recent node/npm the build system look for bcrypt 2.x 79 npm version

                        1 Reply Last reply Reply Quote 0
                        • N Offline
                          nackstein
                          last edited by

                          I tried building from scratch and with node 8. I had a couple of build error but building one package by directly entering its directory and relaunching building without --parallel in the main package.json solved my problem. I think the VM I used to build with 2GB RAM is not enough for parallel building (I took the hint from the post about building on FreeBSD).

                          now I would like to install on a local directory and not using the git directory to start services. how do you usually do in your development environment?

                          1 Reply Last reply Reply Quote 0
                          • olivierlambertO Offline
                            olivierlambert Vates 🪐 Co-Founder CEO
                            last edited by

                            Exactly like how it's displayed in the documentation.

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post