From 931705976d7c6c82fe4c4c2a116b3503ab1bc255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Sun, 30 May 2021 17:58:04 +0200 Subject: [PATCH 01/15] Establish new deployment structure with base and code Docker images, first step --- .github/workflows/publish.yml | 4 ++++ backend/Dockerfile | 18 ++++++++++++------ webapp/Dockerfile | 18 +++++++++++++----- webapp/Dockerfile.maintenance | 10 ++++++++-- 4 files changed, 37 insertions(+), 13 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index de956e17b..22526a735 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -55,6 +55,7 @@ jobs: # NEO4J ################################################################## ########################################################################## - name: Neo4J | Build `community` image + # TODO build and push "latest-base" and "latest-code" run: docker build --target community -t "ocelotsocialnetwork/neo4j:latest" -t "ocelotsocialnetwork/neo4j:community" -t "ocelotsocialnetwork/neo4j:${VERSION}" -t "ocelotsocialnetwork/neo4j:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT neo4j/ - name: Neo4J | Save docker image run: docker save "ocelotsocialnetwork/neo4j" > /tmp/neo4j.tar @@ -92,6 +93,7 @@ jobs: # BUILD BACKEND DOCKER IMAGE (production) ################################ ########################################################################## - name: Backend | Build `production` image + # TODO build and push "latest-base" and "latest-code" run: docker build --target production -t "ocelotsocialnetwork/backend:latest" -t "ocelotsocialnetwork/backend:${VERSION}" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT backend/ - name: Backend | Save docker image run: docker save "ocelotsocialnetwork/backend" > /tmp/backend.tar @@ -129,6 +131,7 @@ jobs: # BUILD WEBAPP DOCKER IMAGE (build) ###################################### ########################################################################## - name: Webapp | Build `production` image + # TODO build and push "latest-base" and "latest-code" run: docker build --target production -t "ocelotsocialnetwork/webapp:latest" -t "ocelotsocialnetwork/webapp:${VERSION}" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ - name: Webapp | Save docker image run: docker save "ocelotsocialnetwork/webapp" > /tmp/webapp.tar @@ -166,6 +169,7 @@ jobs: # BUILD MAINTENANCE DOCKER IMAGE (build) ################################# ########################################################################## - name: Maintenance | Build `production` image + # TODO build and push "latest-base" and "latest-code" run: docker build --target production -t "ocelotsocialnetwork/maintenance:latest" -t "ocelotsocialnetwork/maintenance:${VERSION}" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance - name: Maintenance | Save docker image run: docker save "ocelotsocialnetwork/maintenance" > /tmp/maintenance.tar diff --git a/backend/Dockerfile b/backend/Dockerfile index c632f8803..9c1561ac9 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,5 +1,5 @@ ################################################################################## -# BASE ########################################################################### +# BASE (Is pushed to DockerHub for rebranding) ################################### ################################################################################## FROM node:12.19.0-alpine3.10 as base @@ -59,12 +59,18 @@ FROM base as development CMD /bin/sh -c "yarn install && yarn run dev" ################################################################################## -# BUILD (Does contain all files and is therefore bloated) ######################## +# CODE (Does contain all code files and is pushed to DockerHub for rebranding) ### ################################################################################## -FROM base as build +FROM base as code -# Copy everything +# copy everything, but do not build. COPY . . + +################################################################################## +# BUILD (Does contain all files and the compilate and is therefore bloated) ###### +################################################################################## +FROM code as build + # yarn install RUN yarn install --production=false --frozen-lockfile --non-interactive # yarn build @@ -86,7 +92,7 @@ FROM base as production # Copy "binary"-files from build image COPY --from=build ${DOCKER_WORKDIR}/dist ./dist COPY --from=build ${DOCKER_WORKDIR}/node_modules ./node_modules -# Copy static files +# Copy static files # Wolle comment overfluid here? # TODO - externalize the uploads so we can copy the whole folder COPY --from=build ${DOCKER_WORKDIR}/public/img/ ./public/img/ COPY --from=build ${DOCKER_WORKDIR}/public/providers.json ./public/providers.json @@ -94,4 +100,4 @@ COPY --from=build ${DOCKER_WORKDIR}/public/providers.json ./public/providers.jso COPY --from=build ${DOCKER_WORKDIR}/package.json ./package.json # Run command -CMD /bin/sh -c "yarn run start" \ No newline at end of file +CMD /bin/sh -c "yarn run start" diff --git a/webapp/Dockerfile b/webapp/Dockerfile index 75d43bf59..a086a4b2a 100644 --- a/webapp/Dockerfile +++ b/webapp/Dockerfile @@ -1,5 +1,5 @@ ################################################################################## -# BASE ########################################################################### +# BASE (Is pushed to DockerHub for rebranding) ################################### ################################################################################## FROM node:12.19.0-alpine3.10 as base @@ -59,12 +59,18 @@ FROM base as development CMD /bin/sh -c "yarn install && yarn run dev" ################################################################################## -# BUILD (Does contain all files and is therefore bloated) ######################## +# CODE (Does contain all code files and is pushed to DockerHub for rebranding) ### ################################################################################## -FROM base as build +FROM base as code -# Copy everything +# copy everything, but do not build. COPY . . + +################################################################################## +# BUILD (Does contain all files and the compilate and is therefore bloated) ###### +################################################################################## +FROM code as build + # yarn install RUN yarn install --production=false --frozen-lockfile --non-interactive # yarn build @@ -83,11 +89,13 @@ CMD /bin/sh -c "yarn run dev" ################################################################################## FROM base as production +# TODO - do all copying with one COPY command to have one layer # Copy "binary"-files from build image COPY --from=build ${DOCKER_WORKDIR}/.nuxt ./.nuxt COPY --from=build ${DOCKER_WORKDIR}/node_modules ./node_modules COPY --from=build ${DOCKER_WORKDIR}/nuxt.config.js ./nuxt.config.js # Copy static files +# TODO - this seems not be needed anymore for the new rebranding # TODO - this should be one Folder containign all stuff needed to be copied COPY --from=build ${DOCKER_WORKDIR}/config/ ./config/ COPY --from=build ${DOCKER_WORKDIR}/constants ./constants @@ -97,4 +105,4 @@ COPY --from=build ${DOCKER_WORKDIR}/locales ./locales COPY --from=build ${DOCKER_WORKDIR}/package.json ./package.json # Run command -CMD /bin/sh -c "yarn run start" \ No newline at end of file +CMD /bin/sh -c "yarn run start" diff --git a/webapp/Dockerfile.maintenance b/webapp/Dockerfile.maintenance index 0a7616240..b0210511f 100644 --- a/webapp/Dockerfile.maintenance +++ b/webapp/Dockerfile.maintenance @@ -48,11 +48,12 @@ WORKDIR ${DOCKER_WORKDIR} CMD ["yarn", "run", "start"] ################################################################################## -# BUILD ### TODO # TODO # TODO # TODO # TODO # TODO # TODO # TODO # TODO # TODO ## +# CODE (Does contain all code files and is pushed to DockerHub for rebranding) ### ################################################################################## -FROM base as build +FROM base as code COPY package.json yarn.lock ./ +# yarn install RUN yarn install --production=false --frozen-lockfile --non-interactive COPY assets assets @@ -70,7 +71,12 @@ COPY config/ config/ # this will also ovewrite the existing package.json COPY maintenance/source ./ +################################################################################## +# BUILD ### TODO # TODO # TODO # TODO # TODO # TODO # TODO # TODO # TODO # TODO ## +################################################################################## +FROM code as build +# yarn generate RUN yarn run generate ################################################################################## From 6ba2cf097093a1254bbd2cdb11be63011dfc811a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Sun, 30 May 2021 19:46:49 +0200 Subject: [PATCH 02/15] Build base and code Docker images - Push always for test purposes. To be reverted later. --- .github/workflows/publish.yml | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 22526a735..d59a9104e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,9 +1,10 @@ name: ocelot.social publish CI -on: - push: - branches: - - master +# on: +# push: +# branches: +# - master +on: [push] # for testing while developing jobs: ############################################################################## @@ -55,7 +56,6 @@ jobs: # NEO4J ################################################################## ########################################################################## - name: Neo4J | Build `community` image - # TODO build and push "latest-base" and "latest-code" run: docker build --target community -t "ocelotsocialnetwork/neo4j:latest" -t "ocelotsocialnetwork/neo4j:community" -t "ocelotsocialnetwork/neo4j:${VERSION}" -t "ocelotsocialnetwork/neo4j:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT neo4j/ - name: Neo4J | Save docker image run: docker save "ocelotsocialnetwork/neo4j" > /tmp/neo4j.tar @@ -94,7 +94,10 @@ jobs: ########################################################################## - name: Backend | Build `production` image # TODO build and push "latest-base" and "latest-code" - run: docker build --target production -t "ocelotsocialnetwork/backend:latest" -t "ocelotsocialnetwork/backend:${VERSION}" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT backend/ + run: | + docker build --target base -t "ocelotsocialnetwork/backend:latest-base" -t "ocelotsocialnetwork/backend:${VERSION}-base" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}-base" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT backend/ + docker build --target code -t "ocelotsocialnetwork/backend:latest-code" -t "ocelotsocialnetwork/backend:${VERSION}-code" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}-code" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT backend/ + docker build --target production -t "ocelotsocialnetwork/backend:latest" -t "ocelotsocialnetwork/backend:${VERSION}" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT backend/ - name: Backend | Save docker image run: docker save "ocelotsocialnetwork/backend" > /tmp/backend.tar - name: Upload Artifact @@ -132,7 +135,10 @@ jobs: ########################################################################## - name: Webapp | Build `production` image # TODO build and push "latest-base" and "latest-code" - run: docker build --target production -t "ocelotsocialnetwork/webapp:latest" -t "ocelotsocialnetwork/webapp:${VERSION}" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ + run: | + docker build --target base -t "ocelotsocialnetwork/webapp:latest-base" -t "ocelotsocialnetwork/webapp:${VERSION}-base" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}-base" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ + docker build --target code -t "ocelotsocialnetwork/webapp:latest-code" -t "ocelotsocialnetwork/webapp:${VERSION}-code" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}-code" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ + docker build --target production -t "ocelotsocialnetwork/webapp:latest" -t "ocelotsocialnetwork/webapp:${VERSION}" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ - name: Webapp | Save docker image run: docker save "ocelotsocialnetwork/webapp" > /tmp/webapp.tar - name: Upload Artifact @@ -170,7 +176,10 @@ jobs: ########################################################################## - name: Maintenance | Build `production` image # TODO build and push "latest-base" and "latest-code" - run: docker build --target production -t "ocelotsocialnetwork/maintenance:latest" -t "ocelotsocialnetwork/maintenance:${VERSION}" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance + run: | + docker build --target base -t "ocelotsocialnetwork/maintenance:latest-base" -t "ocelotsocialnetwork/maintenance:${VERSION}-base" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}-base" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance + docker build --target code -t "ocelotsocialnetwork/maintenance:latest-code" -t "ocelotsocialnetwork/maintenance:${VERSION}-code" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}-code" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance + docker build --target production -t "ocelotsocialnetwork/maintenance:latest" -t "ocelotsocialnetwork/maintenance:${VERSION}" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance - name: Maintenance | Save docker image run: docker save "ocelotsocialnetwork/maintenance" > /tmp/maintenance.tar - name: Upload Artifact From 92abc35a60b3e396919c29a4fa56d4d3c4c92520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Sun, 30 May 2021 20:26:12 +0200 Subject: [PATCH 03/15] Remove comments --- .github/workflows/publish.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d59a9104e..3eb9d77e7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -93,7 +93,6 @@ jobs: # BUILD BACKEND DOCKER IMAGE (production) ################################ ########################################################################## - name: Backend | Build `production` image - # TODO build and push "latest-base" and "latest-code" run: | docker build --target base -t "ocelotsocialnetwork/backend:latest-base" -t "ocelotsocialnetwork/backend:${VERSION}-base" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}-base" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT backend/ docker build --target code -t "ocelotsocialnetwork/backend:latest-code" -t "ocelotsocialnetwork/backend:${VERSION}-code" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}-code" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT backend/ @@ -134,7 +133,6 @@ jobs: # BUILD WEBAPP DOCKER IMAGE (build) ###################################### ########################################################################## - name: Webapp | Build `production` image - # TODO build and push "latest-base" and "latest-code" run: | docker build --target base -t "ocelotsocialnetwork/webapp:latest-base" -t "ocelotsocialnetwork/webapp:${VERSION}-base" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}-base" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ docker build --target code -t "ocelotsocialnetwork/webapp:latest-code" -t "ocelotsocialnetwork/webapp:${VERSION}-code" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}-code" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ @@ -175,7 +173,6 @@ jobs: # BUILD MAINTENANCE DOCKER IMAGE (build) ################################# ########################################################################## - name: Maintenance | Build `production` image - # TODO build and push "latest-base" and "latest-code" run: | docker build --target base -t "ocelotsocialnetwork/maintenance:latest-base" -t "ocelotsocialnetwork/maintenance:${VERSION}-base" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}-base" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance docker build --target code -t "ocelotsocialnetwork/maintenance:latest-code" -t "ocelotsocialnetwork/maintenance:${VERSION}-code" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}-code" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance From a0a2fb43abbb4663097b4495d736071c3a95fcef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Sun, 30 May 2021 20:52:16 +0200 Subject: [PATCH 04/15] Prettify some formating --- docker-compose.override.yml | 5 +---- docker-compose.test.yml | 5 +---- docker-compose.yml | 3 --- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 8d1bb96f2..5fceb2776 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -18,7 +18,6 @@ services: - webapp_node_modules:/app/node_modules # bind the local folder to the docker to allow live reload - ./webapp:/app - ######################################################## # BACKEND ############################################## ######################################################## @@ -35,7 +34,6 @@ services: - backend_node_modules:/app/node_modules # bind the local folder to the docker to allow live reload - ./backend:/app - ######################################################## # NEO4J ################################################ ######################################################## @@ -47,13 +45,11 @@ services: networks: # So we can access the neo4j query browser from our host machine - external-net - ######################################################## # MAINTENANCE ########################################## ######################################################## maintenance: image: ocelotsocialnetwork/maintenance:development - ######################################################## # MAILSERVER TO FAKE SMTP ############################## ######################################################## @@ -63,6 +59,7 @@ services: - 1080:80 networks: - external-net + volumes: webapp_node_modules: backend_node_modules: diff --git a/docker-compose.test.yml b/docker-compose.test.yml index eef71e67b..973cf87cf 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -12,7 +12,6 @@ services: - NODE_ENV="test" volumes: - ./coverage:/app/coverage - ######################################################## # BACKEND ############################################## ######################################################## @@ -24,7 +23,6 @@ services: - NODE_ENV="test" volumes: - ./coverage:/app/coverage - ######################################################## # NEO4J ################################################ ######################################################## @@ -41,13 +39,11 @@ services: networks: # So we can access the neo4j query browser from our host machine - external-net - ######################################################## # MAINTENANCE ########################################## ######################################################## maintenance: image: ocelotsocialnetwork/maintenance:test - ######################################################## # MAILSERVER TO FAKE SMTP ############################## ######################################################## @@ -57,6 +53,7 @@ services: - 1080:80 networks: - external-net + volumes: webapp_node_modules: backend_node_modules: diff --git a/docker-compose.yml b/docker-compose.yml index 392447f61..d20bb6aec 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,7 +35,6 @@ services: - GRAPHQL_URI=http://backend:4000 env_file: - ./webapp/.env - ######################################################## # BACKEND ############################################## ######################################################## @@ -68,7 +67,6 @@ services: - CLIENT_URI=http://webapp:3000 env_file: - ./backend/.env - ######################################################## # NEO4J ################################################ ######################################################## @@ -92,7 +90,6 @@ services: # TODO: clarify if that is the only thing needed to unlock the Enterprise version # - NEO4J_ACCEPT_LICENSE_AGREEMENT=yes # TODO: Remove the playground from production - ######################################################## # MAINTENANCE ########################################## ######################################################## From 19e3c9cc7ae6f4483e8bacd8d0cfff583d3e3bd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Tue, 1 Jun 2021 13:11:39 +0200 Subject: [PATCH 05/15] Add copying of nginx config into maintenance 'code' target - To use the nginx config in rebranding. --- webapp/Dockerfile.maintenance | 2 ++ 1 file changed, 2 insertions(+) diff --git a/webapp/Dockerfile.maintenance b/webapp/Dockerfile.maintenance index b0210511f..dcc06ad61 100644 --- a/webapp/Dockerfile.maintenance +++ b/webapp/Dockerfile.maintenance @@ -68,6 +68,8 @@ COPY constants constants COPY nuxt.config.js nuxt.config.js COPY config/ config/ +# this is needed in rebranding +COPY maintenance/nginx maintenance/nginx # this will also ovewrite the existing package.json COPY maintenance/source ./ From 76791f72ad0e4fe080adfddd15afd11e718fc86e Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 7 Jun 2021 13:51:22 +0200 Subject: [PATCH 06/15] roberts suggestion regarding branch deployment --- .github/workflows/publish.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3eb9d77e7..8cce1d29c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,10 +1,10 @@ name: ocelot.social publish CI -# on: -# push: -# branches: -# - master -on: [push] # for testing while developing +on: + push: + branches: + - master + - 4451-new-deployment-with-base-and-code # for testing while developing jobs: ############################################################################## From 791d873df2e53d2f064b1fe53766c0bebfa9009e Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 7 Jun 2021 14:04:36 +0200 Subject: [PATCH 07/15] -remove node_modules -build production --- backend/Dockerfile | 6 +++--- webapp/Dockerfile | 4 ++-- webapp/Dockerfile.maintenance | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 9c1561ac9..85fdd3957 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -72,7 +72,7 @@ COPY . . FROM code as build # yarn install -RUN yarn install --production=false --frozen-lockfile --non-interactive +RUN yarn install --production=true --frozen-lockfile --non-interactive # yarn build RUN yarn run build @@ -91,8 +91,8 @@ FROM base as production # Copy "binary"-files from build image COPY --from=build ${DOCKER_WORKDIR}/dist ./dist -COPY --from=build ${DOCKER_WORKDIR}/node_modules ./node_modules -# Copy static files # Wolle comment overfluid here? +# COPY --from=build ${DOCKER_WORKDIR}/node_modules ./node_modules +# Copy static files # TODO - externalize the uploads so we can copy the whole folder COPY --from=build ${DOCKER_WORKDIR}/public/img/ ./public/img/ COPY --from=build ${DOCKER_WORKDIR}/public/providers.json ./public/providers.json diff --git a/webapp/Dockerfile b/webapp/Dockerfile index a086a4b2a..670f577b9 100644 --- a/webapp/Dockerfile +++ b/webapp/Dockerfile @@ -72,7 +72,7 @@ COPY . . FROM code as build # yarn install -RUN yarn install --production=false --frozen-lockfile --non-interactive +RUN yarn install --production=true --frozen-lockfile --non-interactive # yarn build RUN yarn run build @@ -92,7 +92,7 @@ FROM base as production # TODO - do all copying with one COPY command to have one layer # Copy "binary"-files from build image COPY --from=build ${DOCKER_WORKDIR}/.nuxt ./.nuxt -COPY --from=build ${DOCKER_WORKDIR}/node_modules ./node_modules +#COPY --from=build ${DOCKER_WORKDIR}/node_modules ./node_modules COPY --from=build ${DOCKER_WORKDIR}/nuxt.config.js ./nuxt.config.js # Copy static files # TODO - this seems not be needed anymore for the new rebranding diff --git a/webapp/Dockerfile.maintenance b/webapp/Dockerfile.maintenance index dcc06ad61..ce3b43d88 100644 --- a/webapp/Dockerfile.maintenance +++ b/webapp/Dockerfile.maintenance @@ -54,7 +54,7 @@ FROM base as code COPY package.json yarn.lock ./ # yarn install -RUN yarn install --production=false --frozen-lockfile --non-interactive +RUN yarn install --production=true --frozen-lockfile --non-interactive COPY assets assets COPY components/LocaleSwitch/ components/LocaleSwitch From b6b93f58d7aca024e0fa125006d76549ba1cbb29 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 7 Jun 2021 14:11:01 +0200 Subject: [PATCH 08/15] moved babel into main dependencies --- backend/package.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/backend/package.json b/backend/package.json index 9787253a1..8b10f632d 100644 --- a/backend/package.json +++ b/backend/package.json @@ -39,6 +39,12 @@ ] }, "dependencies": { + "@babel/cli": "~7.8.4", + "@babel/core": "~7.9.0", + "@babel/node": "~7.8.7", + "@babel/plugin-proposal-throw-expressions": "^7.8.3", + "@babel/preset-env": "~7.9.5", + "@babel/register": "^7.9.0", "@hapi/joi": "^17.1.1", "@sentry/node": "^5.15.4", "apollo-cache-inmemory": "~1.6.5", @@ -48,6 +54,9 @@ "apollo-server": "~2.14.2", "apollo-server-express": "^2.14.2", "aws-sdk": "^2.652.0", + "babel-core": "~7.0.0-0", + "babel-eslint": "~10.1.0", + "babel-jest": "~25.2.6", "babel-plugin-transform-runtime": "^6.23.0", "bcryptjs": "~2.4.3", "cheerio": "~1.0.0-rc.3", @@ -111,16 +120,7 @@ "xregexp": "^4.3.0" }, "devDependencies": { - "@babel/cli": "~7.8.4", - "@babel/core": "~7.9.0", - "@babel/node": "~7.8.7", - "@babel/plugin-proposal-throw-expressions": "^7.8.3", - "@babel/preset-env": "~7.9.5", - "@babel/register": "^7.9.0", "apollo-server-testing": "~2.11.0", - "babel-core": "~7.0.0-0", - "babel-eslint": "~10.1.0", - "babel-jest": "~25.2.6", "chai": "~4.2.0", "cucumber": "~6.0.5", "eslint": "~6.8.0", From 92bda02f0e27e8009fdf7eeaeeff87819612a37f Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 7 Jun 2021 14:58:28 +0200 Subject: [PATCH 09/15] use some ebug builds since its not working out of the box --- webapp/Dockerfile | 2 +- webapp/Dockerfile.maintenance | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/Dockerfile b/webapp/Dockerfile index 670f577b9..fa50ef1e5 100644 --- a/webapp/Dockerfile +++ b/webapp/Dockerfile @@ -92,7 +92,7 @@ FROM base as production # TODO - do all copying with one COPY command to have one layer # Copy "binary"-files from build image COPY --from=build ${DOCKER_WORKDIR}/.nuxt ./.nuxt -#COPY --from=build ${DOCKER_WORKDIR}/node_modules ./node_modules +COPY --from=build ${DOCKER_WORKDIR}/node_modules ./node_modules COPY --from=build ${DOCKER_WORKDIR}/nuxt.config.js ./nuxt.config.js # Copy static files # TODO - this seems not be needed anymore for the new rebranding diff --git a/webapp/Dockerfile.maintenance b/webapp/Dockerfile.maintenance index ce3b43d88..dcc06ad61 100644 --- a/webapp/Dockerfile.maintenance +++ b/webapp/Dockerfile.maintenance @@ -54,7 +54,7 @@ FROM base as code COPY package.json yarn.lock ./ # yarn install -RUN yarn install --production=true --frozen-lockfile --non-interactive +RUN yarn install --production=false --frozen-lockfile --non-interactive COPY assets assets COPY components/LocaleSwitch/ components/LocaleSwitch From 02f5434ef3a5b9c55f60335112fecf447e656880 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 7 Jun 2021 15:07:59 +0200 Subject: [PATCH 10/15] production=false for webapp --- webapp/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/Dockerfile b/webapp/Dockerfile index fa50ef1e5..a086a4b2a 100644 --- a/webapp/Dockerfile +++ b/webapp/Dockerfile @@ -72,7 +72,7 @@ COPY . . FROM code as build # yarn install -RUN yarn install --production=true --frozen-lockfile --non-interactive +RUN yarn install --production=false --frozen-lockfile --non-interactive # yarn build RUN yarn run build From b3538577dc25ebb839b20000606cc9125b248a32 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 7 Jun 2021 15:31:29 +0200 Subject: [PATCH 11/15] backend production=false --- backend/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 85fdd3957..1a28b2e0d 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -72,7 +72,7 @@ COPY . . FROM code as build # yarn install -RUN yarn install --production=true --frozen-lockfile --non-interactive +RUN yarn install --production=false --frozen-lockfile --non-interactive # yarn build RUN yarn run build From 3f7d1c7bd064b797dbe75e9b03e6c599d7f509e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Mon, 7 Jun 2021 18:50:21 +0200 Subject: [PATCH 12/15] Follow suggestions of Moriz and Robert --- backend/Dockerfile | 9 ++++----- webapp/Dockerfile | 15 ++++----------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 1a28b2e0d..ecfd63f74 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -90,14 +90,13 @@ CMD /bin/sh -c "yarn run dev" FROM base as production # Copy "binary"-files from build image -COPY --from=build ${DOCKER_WORKDIR}/dist ./dist -# COPY --from=build ${DOCKER_WORKDIR}/node_modules ./node_modules +COPY --from=build ./dist ./dist # Copy static files # TODO - externalize the uploads so we can copy the whole folder -COPY --from=build ${DOCKER_WORKDIR}/public/img/ ./public/img/ -COPY --from=build ${DOCKER_WORKDIR}/public/providers.json ./public/providers.json +COPY --from=build ./public/img/ ./public/img/ +COPY --from=build ./public/providers.json ./public/providers.json # Copy package.json for script definitions (lock file should not be needed) -COPY --from=build ${DOCKER_WORKDIR}/package.json ./package.json +COPY --from=build ./package.json ./package.json # Run command CMD /bin/sh -c "yarn run start" diff --git a/webapp/Dockerfile b/webapp/Dockerfile index a086a4b2a..3e3b5765a 100644 --- a/webapp/Dockerfile +++ b/webapp/Dockerfile @@ -91,18 +91,11 @@ FROM base as production # TODO - do all copying with one COPY command to have one layer # Copy "binary"-files from build image -COPY --from=build ${DOCKER_WORKDIR}/.nuxt ./.nuxt -COPY --from=build ${DOCKER_WORKDIR}/node_modules ./node_modules -COPY --from=build ${DOCKER_WORKDIR}/nuxt.config.js ./nuxt.config.js -# Copy static files -# TODO - this seems not be needed anymore for the new rebranding -# TODO - this should be one Folder containign all stuff needed to be copied -COPY --from=build ${DOCKER_WORKDIR}/config/ ./config/ -COPY --from=build ${DOCKER_WORKDIR}/constants ./constants -COPY --from=build ${DOCKER_WORKDIR}/static ./static -COPY --from=build ${DOCKER_WORKDIR}/locales ./locales +COPY --from=build ./.nuxt ./.nuxt +COPY --from=build ./node_modules ./node_modules +COPY --from=build ./nuxt.config.js ./nuxt.config.js # Copy package.json for script definitions (lock file should not be needed) -COPY --from=build ${DOCKER_WORKDIR}/package.json ./package.json +COPY --from=build ./package.json ./package.json # Run command CMD /bin/sh -c "yarn run start" From 9894abb29aa7f10111eb9870cc9b5d6114b93d4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Mon, 7 Jun 2021 19:03:55 +0200 Subject: [PATCH 13/15] Revert remove of '${DOCKER_WORKDIR}' --- backend/Dockerfile | 8 ++++---- webapp/Dockerfile | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index ecfd63f74..0ebdfb1eb 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -90,13 +90,13 @@ CMD /bin/sh -c "yarn run dev" FROM base as production # Copy "binary"-files from build image -COPY --from=build ./dist ./dist +COPY --from=build ${DOCKER_WORKDIR}/dist ./dist # Copy static files # TODO - externalize the uploads so we can copy the whole folder -COPY --from=build ./public/img/ ./public/img/ -COPY --from=build ./public/providers.json ./public/providers.json +COPY --from=build ${DOCKER_WORKDIR}/public/img/ ./public/img/ +COPY --from=build ${DOCKER_WORKDIR}/public/providers.json ./public/providers.json # Copy package.json for script definitions (lock file should not be needed) -COPY --from=build ./package.json ./package.json +COPY --from=build ${DOCKER_WORKDIR}/package.json ./package.json # Run command CMD /bin/sh -c "yarn run start" diff --git a/webapp/Dockerfile b/webapp/Dockerfile index 3e3b5765a..8d830a9d5 100644 --- a/webapp/Dockerfile +++ b/webapp/Dockerfile @@ -91,11 +91,11 @@ FROM base as production # TODO - do all copying with one COPY command to have one layer # Copy "binary"-files from build image -COPY --from=build ./.nuxt ./.nuxt -COPY --from=build ./node_modules ./node_modules -COPY --from=build ./nuxt.config.js ./nuxt.config.js +COPY --from=build ${DOCKER_WORKDIR}/.nuxt ./.nuxt +COPY --from=build ${DOCKER_WORKDIR}/node_modules ./node_modules +COPY --from=build ${DOCKER_WORKDIR}/nuxt.config.js ./nuxt.config.js # Copy package.json for script definitions (lock file should not be needed) -COPY --from=build ./package.json ./package.json +COPY --from=build ${DOCKER_WORKDIR}/package.json ./package.json # Run command CMD /bin/sh -c "yarn run start" From 00a2cf6fb0864f1209853917822c160c21c15c96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Mon, 7 Jun 2021 19:43:47 +0200 Subject: [PATCH 14/15] Set publish again on master push only --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8cce1d29c..1c7927665 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -4,7 +4,7 @@ on: push: branches: - master - - 4451-new-deployment-with-base-and-code # for testing while developing + # - 4451-new-deployment-with-base-and-code # for testing while developing jobs: ############################################################################## From 263853f440ddc2018381b346015845a9009814c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Mon, 7 Jun 2021 20:01:00 +0200 Subject: [PATCH 15/15] Correct short name --- webapp/constants/metadata.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/constants/metadata.js b/webapp/constants/metadata.js index d40308e80..da313c7fb 100644 --- a/webapp/constants/metadata.js +++ b/webapp/constants/metadata.js @@ -1,7 +1,7 @@ // this file is duplicated in `backend/src/config/metadata.js` and `webapp/constants/metadata.js` and replaced on rebranding export default { APPLICATION_NAME: 'ocelot.social', - APPLICATION_SHORT_NAME: 'ocelot', + APPLICATION_SHORT_NAME: 'ocelot.social', APPLICATION_DESCRIPTION: 'ocelot.social Community Network', COOKIE_NAME: 'ocelot-social-token', ORGANIZATION_NAME: 'ocelot.social Community',