Skip to content

Comments

add bin/appimg.sh to build an app image out of i2p and divachain#4

Draft
mkuettel wants to merge 5 commits intodiva-exchange:developfrom
mkuettel:appimg
Draft

add bin/appimg.sh to build an app image out of i2p and divachain#4
mkuettel wants to merge 5 commits intodiva-exchange:developfrom
mkuettel:appimg

Conversation

@mkuettel
Copy link

This script expects bin/build.sh to have been successfully run and copies the result from the docker build out of the images into the build/exchange.diva.divachain.AppDir/
which is the basis for the build using the appimagetool called at the end of the script.

This is done because the same i2p and divachain build process should be used for the app image as well. So in this POC we just use the built binaries of the respecting containers. Because of this we need to resort to binary patching to adjust these binaries for them to be able to be run inside of an AppImage instead a docker container environment.

The AppRun script is the entrypoint which gets executed when starting the resulting appimage.

The idea is that this script setups up the required data directories required by i2p, starts the i2p daemon & starts divachain.

When closing divachain the i2p daemon should be stopped as well.

Moritz Küttel added 5 commits January 26, 2024 11:54
On some systems the user I want to run these scripts on are not in the
sudoers group, but might be in the docker group.

Additionally, this is useful to check whether all of these elevated
commands are actually needed.

Using this commit I'm testing this by calling the script setting the
environment variable SUDO_CMD to an empty string. For example:

    SUDO_CMD= bin/build.sh
This script expects bin/build.sh to have been successfully run and
copies the result from the docker build out of the images into the
build/exchange.diva.divachain.AppDir/
which is the basis for the build using the appimagetool called at the
end of the script.

This is done because the same i2p and divachain build process should be
used for the app image as well. So in this POC we just use the built
binaries of the respecting containers. Because of this we need to resort
to binary patching to adjust these binaries for them to be able to be
run inside of an AppImage instead a docker container environment.

The AppRun script is the entrypoint which gets executed when starting
the resulting appimage.

The idea is that this script setups up the required data directories
required by i2p, starts the i2p daemon & starts divachain.

When closing divachain the i2p daemon should be stopped as well.
@mkuettel
Copy link
Author

I'm now at the point that i2pd is started in the background in the launch script of the AppImage (AppRun) and aterwards
./divachain is executed. But this gives me:

pkg/prelude/bootstrap.js:1876
      throw error;
      ^

Error: No native build was found for platform=linux arch=x64 runtime=node abi=83 uv=1 libc=glibc node=14.20.0
    loaded from: /snapshot/divachain/node_modules/classic-level

    at Function.load.path (/snapshot/divachain/node_modules/node-gyp-build/index.js:60:9)
    at load (/snapshot/divachain/node_modules/node-gyp-build/index.js:22:30)
    at Object.<anonymous> (/snapshot/divachain/node_modules/classic-level/binding.js:1:43)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Module._compile (pkg/prelude/bootstrap.js:1937:32)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at Module.require (pkg/prelude/bootstrap.js:1855:31)

In principle it runs, but I've still packaged packaged some of the shared libraries wrong.

@diva-exchange
Copy link
Owner

Solution approach:

  1. work on the branch divachain/develop-tx
  2. add a bundler (webpack / esbuild) to divachain (to create a single js file).
  3. fix packaging (binary creation for platform=linux arch=x64 runtime=node / version >16)

as soon as a working divachain binary is available, the appimage build will work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants