diff --git a/Dockerfile b/Dockerfile index 2f10c7e..16710a4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -63,6 +63,7 @@ RUN npm install sqlite3 --build-from-source --save-dev RUN npm install --save-dev sequelize RUN npm rebuild RUN npm run tsc +RUN npm cache clean --force VOLUME /relay/.lnd diff --git a/config/app.json b/config/app.json index 7fa1eaf..cab04c6 100644 --- a/config/app.json +++ b/config/app.json @@ -15,10 +15,9 @@ }, "production": { "senza_url": "https://staging.senza.us/api/v2/", - "macaroon_location": "/home/ubuntu/.lnd/data/chain/bitcoin/mainnet/admin.macaroon", - "tls_location": "/home/ubuntu/.lnd/tls.cert", - "lnd_log_location": "/home/ubuntu/.lnd/logs/bitcoin/mainnet/lnd.log", - "lncli_location": "/home/ubuntu/go/bin", + "macaroon_location": "/relay/.lnd/data/chain/bitcoin/mainnet/admin.macaroon", + "tls_location": "/relay/.lnd/tls.cert", + "lnd_log_location": "/relay/.lnd/logs/bitcoin/mainnet/lnd.log", "node_ip": "localhost", "node_http_protocol": "http", "node_http_port": "80", diff --git a/config/config.json b/config/config.json index ba232b8..0a24045 100644 --- a/config/config.json +++ b/config/config.json @@ -13,6 +13,6 @@ }, "production": { "dialect": "sqlite", - "storage": "/home/ubuntu/sphinx.db" + "storage": "/relay/.lnd/sphinx.db" } } diff --git a/lnd_supervisor.conf b/lnd_supervisor.conf index 026d794..e6a0ef4 100644 --- a/lnd_supervisor.conf +++ b/lnd_supervisor.conf @@ -3,4 +3,8 @@ user=root command=sh -c 'lnd --lnddir=/relay/.lnd/ --alias=$HOSTNAME --tlsextradomain=$(curl $ECS_CONTAINER_METADATA_URI | echo $(jq -r .DockerName).$NODE_DOMAIN) --externalip=$(curl $ECS_CONTAINER_METADATA_URI | echo $(jq -r .DockerName).$NODE_DOMAIN)' startretries=999999999999999999999999999 autostart=true -autorestart=true \ No newline at end of file +autorestart=true +stdout_logfile=/var/log/supervisor/%(program_name)s.log +stderr_logfile=/var/log/supervisor/%(program_name)s.log +stdout_logfile_maxbytes=10MB +stdout_logfile_backups=10 \ No newline at end of file diff --git a/package.json b/package.json index 1e3a257..0f38755 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "tsc": "rm -rf dist/ && tsc && cp -r public dist/public", "dev": "rm -rf dist/ && tsc && cp -r public dist/public && node --inspect ./dist/app.js", "build-binaries": "rm -rf dist/ && tsc && cp config/app.json dist/config/app.json && cp config/config.json dist/config/config.json && pkg . --target node12-alpine-x64,node12-macos-x64 --out-path binaries", - "start-ecs": "export NODE_ALIAS=$HOSTNAME && export NODE_IP=$(curl $ECS_CONTAINER_METADATA_URI | echo $(jq -r .DockerName).$NODE_DOMAIN) && export NODE_ENV=production && node dist/app.js" + "start-ecs": "export NODE_ALIAS=$HOSTNAME && export NODE_IP=$(curl $ECS_CONTAINER_METADATA_URI | echo $(jq -r .DockerName).$NODE_DOMAIN) && export NODE_ENV=production && node dist/app.js", + "start-ecs-low-mem": "export NODE_ALIAS=$HOSTNAME && export NODE_IP=$(curl $ECS_CONTAINER_METADATA_URI | echo $(jq -r .DockerName).$NODE_DOMAIN) && export NODE_ENV=production && node --max-old-space-size=128 dist/app.js" }, "keywords": [], "author": "", diff --git a/relay_supervisor.conf b/relay_supervisor.conf index 2f66940..06a244a 100644 --- a/relay_supervisor.conf +++ b/relay_supervisor.conf @@ -1,6 +1,10 @@ [program:relay] user=root -command=npm run start-ecs --prefix /relay/ +command=npm run start-ecs-low-mem --prefix /relay/ startretries=999999999999999999999999999 autostart=true -autorestart=true \ No newline at end of file +autorestart=true +stdout_logfile=/var/log/supervisor/%(program_name)s.log +stderr_logfile=/var/log/supervisor/%(program_name)s.log +stdout_logfile_maxbytes=10MB +stdout_logfile_backups=10 \ No newline at end of file