0.0.587 #318
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Server build | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Update dependencies | |
run: | | |
sudo apt-get update && sudo apt-get upgrade | |
- name: Install dependencies | |
run: | | |
sudo apt install -y git curl | |
- name: Allow ports 3006 and 3007 | |
run: | | |
sudo ufw allow 3006 | |
sudo ufw allow 3007 | |
- name: Install Node Version Manager (NVM) | |
run: | | |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash | |
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | |
nvm install 18 && nvm use 18 && nvm alias default 18 | |
npm i -g npm@latest | |
- name: Install and configure @deep-foundation/deeplinks | |
run: | | |
npm rm --unsafe-perm -g @deep-foundation/deeplinks | |
npm install --unsafe-perm -g @deep-foundation/deeplinks@latest | |
- name: Set environment variables | |
run: | | |
export HOST_IP="185.105.118.59" | |
export DEEPCASE_HOST="$HOST_IP:3007" | |
export DEEPLINKS_HOST="$HOST_IP:3006" | |
export HASURA_ADMIN_SECRET=$(node -e "console.log(require('crypto').randomBytes(24).toString('hex'));") | |
export POSTGRES_PASSWORD=$(node -e "console.log(require('crypto').randomBytes(24).toString('hex'));") | |
export MINIO_ACCESS_KEY=$(node -e "console.log(require('crypto').randomBytes(24).toString('hex'));") | |
export MINIO_SECRET_KEY=$(node -e "console.log(require('crypto').randomBytes(24).toString('hex'));") | |
- name: Create call-options.json | |
run: | | |
tee call-options.json << JSON | |
{ | |
"operation": "run", | |
"envs": { | |
"DEEPLINKS_PUBLIC_URL": "http://$DEEPLINKS_HOST", | |
"NEXT_PUBLIC_DEEPLINKS_URL": "http://$DEEPLINKS_HOST", | |
"NEXT_PUBLIC_GQL_PATH": "$DEEPLINKS_HOST/gql", | |
"NEXT_PUBLIC_GQL_SSL": "0", | |
"NEXT_PUBLIC_DEEPLINKS_SERVER": "http://$DEEPCASE_HOST", | |
"NEXT_PUBLIC_ENGINES_ROUTE": "0", | |
"NEXT_PUBLIC_DISABLE_CONNECTOR": "1", | |
"JWT_SECRET": "'{\"type\":\"HS256\",\"key\":\"$(node -e "console.log(require('crypto').randomBytes(50).toString('base64'));")\"}'", | |
"DEEPLINKS_HASURA_STORAGE_URL": "http://host.docker.internal:8000/", | |
"HASURA_GRAPHQL_ADMIN_SECRET": "$HASURA_ADMIN_SECRET", | |
"MIGRATIONS_HASURA_SECRET": "$HASURA_ADMIN_SECRET", | |
"DEEPLINKS_HASURA_SECRET": "$HASURA_ADMIN_SECRET", | |
"POSTGRES_PASSWORD": "$POSTGRES_PASSWORD", | |
"HASURA_GRAPHQL_DATABASE_URL": "postgres://postgres:$POSTGRES_PASSWORD@postgres:5432/postgres", | |
"POSTGRES_MIGRATIONS_SOURCE": "postgres://postgres:[email protected]:5432/postgres?sslmode=disable", | |
"RESTORE_VOLUME_FROM_SNAPSHOT": "0", | |
"MANUAL_MIGRATIONS": "1", | |
"MINIO_ROOT_USER": "$MINIO_ACCESS_KEY", | |
"MINIO_ROOT_PASSWORD": "$MINIO_SECRET_KEY", | |
"S3_ACCESS_KEY": "$MINIO_ACCESS_KEY", | |
"S3_SECRET_KEY": "$MINIO_SECRET_KEY" | |
} | |
} | |
JSON | |
- name: Run deeplinks | |
run: | | |
export DEEPLINKS_CALL_OPTIONS=$(cat call-options.json) | |
export DEBUG="deeplinks:engine:*,deeplinks:migrations:*" | |
deeplinks |