Last active
January 12, 2024 15:42
-
-
Save suenot/2e746eab1b7757778d9af65ab0bc9874 to your computer and use it in GitHub Desktop.
deep production instruction
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
# I add ports in global installed deeplinks: /root/.nvm/versions/node/v18.19.0/lib/node_modules/@deep-foundation/deeplinks/local/docker-compose.yml | |
version: '3.7' | |
services: | |
links: | |
container_name: deep-links | |
image: deepf/deeplinks:main | |
networks: | |
- network | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock | |
extra_hosts: ['host.docker.internal:host-gateway'] | |
ports: | |
- 3006:3006 | |
- 4001:4001 | |
- 7100-7999:7100-7999 | |
restart: always | |
environment: | |
DEEPLINKS_HASURA_PATH: '${DEEPLINKS_HASURA_PATH}' | |
DEEPLINKS_HASURA_SSL: '${DEEPLINKS_HASURA_SSL}' | |
DEEPLINKS_HASURA_SECRET: '${DEEPLINKS_HASURA_SECRET}' | |
JWT_SECRET: '${JWT_SECRET}' | |
DEEPLINKS_HASURA_STORAGE_URL: '${DEEPLINKS_HASURA_STORAGE_URL}' | |
MOESIF_TOKEN: '${MOESIF_TOKEN}' | |
DOCKER: 1 | |
DEEPLINKS_PUBLIC_URL: '${DEEPLINKS_PUBLIC_URL}' | |
NEXT_PUBLIC_DEEPLINKS_SERVER: '${NEXT_PUBLIC_DEEPLINKS_SERVER}' | |
GITPOD_GIT_USER_EMAIL: '${GITPOD_GIT_USER_EMAIL}' | |
GITPOD_TASKS: '${GITPOD_TASKS}' | |
DOCKER_DEEPLINKS_URL: '${DOCKER_DEEPLINKS_URL}' | |
RESERVED_LIFETIME_MS: '${RESERVED_LIFETIME_MS}' | |
MIGRATIONS_DEEPLINKS_URL: '${MIGRATIONS_DEEPLINKS_URL}' | |
MIGRATIONS_HASURA_PATH: '${MIGRATIONS_HASURA_PATH}' | |
MIGRATIONS_HASURA_SSL: '${MIGRATIONS_HASURA_SSL}' | |
MIGRATIONS_HASURA_SECRET: '${MIGRATIONS_HASURA_SECRET}' | |
MIGRATIONS_SCHEMA: '${MIGRATIONS_SCHEMA}' | |
MIGRATIONS_RL_TABLE: '${MIGRATIONS_RL_TABLE}' | |
MIGRATIONS_DATE_TYPE_SQL: '${MIGRATIONS_DATE_TYPE_SQL}' | |
DEFAULT_RL_CRON_SCHEDULE: '${DEFAULT_RL_CRON_SCHEDULE}' | |
PORT: '${DEEPLINKS_PORT}' | |
logging: | |
driver: "json-file" | |
options: | |
max-size: 10m | |
max-file: "3" | |
networks: | |
network: | |
name: deep-network | |
driver: bridge |
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
Open the crontab file for editing by typing the following command in your terminal: | |
crontab -e | |
In the opened file, add the following line to schedule your command (restart deeplinks every day in 04:00 and 16:00): | |
0 4,16 * * * docker restart deep-links | |
Restart time is around 90s. |
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
sudo apt update | |
sudo apt install -y git curl docker.io docker-compose | |
sudo groupadd docker | |
sudo usermod -aG docker $USER | |
docker run hello-world | |
docker rm $(docker ps -a -q --filter "ancestor=hello-world") | |
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 | |
export DEEPCASE_HOST="deepcase.profitmaker.klava.org" | |
export DEEPLINKS_HOST="deeplinks.profitmaker.klava.org" | |
export DEEPAUTH_HOST="auth.profitmaker.klava.org" | |
export DEEPAPP_HOST="profitmaker.klava.org" | |
git clone https://github.com/deep-foundation/dev && (cd dev && npm ci) | |
(cd dev && node configure-nginx.js --configurations "$DEEPCASE_HOST 3007" "$DEEPLINKS_HOST 3006" "$DEEPAUTH_HOST 7100" "$DEEPAPP_HOST 7010" --certbot-email [email protected]) | |
npm rm --unsafe-perm -g @deep-foundation/deeplinks | |
npm install --unsafe-perm -g @deep-foundation/deeplinks@latest | |
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'));") | |
tee call-options.json << JSON | |
{ | |
"operation": "run", | |
"envs": { | |
"DEEPLINKS_PUBLIC_URL": "https://$DEEPLINKS_HOST", | |
"NEXT_PUBLIC_DEEPLINKS_URL": "https://$DEEPLINKS_HOST", | |
"NEXT_PUBLIC_GQL_PATH": "$DEEPLINKS_HOST/gql", | |
"NEXT_PUBLIC_GQL_SSL": "1", | |
"NEXT_PUBLIC_DEEPLINKS_SERVER": "https://$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 | |
docker ps -a | |
# STOP: NEED OPEN PORTS in docker-compose.yml (read another file) | |
export DEEPLINKS_CALL_OPTIONS=$(cat call-options.json) | |
export DEBUG="deeplinks:engine:*,deeplinks:migrations:*" | |
deeplinks | |
docker ps -a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment