From 97b25bb7227d78653ce363c825254abadcdeb322 Mon Sep 17 00:00:00 2001 From: milanmajchrak <90026355+milanmajchrak@users.noreply.github.com> Date: Thu, 1 Feb 2024 09:00:35 +0100 Subject: [PATCH] Internal/run container in production mode (#456) * Added NODE_ENV=production because the container is trying to run in development mode * Use Vanilla dspace-ui.json instead of ours from root. * Updated path for running `dspace-ui.json` --- .github/workflows/deploy.yml | 10 ++++++---- Dockerfile | 2 +- docker/docker-compose.yml | 2 +- docker/dspace-ui.json | 17 +++++++++-------- dspace-ui.json | 12 ------------ 5 files changed, 17 insertions(+), 26 deletions(-) delete mode 100644 dspace-ui.json diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d07dd66d991..3bcd109b2d5 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -40,7 +40,7 @@ jobs: run: | cd $GITHUB_WORKSPACE/build-scripts/run/ pwd - + touch .env.dev-5 || true echo INSTANCE=5 >> .env.dev-5 echo DSPACE_HOST=dev-5.pc >> .env.dev-5 @@ -50,7 +50,7 @@ jobs: echo DSPACE_UI_IMAGE=\${DOCKER_OWNER}/dspace-angular:\$DSPACE_VER >> .env.dev-5 echo DSPACE_REST_IMAGE=\${DOCKER_OWNER}/dspace:\$DSPACE_VER >> .env.dev-5 echo DSPACE_REST_PORT=8\$INSTANCE >> .env.dev-5 - echo REST_URL=http://\${DSPACE_HOST}:\${DSPACE_REST_PORT}/server/ >> .env.dev-5 + echo REST_URL=http://\${DSPACE_HOST}:\${DSPACE_REST_PORT}/server >> .env.dev-5 echo UI_URL=http://\${DSPACE_HOST}:\${DSPACE_REST_PORT} >> .env.dev-5 echo S3_STORAGE=0 >> .env.dev-5 @@ -62,6 +62,8 @@ jobs: echo S3_SECRET=${{ secrets.AMAZON_SECRET }} >> .env.dev-5 echo S3_REGION_NAME=eu-central-1 >> .env.dev-5 + echo NODE_ENV=production >> .env.dev-5 + export ENVFILE=$(pwd)/.env.dev-5 ./start.sh dspace-5 @@ -86,8 +88,8 @@ jobs: ./start.sh dspace-$INSTANCE /bin/bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://dev-5.pc:8$INSTANCE/server/api)" != "200" ]]; do sleep 5; done' - - + + import-8: runs-on: dspace-dep-1 if: github.event.inputs.IMPORT == 'true' diff --git a/Dockerfile b/Dockerfile index 664cd409aca..e7420983a0f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,5 +28,5 @@ ENV NODE_ENV development RUN apk add tzdata RUN yarn build:prod RUN npm install pm2 -g -CMD /bin/sh -c "pm2-runtime start dspace-ui.json > /dev/null 2> /dev/null" +CMD /bin/sh -c "pm2-runtime start docker/dspace-ui.json > /dev/null 2> /dev/null" diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 21c8adec4fd..4734a4010a7 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -31,7 +31,7 @@ services: dockerfile: Dockerfile networks: dspacenet: - entrypoint: ${FE_CMD:-/bin/sh -c "pm2-runtime start dspace-ui.json > /dev/null 2> /dev/null"} + entrypoint: ${FE_CMD:-/bin/sh -c "pm2-runtime start docker/dspace-ui.json > /dev/null 2> /dev/null"} ports: - published: 400${INSTANCE} target: 4000 diff --git a/docker/dspace-ui.json b/docker/dspace-ui.json index 0758679ab81..3b4276e24f2 100644 --- a/docker/dspace-ui.json +++ b/docker/dspace-ui.json @@ -1,11 +1,12 @@ { "apps": [ - { - "name": "dspace-ui", - "cwd": "/app", - "script": "dist/server/main.js", - "instances": "max", - "exec_mode": "cluster" - } + { + "name": "dspace-ui", + "cwd": "/app", + "script": "dist/server/main.js", + "instances": "7", + "exec_mode": "cluster", + "node_args": "--max_old_space_size=4096" + } ] -} \ No newline at end of file +} diff --git a/dspace-ui.json b/dspace-ui.json deleted file mode 100644 index 85e020ce63e..00000000000 --- a/dspace-ui.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "apps": [ - { - "name": "dspace-ui", - "cwd": "/app", - "script": "dist/server/main.js", - "instances": "7", - "exec_mode": "cluster", - "node_args": "--max_old_space_size=4096" - } - ] -}