Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App cannot be deployed from MacOS #6

Open
nick-verida opened this issue May 4, 2023 · 2 comments
Open

App cannot be deployed from MacOS #6

nick-verida opened this issue May 4, 2023 · 2 comments
Assignees

Comments

@nick-verida
Copy link
Contributor

nick-verida commented May 4, 2023

Currently deploying this app from MacOS doen't work, because we get this when deployed:

"/var/task/node_modules/leveldown/build/Release/leveldown.node: invalid ELF header",

This is because leveldown is build on Mac but deployed on Linux.

Adding this to serverless.xml should work but has stopped for some reason:

  webpack:
    includeModules: true
    packagerOptions:
      scripts:
        - npm_config_platform=linux npm_config_arch=x64 yarn add leveldown

Currently I'm deploy via a docker build. This was non-trivial, but a few notes:

On the Mac, rm -rf node_modules to make sure we get rid of Mac versions

# run docker mapping the path things are checkout out at to a `/working` directory inside docker
docker run -v ~/dev/verida/network-data-api:/working -it --rm ubuntu

# Now we are in docker (Ubuntu)
apt update
apt install unzip nodejs npm curl
cd /root

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"


curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip" # NOTE the ARM version is needed!
unzip awscliv2.zip
./aws/install

cd /working
nvm install # install and use the correct node version
nvm use
 # add the AWS deployment keys
# most script now specify which profile to use
/usr/local/bin/aws configure --profile verida-original
/usr/local/bin/aws configure --profile verida-testnet
/usr/local/bin/aws configure --profile verida-mainnet
npm install --global yarn
yarn # do the build
yarn deploy-prod # deploy!
@nick-verida nick-verida self-assigned this May 4, 2023
@nick-verida
Copy link
Contributor Author

I've seen this elsewhere too, so have documented this here: https://github.com/verida/infrastructure/blob/develop/Linux_Build_on_MacOS.md

@nick-verida
Copy link
Contributor Author

You get this if you are using arm64 architecture (which you want!) in the terminal. You can see by running the arch command.

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

No branches or pull requests

1 participant