From a4e4d5d74eb1c922948135a6f3133c054fd0f064 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 19 Jan 2021 10:34:08 +0100 Subject: [PATCH 01/50] New Dockerfile for the backend --- backend/Dockerfile | 90 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 73 insertions(+), 17 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 6d3def015..3811d1418 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,28 +1,84 @@ +################################################################################## +# BASE ########################################################################### +################################################################################## FROM node:12.19.0-alpine3.10 as base -LABEL Description="Backend of the Social Network ocelot.social" Vendor="ocelot.social Community" Version="0.0.1" Maintainer="ocelot.social Community (devops@ocelot.social)" -EXPOSE 4000 -CMD ["yarn", "run", "start"] -ARG BUILD_COMMIT -ENV BUILD_COMMIT=$BUILD_COMMIT -ARG WORKDIR=/develop-backend -RUN mkdir -p $WORKDIR -WORKDIR $WORKDIR +# ENVs (available in production aswell, can be overwritten by commandline or env file) +## DOCKER_WORKDIR would be a classical ARG, but that is not multi layer persistent - shame +ENV DOCKER_WORKDIR="/app" +## We Cannot do `$(date -u +'%Y-%m-%dT%H:%M:%SZ')` here so we use unix timestamp=0 +ENV BUILD_DATE="1970-01-01T00:00:00.00Z" +## We cannot do $(yarn run version) here so we default to 0.0.0 +## TODO: Missing Build number - do that once we have a CI which actually generates it +ENV BUILD_VERSION="0.0.0" +## We cannot do `$(git rev-parse --short HEAD)` here so we default to 0000000 +ENV BUILD_COMMIT="0000000" +## SET NODE_ENV +ENV NODE_ENV=production +## App Envs +ENV PORT="3000" -RUN apk --no-cache add git +# Labels +LABEL org.label-schema.build-date="${BUILD_DATE}" +LABEL org.label-schema.name="ocelot.social:backend" +LABEL org.label-schema.description="Backend of the Social Network Software ocelot.social" +LABEL org.label-schema.usage="https://github.com/Ocelot-Social-Community/Ocelot-Social/blob/master/README.md" +LABEL org.label-schema.url="https://ocelot.social" +LABEL org.label-schema.vcs-url="https://github.com/Ocelot-Social-Community/Ocelot-Social/tree/master/backend" +LABEL org.label-schema.vcs-ref="${BUILD_COMMIT}" +LABEL org.label-schema.vendor="ocelot.social Community" +LABEL org.label-schema.version="${VERSION}" +LABEL org.label-schema.schema-version="1.0" +LABEL maintainer="devops@ocelot.social" +# Settings +EXPOSE ${PORT} +WORKDIR ${DOCKER_WORKDIR} + +## Make Workdir +RUN mkdir -p ${DOCKER_WORKDIR} +## Additional Software +RUN apk --no-cache add git +## Copy package.json, yarn.lock, .env COPY package.json yarn.lock ./ COPY .env.template .env -FROM base as build-and-test -RUN yarn install --production=false --frozen-lockfile --non-interactive -COPY . . -RUN NODE_ENV=production yarn run build +# Run command +CMD ["yarn", "run", "start"] -# reduce image size with a multistage build +################################################################################## +# DEVELOPMENT (Connected to the local environment, to reload on demand) ########## +################################################################################## +FROM base as development + +# We don't need to copy or build anything since we gonna bind to the +# local filesystem which will need a rebuild anyway + +# Define Volume for workdir folder on development +VOLUME ${DOCKER_WORKDIR} + +################################################################################## +# BUILD (Does contain all files and is therefore bloated) ######################## +################################################################################## +FROM base as build + +# Copy everything +COPY . . +# yarn install +RUN yarn install --production=false --frozen-lockfile --non-interactive +# yarn build +RUN yarn run build + +################################################################################## +# PRODUCTION (Does contain only "binary"- and static-files to reduce image size) # +################################################################################## FROM base as production -ENV NODE_ENV=production -COPY --from=build-and-test /develop-backend/dist ./dist + +# Copy "binary"-files from build image +COPY --from=build ${DOCKER_WORKDIR}/dist ./dist +# Copy static files +# TODO - externalize the uploads so we can copy the whole folder COPY ./public/img/ ./public/img/ COPY ./public/providers.json ./public/providers.json -RUN yarn install --production=true --frozen-lockfile --non-interactive --no-cache +# yarn install +RUN yarn install --production=true --frozen-lockfile --non-interactive --no-cache \ No newline at end of file From 0523c88bb807fdb27d2235a71274a725a64f8a02 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 19 Jan 2021 12:40:40 +0100 Subject: [PATCH 02/50] - fixed docker compose for backend - changed backend port to 4000 - removed volume from development build stage --- backend/Dockerfile | 4 ++-- docker-compose.override.yml | 12 ++++++------ docker-compose.yml | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 3811d1418..8640c3ff8 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -16,7 +16,7 @@ ENV BUILD_COMMIT="0000000" ## SET NODE_ENV ENV NODE_ENV=production ## App Envs -ENV PORT="3000" +ENV PORT="4000" # Labels LABEL org.label-schema.build-date="${BUILD_DATE}" @@ -55,7 +55,7 @@ FROM base as development # local filesystem which will need a rebuild anyway # Define Volume for workdir folder on development -VOLUME ${DOCKER_WORKDIR} +# VOLUME ${DOCKER_WORKDIR} ################################################################################## # BUILD (Does contain all files and is therefore bloated) ######################## diff --git a/docker-compose.override.yml b/docker-compose.override.yml index dd38cacde..03ef42ee1 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -14,10 +14,10 @@ services: - ./webapp:/develop-webapp - webapp_node_modules:/develop-webapp/node_modules backend: - image: ocelotsocialnetwork/develop-backend:build-and-test + image: ocelotsocialnetwork/develop-backend:development build: - context: backend - target: build-and-test + context: ./backend + target: development command: yarn run dev environment: - SMTP_HOST=mailserver @@ -26,9 +26,9 @@ services: - "DEBUG=${DEBUG}" - PUBLIC_REGISTRATION=false volumes: - - ./backend:/develop-backend - - backend_node_modules:/develop-backend/node_modules - - uploads:/develop-backend/public/uploads + - ./backend:/app + - backend_node_modules:/app/node_modules + - uploads:/app/public/uploads neo4j: volumes: - neo4j_data:/data diff --git a/docker-compose.yml b/docker-compose.yml index 5297bc399..f90dadb0e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -36,12 +36,12 @@ services: ports: - 4000:4000 volumes: - - ./backend:/develop-backend - - backend_node_modules:/develop-backend/node_modules - - uploads:/develop-backend/public/uploads + - ./backend:/app + - backend_node_modules:/app/node_modules + - uploads:/app/public/uploads environment: - NEO4J_URI=bolt://neo4j:7687 - - GRAPHQL_URI=http://backend:4000 + - GRAPHQL_URI=http://localhost:4000 - CLIENT_URI=http://localhost:3000 - JWT_SECRET=b/&&7b78BF&fv/Vd - MAPBOX_TOKEN=pk.eyJ1IjoiYnVzZmFrdG9yIiwiYSI6ImNraDNiM3JxcDBhaWQydG1uczhpZWtpOW4ifQ.7TNRTO-o9aK1Y6MyW_Nd4g From 269e38b56ecad8e7e30fc6dbabcdc99e18d9d241 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 19 Jan 2021 14:26:17 +0100 Subject: [PATCH 03/50] backend dockerfile and compose seem to be pretty solid now --- backend/Dockerfile | 32 +++++++++++++--------- docker-compose.override.yml | 17 ++++-------- docker-compose.production.yml | 3 ++- docker-compose.yml | 50 ++++++++++++++++++++++++----------- 4 files changed, 62 insertions(+), 40 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 8640c3ff8..7097b7486 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -14,8 +14,8 @@ ENV BUILD_VERSION="0.0.0" ## We cannot do `$(git rev-parse --short HEAD)` here so we default to 0000000 ENV BUILD_COMMIT="0000000" ## SET NODE_ENV -ENV NODE_ENV=production -## App Envs +ENV NODE_ENV="production" +## App relevant Envs ENV PORT="4000" # Labels @@ -31,20 +31,16 @@ LABEL org.label-schema.version="${VERSION}" LABEL org.label-schema.schema-version="1.0" LABEL maintainer="devops@ocelot.social" +# Install Additional Software +## install: git +RUN apk --no-cache add git + # Settings EXPOSE ${PORT} -WORKDIR ${DOCKER_WORKDIR} ## Make Workdir RUN mkdir -p ${DOCKER_WORKDIR} -## Additional Software -RUN apk --no-cache add git -## Copy package.json, yarn.lock, .env -COPY package.json yarn.lock ./ -COPY .env.template .env - -# Run command -CMD ["yarn", "run", "start"] +WORKDIR ${DOCKER_WORKDIR} ################################################################################## # DEVELOPMENT (Connected to the local environment, to reload on demand) ########## @@ -57,6 +53,12 @@ FROM base as development # Define Volume for workdir folder on development # VOLUME ${DOCKER_WORKDIR} +# Copy .env template +# COPY .env.template .env + +# Run command +CMD ["yarn", "run", "dev"] + ################################################################################## # BUILD (Does contain all files and is therefore bloated) ######################## ################################################################################## @@ -69,6 +71,9 @@ RUN yarn install --production=false --frozen-lockfile --non-interactive # yarn build RUN yarn run build +# Copy package.json, yarn.lock +# COPY package.json yarn.lock ./ + ################################################################################## # PRODUCTION (Does contain only "binary"- and static-files to reduce image size) # ################################################################################## @@ -81,4 +86,7 @@ COPY --from=build ${DOCKER_WORKDIR}/dist ./dist COPY ./public/img/ ./public/img/ COPY ./public/providers.json ./public/providers.json # yarn install -RUN yarn install --production=true --frozen-lockfile --non-interactive --no-cache \ No newline at end of file +RUN yarn install --production=true --frozen-lockfile --non-interactive --no-cache + +# Run command +CMD ["yarn", "run", "start"] \ No newline at end of file diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 03ef42ee1..3289be2e8 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -16,22 +16,15 @@ services: backend: image: ocelotsocialnetwork/develop-backend:development build: - context: ./backend target: development - command: yarn run dev environment: - - SMTP_HOST=mailserver - - SMTP_PORT=25 - - SMTP_IGNORE_TLS=true - - "DEBUG=${DEBUG}" - - PUBLIC_REGISTRATION=false + - NODE_ENV="development" + - DEBUG=true volumes: - ./backend:/app - - backend_node_modules:/app/node_modules - - uploads:/app/public/uploads - neo4j: - volumes: - - neo4j_data:/data + #neo4j: + # volumes: + # - neo4j_data:/data maintenance: image: ocelotsocialnetwork/develop-maintenance:latest build: diff --git a/docker-compose.production.yml b/docker-compose.production.yml index 285e9f110..0eec3126c 100644 --- a/docker-compose.production.yml +++ b/docker-compose.production.yml @@ -8,8 +8,9 @@ services: args: - "BUILD_COMMIT=${TRAVIS_COMMIT}" backend: + image: ocelotsocialnetwork/backend:latest build: - context: backend + context: ./backend target: production args: - "BUILD_COMMIT=${TRAVIS_COMMIT}" diff --git a/docker-compose.yml b/docker-compose.yml index f90dadb0e..3812fdf7d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,14 @@ +# This file defines the production settings. It is overwritten by docker-compose.override.yml, +# which defines the development settings. The override.yml is loaded by default. Therefore it +# is required to explicitly define if you want an production build: +# > docker-compose -f docker-compose.yml up + version: "3.4" services: + ######################################################## + # FRONTEND ############################################# + ######################################################## webapp: image: ocelotsocialnetwork/develop-webapp:latest build: @@ -22,13 +30,15 @@ services: - HOST=0.0.0.0 - GRAPHQL_URI=http://backend:4000 - MAPBOX_TOKEN="pk.eyJ1IjoiYnVzZmFrdG9yIiwiYSI6ImNraDNiM3JxcDBhaWQydG1uczhpZWtpOW4ifQ.7TNRTO-o9aK1Y6MyW_Nd4g" + + ######################################################## + # BACKEND ############################################## + ######################################################## backend: - image: ocelotsocialnetwork/develop-backend:latest + image: ocelotsocialnetwork/backend:latest build: - context: backend + context: ./backend target: production - args: - - "BUILD_COMMIT=${TRAVIS_COMMIT}" networks: - hc-network depends_on: @@ -36,24 +46,34 @@ services: ports: - 4000:4000 volumes: - - ./backend:/app + # This makes sure the docker container has its own node modules. + # Therefore it is possible to have a different node version on the host machine - backend_node_modules:/app/node_modules - uploads:/app/public/uploads environment: + # Envs used in Dockerfile + # - DOCKER_WORKDIR="/app" + - BUILD_DATE + - BUILD_VERSION + - BUILD_COMMIT + - NODE_ENV="development" + - PORT + + # Application only envs + - DEBUG=false - NEO4J_URI=bolt://neo4j:7687 - - GRAPHQL_URI=http://localhost:4000 - - CLIENT_URI=http://localhost:3000 - - JWT_SECRET=b/&&7b78BF&fv/Vd - - MAPBOX_TOKEN=pk.eyJ1IjoiYnVzZmFrdG9yIiwiYSI6ImNraDNiM3JxcDBhaWQydG1uczhpZWtpOW4ifQ.7TNRTO-o9aK1Y6MyW_Nd4g - - PRIVATE_KEY_PASSPHRASE=a7dsf78sadg87ad87sfagsadg78 - - "DEBUG=${DEBUG}" - - EMAIL_DEFAULT_SENDER=devops@ocelot.social + - GRAPHQL_URI=http://backend:4000 + - CLIENT_URI=http://webapp:3000 + env_file: + - ./backend/.env + + ######################################################## + # Neo4J ################################################ + ######################################################## neo4j: image: ocelotsocialnetwork/develop-neo4j:latest build: - context: neo4j - args: - - "BUILD_COMMIT=${TRAVIS_COMMIT}" + context: ./neo4j networks: - hc-network environment: From 2518e3858231241c704e046e7cce4726499dc105 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 19 Jan 2021 17:14:34 +0100 Subject: [PATCH 04/50] - webapp Dockerfile - cleanup backend Dockerfile - docker-compose cleanup - docker-compose networks - docker-compose for production, docker-compose.override for development - security - todos --- backend/Dockerfile | 16 ++----- docker-compose.override.yml | 40 +++++++++------- docker-compose.yml | 64 +++++++++++++------------ webapp/Dockerfile | 96 +++++++++++++++++++++++++++++-------- 4 files changed, 137 insertions(+), 79 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 7097b7486..ecd1ea2c4 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -36,9 +36,10 @@ LABEL maintainer="devops@ocelot.social" RUN apk --no-cache add git # Settings +## Expose Container Port EXPOSE ${PORT} -## Make Workdir +## Workdir RUN mkdir -p ${DOCKER_WORKDIR} WORKDIR ${DOCKER_WORKDIR} @@ -50,12 +51,6 @@ FROM base as development # We don't need to copy or build anything since we gonna bind to the # local filesystem which will need a rebuild anyway -# Define Volume for workdir folder on development -# VOLUME ${DOCKER_WORKDIR} - -# Copy .env template -# COPY .env.template .env - # Run command CMD ["yarn", "run", "dev"] @@ -71,9 +66,6 @@ RUN yarn install --production=false --frozen-lockfile --non-interactive # yarn build RUN yarn run build -# Copy package.json, yarn.lock -# COPY package.json yarn.lock ./ - ################################################################################## # PRODUCTION (Does contain only "binary"- and static-files to reduce image size) # ################################################################################## @@ -83,8 +75,8 @@ FROM base as production COPY --from=build ${DOCKER_WORKDIR}/dist ./dist # Copy static files # TODO - externalize the uploads so we can copy the whole folder -COPY ./public/img/ ./public/img/ -COPY ./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 # yarn install RUN yarn install --production=true --frozen-lockfile --non-interactive --no-cache diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 3289be2e8..53f601ccc 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -2,17 +2,20 @@ version: "3.4" services: webapp: - image: ocelotsocialnetwork/develop-webapp:build-and-test + image: ocelotsocialnetwork/webapp:development build: - context: webapp - target: build-and-test + target: development environment: - - NUXT_BUILD=/tmp/nuxt # avoid file permission issues when `rm -rf .nuxt/` - - PUBLIC_REGISTRATION=true + - NODE_ENV="development" + # - DEBUG=true + # - NUXT_BUILD=/tmp/nuxt # avoid file permission issues when `rm -rf .nuxt/` command: yarn run dev volumes: - - ./webapp:/develop-webapp - - webapp_node_modules:/develop-webapp/node_modules + # This makes sure the docker container has its own node modules. + # Therefore it is possible to have a different node version on the host machine + - webapp_node_modules:/app/node_modules + # bind the local folder to the docker to allow live reload + - ./webapp:/app backend: image: ocelotsocialnetwork/develop-backend:development build: @@ -21,17 +24,25 @@ services: - NODE_ENV="development" - DEBUG=true volumes: + # This makes sure the docker container has its own node modules. + # Therefore it is possible to have a different node version on the host machine + - backend_node_modules:/app/node_modules + # bind the local folder to the docker to allow live reload - ./backend:/app - #neo4j: - # volumes: - # - neo4j_data:/data + neo4j: + ports: + # Also expose the playground + - 7474:7474 + networks: + # So we can access the playground from our host machine + - external-net maintenance: image: ocelotsocialnetwork/develop-maintenance:latest build: context: webapp dockerfile: Dockerfile.maintenance networks: - - hc-network + - external-net ports: - 3503:80 mailserver: @@ -39,12 +50,7 @@ services: ports: - 1080:80 networks: - - hc-network - -networks: - hc-network: + - external-net volumes: webapp_node_modules: backend_node_modules: - neo4j_data: - uploads: diff --git a/docker-compose.yml b/docker-compose.yml index 3812fdf7d..5670d32f1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,29 +7,34 @@ version: "3.4" services: ######################################################## - # FRONTEND ############################################# + # WEBAPP ############################################### ######################################################## webapp: - image: ocelotsocialnetwork/develop-webapp:latest + image: ocelotsocialnetwork/webapp:latest build: - context: webapp + context: ./webapp target: production - args: - - "BUILD_COMMIT=${TRAVIS_COMMIT}" - ports: - - 3000:3000 - - 3002:3002 networks: - - hc-network + - external-net depends_on: - backend - volumes: - - ./webapp:/develop-webapp - - webapp_node_modules:/develop-webapp/node_modules + ports: + - 3000:3000 + # Storybook: Todo externalize, its not working anyways + # - 3002:3002 environment: - - HOST=0.0.0.0 + # Envs used in Dockerfile + # - DOCKER_WORKDIR="/app" + # - PORT="3000" + - BUILD_DATE + - BUILD_VERSION + - BUILD_COMMIT + - NODE_ENV="development" + # Application only envs + - HOST=0.0.0.0 # This is nuxt specific, alternative value is HOST=webapp - GRAPHQL_URI=http://backend:4000 - - MAPBOX_TOKEN="pk.eyJ1IjoiYnVzZmFrdG9yIiwiYSI6ImNraDNiM3JxcDBhaWQydG1uczhpZWtpOW4ifQ.7TNRTO-o9aK1Y6MyW_Nd4g" + env_file: + - ./webapp/.env ######################################################## # BACKEND ############################################## @@ -40,25 +45,22 @@ services: context: ./backend target: production networks: - - hc-network + - external-net + - internal-net depends_on: - neo4j ports: - 4000:4000 volumes: - # This makes sure the docker container has its own node modules. - # Therefore it is possible to have a different node version on the host machine - - backend_node_modules:/app/node_modules - - uploads:/app/public/uploads + - backend_uploads:/app/public/uploads environment: # Envs used in Dockerfile # - DOCKER_WORKDIR="/app" + # - PORT="4000" - BUILD_DATE - BUILD_VERSION - BUILD_COMMIT - NODE_ENV="development" - - PORT - # Application only envs - DEBUG=false - NEO4J_URI=bolt://neo4j:7687 @@ -71,25 +73,27 @@ services: # Neo4J ################################################ ######################################################## neo4j: - image: ocelotsocialnetwork/develop-neo4j:latest + image: ocelotsocialnetwork/neo4j:latest build: context: ./neo4j networks: - - hc-network + - internal-net environment: + # TODO: This sounds scary for a production environment - NEO4J_AUTH=none - NEO4J_dbms_security_procedures_unrestricted=algo.*,apoc.* - # decomment following line for Neo4j Enterprice version instead of Community version + # Uncomment following line for Neo4j Enterprise version instead of Community version + # 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 ports: - 7687:7687 - - 7474:7474 volumes: - neo4j_data:/data networks: - hc-network: + external-net: + internal-net: + internal: true volumes: - webapp_node_modules: - backend_node_modules: - neo4j_data: - uploads: \ No newline at end of file + backend_uploads: + neo4j_data: \ No newline at end of file diff --git a/webapp/Dockerfile b/webapp/Dockerfile index b752299e6..adc8aba47 100644 --- a/webapp/Dockerfile +++ b/webapp/Dockerfile @@ -1,32 +1,88 @@ +################################################################################## +# BASE ########################################################################### +################################################################################## FROM node:12.19.0-alpine3.10 as base -LABEL Description="Web Frontend of the Social Network ocelot.social" Vendor="ocelot.social Community" Version="0.0.1" Maintainer="ocelot.social Community (devops@ocelot.social)" -EXPOSE 3000 -CMD ["yarn", "run", "start"] +# ENVs (available in production aswell, can be overwritten by commandline or env file) +## DOCKER_WORKDIR would be a classical ARG, but that is not multi layer persistent - shame +ENV DOCKER_WORKDIR="/app" +## We Cannot do `$(date -u +'%Y-%m-%dT%H:%M:%SZ')` here so we use unix timestamp=0 +ENV BUILD_DATE="1970-01-01T00:00:00.00Z" +## We cannot do $(yarn run version) here so we default to 0.0.0 +## TODO: Missing Build number - do that once we have a CI which actually generates it +ENV BUILD_VERSION="0.0.0" +## We cannot do `$(git rev-parse --short HEAD)` here so we default to 0000000 +ENV BUILD_COMMIT="0000000" +## SET NODE_ENV +ENV NODE_ENV="production" +## App relevant Envs +ENV PORT="3000" -# Expose the app port -ARG BUILD_COMMIT -ENV BUILD_COMMIT=$BUILD_COMMIT -ARG WORKDIR=/develop-webapp -RUN mkdir -p $WORKDIR -WORKDIR $WORKDIR +# Labels +LABEL org.label-schema.build-date="${BUILD_DATE}" +LABEL org.label-schema.name="ocelot.social:backend" +LABEL org.label-schema.description="Web Frontend of the Social Network Software ocelot.social" +LABEL org.label-schema.usage="https://github.com/Ocelot-Social-Community/Ocelot-Social/blob/master/README.md" +LABEL org.label-schema.url="https://ocelot.social" +LABEL org.label-schema.vcs-url="https://github.com/Ocelot-Social-Community/Ocelot-Social/tree/master/backend" +LABEL org.label-schema.vcs-ref="${BUILD_COMMIT}" +LABEL org.label-schema.vendor="ocelot.social Community" +LABEL org.label-schema.version="${VERSION}" +LABEL org.label-schema.schema-version="1.0" +LABEL maintainer="devops@ocelot.social" -# See: https://github.com/nodejs/docker-node/pull/367#issuecomment-430807898 +# Install Additional Software +## install: git RUN apk --no-cache add git -COPY package.json yarn.lock ./ -COPY .env.template .env +# Settings +## Expose Container Port +EXPOSE ${PORT} +## Workdir +RUN mkdir -p ${DOCKER_WORKDIR} +WORKDIR ${DOCKER_WORKDIR} -FROM base as build-and-test -RUN yarn install --production=false --frozen-lockfile --non-interactive +################################################################################## +# DEVELOPMENT (Connected to the local environment, to reload on demand) ########## +################################################################################## +FROM base as development + +# We don't need to copy or build anything since we gonna bind to the +# local filesystem which will need a rebuild anyway + +# Run command +CMD ["yarn", "run", "dev"] + +################################################################################## +# BUILD (Does contain all files and is therefore bloated) ######################## +################################################################################## +FROM base as build + +# Copy everything COPY . . -RUN NODE_ENV=production yarn run build +# yarn install +RUN yarn install --production=false --frozen-lockfile --non-interactive +# yarn build +RUN yarn run build +################################################################################## +# PRODUCTION (Does contain only "binary"- and static-files to reduce image size) # +################################################################################## FROM base as production + +# Copy "binary"-files from build image +COPY --from=build ${DOCKER_WORKDIR}/.nuxt ./.nuxt +COPY --from=build ${DOCKER_WORKDIR}/nuxt.config.js ./ +# Copy static files +# TODO - this should be one Folder containign all stuff needed to be copied +COPY --from=build ${DOCKER_WORKDIR}/constants ./constants +COPY --from=build ${DOCKER_WORKDIR}/static ./static +COPY --from=build ${DOCKER_WORKDIR}/locales ./locales +# yarn install RUN yarn install --production=true --frozen-lockfile --non-interactive --no-cache -COPY --from=build-and-test ./develop-webapp/.nuxt ./.nuxt -COPY --from=build-and-test ./develop-webapp/constants ./constants -COPY --from=build-and-test ./develop-webapp/static ./static -COPY nuxt.config.js . -COPY locales locales + +# Run command +CMD ["yarn", "run", "start"] + + From 7cc003602f0f2f534f091c4eeeefc127a042d9b8 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 19 Jan 2021 17:16:11 +0100 Subject: [PATCH 05/50] - docker-compose definition order --- docker-compose.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 5670d32f1..153f2cd30 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -78,6 +78,10 @@ services: context: ./neo4j networks: - internal-net + ports: + - 7687:7687 + volumes: + - neo4j_data:/data environment: # TODO: This sounds scary for a production environment - NEO4J_AUTH=none @@ -86,10 +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 - ports: - - 7687:7687 - volumes: - - neo4j_data:/data networks: external-net: internal-net: From b25af045db1469644bff641d5e88c476ab174f68 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 19 Jan 2021 17:24:33 +0100 Subject: [PATCH 06/50] - include maintenance in production environment --- docker-compose.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 153f2cd30..5e3349df8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -90,10 +90,26 @@ 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 ########################################## + ######################################################## + maintenance: + image: ocelotsocialnetwork/maintenance:latest + build: + # TODO: Separate from webapp, this must be independent + context: ./webapp + dockerfile: Dockerfile.maintenance + networks: + - external-net + ports: + - 5000:80 + networks: external-net: internal-net: internal: true + volumes: backend_uploads: neo4j_data: \ No newline at end of file From a662fed9615fc506139d781d2288a2f6d88b2ccb Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 19 Jan 2021 17:25:45 +0100 Subject: [PATCH 07/50] - override all image names for development - structuring comment for service blocks --- docker-compose.override.yml | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 53f601ccc..7394e4e15 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -1,6 +1,9 @@ version: "3.4" services: + ######################################################## + # WEBAPP ############################################### + ######################################################## webapp: image: ocelotsocialnetwork/webapp:development build: @@ -16,8 +19,12 @@ services: - webapp_node_modules:/app/node_modules # bind the local folder to the docker to allow live reload - ./webapp:/app + + ######################################################## + # BACKEND ############################################## + ######################################################## backend: - image: ocelotsocialnetwork/develop-backend:development + image: ocelotsocialnetwork/backend:development build: target: development environment: @@ -29,22 +36,25 @@ services: - backend_node_modules:/app/node_modules # bind the local folder to the docker to allow live reload - ./backend:/app + + ######################################################## + # Neo4J ################################################ + ######################################################## neo4j: + image: ocelotsocialnetwork/neo4j:development ports: # Also expose the playground - 7474:7474 networks: # So we can access the playground from our host machine - external-net + + ######################################################## + # MAINTENANCE ########################################## + ######################################################## maintenance: - image: ocelotsocialnetwork/develop-maintenance:latest - build: - context: webapp - dockerfile: Dockerfile.maintenance - networks: - - external-net - ports: - - 3503:80 + image: ocelotsocialnetwork/maintenance:development + mailserver: image: djfarrelly/maildev ports: From c9a5df0cd60e25350f79355a91aae1eced5617ef Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 19 Jan 2021 17:38:05 +0100 Subject: [PATCH 08/50] - fixed build version in webapp and backend --- backend/Dockerfile | 2 +- webapp/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index ecd1ea2c4..9db05d1b3 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -27,7 +27,7 @@ LABEL org.label-schema.url="https://ocelot.social" LABEL org.label-schema.vcs-url="https://github.com/Ocelot-Social-Community/Ocelot-Social/tree/master/backend" LABEL org.label-schema.vcs-ref="${BUILD_COMMIT}" LABEL org.label-schema.vendor="ocelot.social Community" -LABEL org.label-schema.version="${VERSION}" +LABEL org.label-schema.version="${BUILD_VERSION}" LABEL org.label-schema.schema-version="1.0" LABEL maintainer="devops@ocelot.social" diff --git a/webapp/Dockerfile b/webapp/Dockerfile index adc8aba47..c03e49315 100644 --- a/webapp/Dockerfile +++ b/webapp/Dockerfile @@ -27,7 +27,7 @@ LABEL org.label-schema.url="https://ocelot.social" LABEL org.label-schema.vcs-url="https://github.com/Ocelot-Social-Community/Ocelot-Social/tree/master/backend" LABEL org.label-schema.vcs-ref="${BUILD_COMMIT}" LABEL org.label-schema.vendor="ocelot.social Community" -LABEL org.label-schema.version="${VERSION}" +LABEL org.label-schema.version="${BUILD_VERSION}" LABEL org.label-schema.schema-version="1.0" LABEL maintainer="devops@ocelot.social" From 0715310089097d60052a676afeabee64ebbde450 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 19 Jan 2021 17:38:41 +0100 Subject: [PATCH 09/50] - refactor neo4j dockerfile - support build stages community & enterprise --- neo4j/Dockerfile | 45 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/neo4j/Dockerfile b/neo4j/Dockerfile index e08e482a0..634674656 100644 --- a/neo4j/Dockerfile +++ b/neo4j/Dockerfile @@ -1,10 +1,43 @@ -FROM neo4j:3.5.14 -LABEL Description="Neo4J database of the Social Network ocelot.social with preinstalled database constraints and indices" Vendor="ocelot.social Community" Version="0.0.1" Maintainer="ocelot.social Community (devops@ocelot.social)" -# community edition 👆🏼, because we have no enterprise licence 👇🏼 at the moment -# FROM neo4j:3.5.14-enterprise +################################################################################## +# COMMUNITY ###################################################################### +################################################################################## +FROM neo4j:3.5.14 as community -ARG BUILD_COMMIT -ENV BUILD_COMMIT=$BUILD_COMMIT +# ENVs (available in production aswell, can be overwritten by commandline or env file) +## We Cannot do `$(date -u +'%Y-%m-%dT%H:%M:%SZ')` here so we use unix timestamp=0 +ENV BUILD_DATE="1970-01-01T00:00:00.00Z" +## We cannot do $(yarn run version) here so we default to 0.0.0 +## TODO: Missing Build number - do that once we have a CI which actually generates it +ENV BUILD_VERSION="0.0.0" +## We cannot do `$(git rev-parse --short HEAD)` here so we default to 0000000 +ENV BUILD_COMMIT="0000000" +# Labels +LABEL org.label-schema.build-date="${BUILD_DATE}" +LABEL org.label-schema.name="ocelot.social:backend" +LABEL org.label-schema.description="Neo4J database of the Social Network Software ocelot.social with preinstalled database constraints and indices" +LABEL org.label-schema.usage="https://github.com/Ocelot-Social-Community/Ocelot-Social/blob/master/README.md" +LABEL org.label-schema.url="https://ocelot.social" +LABEL org.label-schema.vcs-url="https://github.com/Ocelot-Social-Community/Ocelot-Social/tree/master/backend" +LABEL org.label-schema.vcs-ref="${BUILD_COMMIT}" +LABEL org.label-schema.vendor="ocelot.social Community" +LABEL org.label-schema.version="${BUILD_VERSION}" +LABEL org.label-schema.schema-version="1.0" +LABEL maintainer="devops@ocelot.social" + +# Install Additional Software +## install: wget, htop (TODO: why do we need htop?) RUN apt-get update && apt-get -y install wget htop +## install: apoc plugin for neo4j RUN wget https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/3.5.0.4/apoc-3.5.0.4-all.jar -P plugins/ + +################################################################################## +# ENTERPRISE ##################################################################### +################################################################################## +FROM neo4j:3.5.14-enterprise as enterprise + +# Install Additional Software +## install: wget, htop (TODO: why do we need htop?) +RUN apt-get update && apt-get -y install wget htop +## install: apoc plugin for neo4j +RUN wget https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/3.5.0.4/apoc-3.5.0.4-all.jar -P plugins/ \ No newline at end of file From cbf799d265ec5a9c59847c9a5c16b2ad56fbb449 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 19 Jan 2021 17:39:00 +0100 Subject: [PATCH 10/50] - build community edition of neo4j --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 5e3349df8..b1a86fd40 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -76,6 +76,8 @@ services: image: ocelotsocialnetwork/neo4j:latest build: context: ./neo4j + # community edition 👆🏼, because we have no enterprise licence 👇🏼 at the moment + target: community networks: - internal-net ports: From 33b8b001d7eb4e1285de7f12d6a4d6fe57212473 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 19 Jan 2021 17:49:37 +0100 Subject: [PATCH 11/50] - remove yarn run dev command since its part of the dockerfile for the production stage --- docker-compose.override.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 7394e4e15..510a7f182 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -12,7 +12,6 @@ services: - NODE_ENV="development" # - DEBUG=true # - NUXT_BUILD=/tmp/nuxt # avoid file permission issues when `rm -rf .nuxt/` - command: yarn run dev volumes: # This makes sure the docker container has its own node modules. # Therefore it is possible to have a different node version on the host machine From 3b3ff8ab0300d5de373d4bad72301c0c17d8e94a Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 19 Jan 2021 21:07:24 +0100 Subject: [PATCH 12/50] - removed unused docker-compose files --- docker-compose.build-and-test.yml | 17 ----------------- docker-compose.production.yml | 21 --------------------- 2 files changed, 38 deletions(-) delete mode 100644 docker-compose.build-and-test.yml delete mode 100644 docker-compose.production.yml diff --git a/docker-compose.build-and-test.yml b/docker-compose.build-and-test.yml deleted file mode 100644 index dbbb16d9b..000000000 --- a/docker-compose.build-and-test.yml +++ /dev/null @@ -1,17 +0,0 @@ -version: "3.4" - -services: - webapp: - environment: - - "CI=${CI}" - image: ocelotsocialnetwork/develop-webapp:build-and-test - build: - context: webapp - target: build-and-test - backend: - environment: - - "CI=${CI}" - image: ocelotsocialnetwork/develop-backend:build-and-test - build: - context: backend - target: build-and-test diff --git a/docker-compose.production.yml b/docker-compose.production.yml deleted file mode 100644 index 0eec3126c..000000000 --- a/docker-compose.production.yml +++ /dev/null @@ -1,21 +0,0 @@ -version: "3.4" - -services: - webapp: - build: - context: webapp - target: production - args: - - "BUILD_COMMIT=${TRAVIS_COMMIT}" - backend: - image: ocelotsocialnetwork/backend:latest - build: - context: ./backend - target: production - args: - - "BUILD_COMMIT=${TRAVIS_COMMIT}" - neo4j: - build: - context: neo4j - args: - - "BUILD_COMMIT=${TRAVIS_COMMIT}" From 36afad0a673aba62dea9d4baa40374e62b84a62a Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 19 Jan 2021 23:28:10 +0100 Subject: [PATCH 13/50] -fix CI --- .github/workflows/ci.yml | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18b01a1d9..a4334e29e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,25 +22,43 @@ jobs: tags: latest path: neo4j/ push: false - - name: Build backend base image + # TODO: We want to push this to dockerhub + #- name: Build backend production image + # uses: docker/build-push-action@v1.1.0 + # with: + # repository: ocelotsocialnetwork/backend + # tags: production + # target: production + # path: backend/ + # push: false + - name: Build backend development image uses: docker/build-push-action@v1.1.0 with: repository: ocelotsocialnetwork/backend - tags: build-and-test - target: build-and-test + tags: development + target: development path: backend/ push: false - - name: Build webapp base image + # TODO: We want to push this to dockerhub + #- name: Build webapp production image + # uses: docker/build-push-action@v1.1.0 + # with: + # repository: ocelotsocialnetwork/webapp + # tags: production + # target: production + # path: webapp/ + # push: false + - name: Build webapp development image uses: docker/build-push-action@v1.1.0 with: repository: ocelotsocialnetwork/webapp - tags: build-and-test - target: build-and-test + tags: development + target: development path: webapp/ push: false - name: Lint backend - run: docker run --rm ocelotsocialnetwork/backend:build-and-test yarn run lint + run: docker run --rm ocelotsocialnetwork/backend:development yarn run lint - name: Lint webapp - run: docker run --rm ocelotsocialnetwork/webapp:build-and-test yarn run lint + run: docker run --rm ocelotsocialnetwork/webapp:development yarn run lint From a2fb94a7ded4214eea9e60c5198e17a1417b64ca Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 19 Jan 2021 23:32:31 +0100 Subject: [PATCH 14/50] - CI: use build image instead of development, since development must be bound to a local volume with the source files --- .github/workflows/ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a4334e29e..51980b9bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,12 +31,12 @@ jobs: # target: production # path: backend/ # push: false - - name: Build backend development image + - name: Build backend build image uses: docker/build-push-action@v1.1.0 with: repository: ocelotsocialnetwork/backend - tags: development - target: development + tags: build + target: build path: backend/ push: false # TODO: We want to push this to dockerhub @@ -48,17 +48,17 @@ jobs: # target: production # path: webapp/ # push: false - - name: Build webapp development image + - name: Build webapp build image uses: docker/build-push-action@v1.1.0 with: repository: ocelotsocialnetwork/webapp - tags: development - target: development + tags: build + target: build path: webapp/ push: false - name: Lint backend - run: docker run --rm ocelotsocialnetwork/backend:development yarn run lint + run: docker run --rm ocelotsocialnetwork/backend:build yarn run lint - name: Lint webapp - run: docker run --rm ocelotsocialnetwork/webapp:development yarn run lint + run: docker run --rm ocelotsocialnetwork/webapp:build yarn run lint From c41d32d527c47ae9839019476a37d9e04bc5d226 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 20 Jan 2021 13:43:22 +0100 Subject: [PATCH 15/50] - fixed node_modules running out of sync since they are on a volume for development docker builds --- backend/Dockerfile | 6 ++++-- webapp/Dockerfile | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 9db05d1b3..fcb978810 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -52,7 +52,9 @@ FROM base as development # local filesystem which will need a rebuild anyway # Run command -CMD ["yarn", "run", "dev"] +# (for development we need to execute yarn install since the +# node_modules are on another volume and need updating) +CMD /bin/sh -c "yarn install && yarn run dev" ################################################################################## # BUILD (Does contain all files and is therefore bloated) ######################## @@ -81,4 +83,4 @@ COPY --from=build ${DOCKER_WORKDIR}/public/providers.json ./public/providers.jso RUN yarn install --production=true --frozen-lockfile --non-interactive --no-cache # Run command -CMD ["yarn", "run", "start"] \ No newline at end of file +CMD /bin/sh -c "yarn run start" \ No newline at end of file diff --git a/webapp/Dockerfile b/webapp/Dockerfile index c03e49315..84269c459 100644 --- a/webapp/Dockerfile +++ b/webapp/Dockerfile @@ -52,7 +52,9 @@ FROM base as development # local filesystem which will need a rebuild anyway # Run command -CMD ["yarn", "run", "dev"] +# (for development we need to execute yarn install since the +# node_modules are on another volume and need updating) +CMD /bin/sh -c "yarn install && yarn run dev" ################################################################################## # BUILD (Does contain all files and is therefore bloated) ######################## @@ -83,6 +85,6 @@ COPY --from=build ${DOCKER_WORKDIR}/locales ./locales RUN yarn install --production=true --frozen-lockfile --non-interactive --no-cache # Run command -CMD ["yarn", "run", "start"] +CMD /bin/sh -c "yarn run start" From ac3f330fd0bb934af365ee2d475acad31048644a Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 20 Jan 2021 14:04:25 +0100 Subject: [PATCH 16/50] refactor some documentations --- README.md | 118 +++++++++++++++++++++++++++++++++++++++--------- SUMMARY.md | 1 - installation.md | 82 --------------------------------- 3 files changed, 97 insertions(+), 104 deletions(-) delete mode 100644 installation.md diff --git a/README.md b/README.md index 998f722f0..4248ff57e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Human-Connection +# ocelot.social [![Build Status](https://travis-ci.com/Human-Connection/Human-Connection.svg?branch=master)](https://travis-ci.com/Human-Connection/Human-Connection) [![Codecov Coverage](https://img.shields.io/codecov/c/github/Human-Connection/Human-Connection/master.svg?style=flat-square)](https://codecov.io/gh/Human-Connection/Human-Connection/) @@ -6,22 +6,13 @@ [![Discord Channel](https://img.shields.io/discord/489522408076738561.svg)](https://discordapp.com/invite/DFSjPaX) [![Open Source Helpers](https://www.codetriage.com/human-connection/human-connection/badges/users.svg)](https://www.codetriage.com/human-connection/human-connection) -Human Connection is a nonprofit social, action and knowledge network that connects information to action and promotes positive local and global change in all areas of life. +ocelot.social is a nonprofit social, action and knowledge network that connects information to action and promotes positive local and global change in all areas of life. * **Social**: Interact with other people not just by commenting their posts, but by providing **Pro & Contra** arguments, give a **Versus** or ask them by integrated **Chat** or **Let's Talk** * **Knowledge**: Read articles about interesting topics and find related posts in the **More Info** tab or by **Filtering** based on **Categories** and **Tagging** or by using the **Fulltext Search**. * **Action**: Don't just read about how to make the world a better place, but come into **Action** by following provided suggestions on the **Action** tab provided by other people or **Organisations**. - [![Human-Connection](.gitbook/assets/lets_get_together.png)](https://human-connection.org) - -**Technology Stack** - -* [VueJS](https://vuejs.org/) -* [NuxtJS](https://nuxtjs.org/) -* [GraphQL](https://graphql.org/) -* [NodeJS](https://nodejs.org/en/) -* [Neo4J](https://neo4j.com/) - + [![Human-Connection](.gitbook/assets/lets_get_together.png)](https://ocelot.social) ## Live demo @@ -35,27 +26,112 @@ Logins: | `moderator@example.org` | 1234 | moderator | | `admin@example.org` | 1234 | admin | +## Directory Layout + +There are four important directories: +* [Backend](./backend) runs on the server and is a middleware between database and frontend +* [Frontend](./webapp) is a server-side-rendered and client-side-rendered web frontend +* [Deployment](./deployment) configuration for kubernetes +* [Cypress](./cypress) contains end-to-end tests and executable feature specifications + +In order to setup the application and start to develop features you have to +setup **frontend** and **backend**. + +There are two approaches: + +1. Local installation, which means you have to take care of dependencies yourself +2. **Or** Install everything through docker which takes care of dependencies for you + +## Installation + +### Clone the Repository +Clone the repository, this will create a new folder called `Ocelot-Social`: + +Using HTTPS: +```bash +$ git clone https://github.com/Ocelot-Social-Community/Ocelot-Social.git +``` + +Using SSH: +```bash +$ git clone git@github.com:Human-Connection/Human-Connection.git +``` + +Change into the new folder. + +```bash +$ cd Ocelot-Social +``` + +### Docker Installation + +Docker is a software development container tool that combines software and its dependencies into one standardized unit that contains everything needed to run it. This helps us to avoid problems with dependencies and makes installation easier. + +#### General Installation of Docker + +There are [sevaral ways to install Docker CE](https://docs.docker.com/install/) on your computer or server. + +{% tabs %} +{% tab title="Docker Desktop macOS" %} +Follow these instructions to [install Docker Desktop on macOS](https://docs.docker.com/docker-for-mac/install/). +{% endtab %} + +{% tab title="Docker Desktop Windows" %} +Follow these instructions to [install Docker Desktop on Windows](https://docs.docker.com/docker-for-windows/install/). +{% endtab %} + +{% tab title="Docker CE" %} +Follow these instructions to [install Docker CE](https://docs.docker.com/install/). + +This is a great option for Linux users. +{% endtab %} +{% endtabs %} + +Check the correct Docker installation by checking the version before proceeding. E.g. we have the following versions: + +```bash +$ docker --version +Docker version 18.09.2 +$ docker-compose --version +docker-compose version 1.23.2 +``` + +#### Start Ocelot-Social via Docker-Compose + +For Development: +```bash +docker-compose up +``` + +For Production +```bash +docker-compose -f docker-compose.yml up +``` + +This will start all required docker containers + ## Documentation Learn how to set up a local development environment in our [Docs](https://docs.human-connection.org/human-connection/) :mag_right: -## Translations - -You can help translating the interface by joining us on [lokalise.co](https://lokalise.co/public/556252725c18dd752dd546.13222042/). -Thank you lokalise for providing us with a premium account :raised_hands:. - ## Developer Chat Join our friendly open-source community on [Discord](https://discordapp.com/invite/DFSjPaX) :heart_eyes_cat: Just introduce yourself at `#introduce-yourself` and mention `@@Mentor` to get you onboard :neckbeard: Check out the [contribution guideline](./CONTRIBUTING.md), too! +We give write permissions to every developer who asks for it. Just text us on +[Discord](https://discord.gg/6ub73U3). + [![](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/images/0)](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/links/0)[![](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/images/1)](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/links/1)[![](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/images/2)](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/links/2)[![](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/images/3)](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/links/3)[![](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/images/4)](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/links/4)[![](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/images/5)](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/links/5)[![](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/images/6)](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/links/6)[![](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/images/7)](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/links/7) -## Open-Source Bounties +## Technology Stack -You can get a small financial compensation for your contribution :moneybag: See -details in our [Contribution Guidelines](./CONTRIBUTING.md#open-source-bounties). +* [VueJS](https://vuejs.org/) +* [NuxtJS](https://nuxtjs.org/) +* [GraphQL](https://graphql.org/) +* [NodeJS](https://nodejs.org/en/) +* [Neo4J](https://neo4j.com/) ## Attributions @@ -66,4 +142,4 @@ Browser compatibility testing with [BrowserStack](https://www.browserstack.com/) BrowserStack Logo ## License -See the [LICENSE](LICENSE.md) file for license rights and limitations (MIT). +See the [LICENSE](LICENSE.md) file for license rights and limitations (MIT). \ No newline at end of file diff --git a/SUMMARY.md b/SUMMARY.md index 8891579a3..a04c96d98 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -2,7 +2,6 @@ * [Introduction](README.md) * [Edit this Documentation](edit-this-documentation.md) -* [Installation](installation.md) * [Neo4J](neo4j/README.md) * [Backend](backend/README.md) * [GraphQL](backend/graphql.md) diff --git a/installation.md b/installation.md deleted file mode 100644 index 986166197..000000000 --- a/installation.md +++ /dev/null @@ -1,82 +0,0 @@ -# Installation - -The repository can be found on GitHub. [https://github.com/Ocelot-Social-Community/Ocelot-Social](https://github.com/Ocelot-Social-Community/Ocelot-Social) - -We give write permissions to every developer who asks for it. Just text us on -[Discord](https://discord.gg/6ub73U3). - -## Clone the Repository - - -Clone the repository, this will create a new folder called `Human-Connection`: - -{% tabs %} -{% tab title="HTTPS" %} -```bash -$ git clone https://github.com/Ocelot-Social-Community/Ocelot-Social.git -``` -{% endtab %} - -{% tab title="SSH" %} -```bash -$ git clone git@github.com:Human-Connection/Human-Connection.git -``` -{% endtab %} -{% endtabs %} - -Change into the new folder. - -```bash -$ cd Human-Connection -``` - -## Directory Layout - -There are four important directories: -* [Backend](./backend) runs on the server and is a middleware between database and frontend -* [Frontend](./webapp) is a server-side-rendered and client-side-rendered web frontend -* [Deployment](./deployment) configuration for kubernetes -* [Cypress](./cypress) contains end-to-end tests and executable feature specifications - -In order to setup the application and start to develop features you have to -setup **frontend** and **backend**. - -There are two approaches: - -1. Local installation, which means you have to take care of dependencies yourself -2. **Or** Install everything through docker which takes care of dependencies for you - -## Docker Installation - -Docker is a software development container tool that combines software and its dependencies into one standardized unit that contains everything needed to run it. This helps us to avoid problems with dependencies and makes installation easier. - -### General Installation of Docker - -There are [sevaral ways to install Docker CE](https://docs.docker.com/install/) on your computer or server. - -{% tabs %} -{% tab title="Docker Desktop macOS" %} -Follow these instructions to [install Docker Desktop on macOS](https://docs.docker.com/docker-for-mac/install/). -{% endtab %} - -{% tab title="Docker Desktop Windows" %} -Follow these instructions to [install Docker Desktop on Windows](https://docs.docker.com/docker-for-windows/install/). -{% endtab %} - -{% tab title="Docker CE" %} -Follow these instructions to [install Docker CE](https://docs.docker.com/install/). - -This is a great option for Linux users. -{% endtab %} -{% endtabs %} - -Check the correct Docker installation by checking the version before proceeding. E.g. we have the following versions: - -```bash -$ docker --version -Docker version 18.09.2 -$ docker-compose --version -docker-compose version 1.23.2 -``` - - From f7cb81f52a3a0c3669d5fc55c22985b3011b9940 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 20 Jan 2021 14:14:17 +0100 Subject: [PATCH 17/50] include unit tests in github ci --- .github/workflows/ci.yml | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 51980b9bd..32962b44b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,13 +15,20 @@ jobs: scripts/translations/sort.sh scripts/translations/missing-keys.sh - - name: Build neo4j image + ########################################################################## + # NEO4J ################################################################## + ########################################################################## + - name: [Neo4J] Build `community` image uses: docker/build-push-action@v1.1.0 with: repository: ocelotsocialnetwork/neo4j tags: latest path: neo4j/ push: false + + ########################################################################## + # BACKEND ################################################################ + ########################################################################## # TODO: We want to push this to dockerhub #- name: Build backend production image # uses: docker/build-push-action@v1.1.0 @@ -31,7 +38,9 @@ jobs: # target: production # path: backend/ # push: false - - name: Build backend build image + + # Build Docker Image (build) + - name: [backend] Build `build` image uses: docker/build-push-action@v1.1.0 with: repository: ocelotsocialnetwork/backend @@ -39,6 +48,18 @@ jobs: target: build path: backend/ push: false + + # Lint + - name: [backend] Lint + run: docker run --rm ocelotsocialnetwork/backend:build yarn run lint + + # Unit Tests + - name: [backend] unit tests + run: docker run --rm ocelotsocialnetwork/backend:build yarn run test:jest + + ########################################################################## + # WEBAPP ################################################################# + ########################################################################## # TODO: We want to push this to dockerhub #- name: Build webapp production image # uses: docker/build-push-action@v1.1.0 @@ -48,7 +69,9 @@ jobs: # target: production # path: webapp/ # push: false - - name: Build webapp build image + + # Build Docker Image (build) + - name: [webapp] Build `build` image uses: docker/build-push-action@v1.1.0 with: repository: ocelotsocialnetwork/webapp @@ -57,8 +80,11 @@ jobs: path: webapp/ push: false - - name: Lint backend - run: docker run --rm ocelotsocialnetwork/backend:build yarn run lint - - name: Lint webapp + # Lint + - name: [webapp] Lint run: docker run --rm ocelotsocialnetwork/webapp:build yarn run lint + # Unit Tests + - name: [webapp] unit tests + run: docker run --rm ocelotsocialnetwork/webapp:build yarn run test + From d53ec6e05db28978128658fa91f3dafad9270760 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 20 Jan 2021 14:17:41 +0100 Subject: [PATCH 18/50] corrected yml syntax error --- .github/workflows/ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 32962b44b..fb3857ddf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: ########################################################################## # NEO4J ################################################################## ########################################################################## - - name: [Neo4J] Build `community` image + - name: Neo4J | Build `community` image uses: docker/build-push-action@v1.1.0 with: repository: ocelotsocialnetwork/neo4j @@ -40,7 +40,7 @@ jobs: # push: false # Build Docker Image (build) - - name: [backend] Build `build` image + - name: backend | Build `build` image uses: docker/build-push-action@v1.1.0 with: repository: ocelotsocialnetwork/backend @@ -50,11 +50,11 @@ jobs: push: false # Lint - - name: [backend] Lint + - name: backend | Lint run: docker run --rm ocelotsocialnetwork/backend:build yarn run lint # Unit Tests - - name: [backend] unit tests + - name: backend | unit tests run: docker run --rm ocelotsocialnetwork/backend:build yarn run test:jest ########################################################################## @@ -71,7 +71,7 @@ jobs: # push: false # Build Docker Image (build) - - name: [webapp] Build `build` image + - name: webapp | Build `build` image uses: docker/build-push-action@v1.1.0 with: repository: ocelotsocialnetwork/webapp @@ -81,10 +81,10 @@ jobs: push: false # Lint - - name: [webapp] Lint + - name: webapp | Lint run: docker run --rm ocelotsocialnetwork/webapp:build yarn run lint # Unit Tests - - name: [webapp] unit tests + - name: webapp | unit tests run: docker run --rm ocelotsocialnetwork/webapp:build yarn run test From 87db5ae31e4a2277cb92269c43efe890cfcad73e Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 20 Jan 2021 14:24:15 +0100 Subject: [PATCH 19/50] - corrected docu - run unit test correctly for backend --- .github/workflows/ci.yml | 2 +- backend/README.md | 20 ++++---------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb3857ddf..18eb19387 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,7 +55,7 @@ jobs: # Unit Tests - name: backend | unit tests - run: docker run --rm ocelotsocialnetwork/backend:build yarn run test:jest + run: docker run --rm ocelotsocialnetwork/backend:build yarn run test ########################################################################## # WEBAPP ################################################################# diff --git a/backend/README.md b/backend/README.md index b472ef530..d7031106e 100644 --- a/backend/README.md +++ b/backend/README.md @@ -178,32 +178,20 @@ database after each test, running the tests will wipe out all your data! {% tabs %} {% tab title="Docker" %} -Run the _**jest**_ tests: +Run the unit tests: ```bash -$ docker-compose exec backend yarn run test:jest -``` - -Run the _**cucumber**_ features: - -```bash -$ docker-compose exec backend yarn run test:cucumber +$ docker-compose exec backend yarn run test ``` {% endtab %} {% tab title="Without Docker" %} -Run the _**jest**_ tests: +Run the unit tests: ```bash -$ yarn run test:jest -``` - -Run the _**cucumber**_ features: - -```bash -$ yarn run test:cucumber +$ yarn run test ``` {% endtab %} From 022f87e0c20630d6e979bf0922dd37bc11685219 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 20 Jan 2021 14:36:52 +0100 Subject: [PATCH 20/50] try to copy .env template --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18eb19387..c729c2a9c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,7 +55,7 @@ jobs: # Unit Tests - name: backend | unit tests - run: docker run --rm ocelotsocialnetwork/backend:build yarn run test + run: docker run --rm ocelotsocialnetwork/backend:build mv /app/.env.template /app/.env && yarn run test ########################################################################## # WEBAPP ################################################################# From b9aa51edf3320165fba7478e13be1b2483317168 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 20 Jan 2021 14:44:40 +0100 Subject: [PATCH 21/50] try using sepperat commands --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c729c2a9c..5eeed2ae1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,7 +55,9 @@ jobs: # Unit Tests - name: backend | unit tests - run: docker run --rm ocelotsocialnetwork/backend:build mv /app/.env.template /app/.env && yarn run test + run: | + docker run --rm ocelotsocialnetwork/backend:build mv /app/.env.template /app/.env + docker run --rm ocelotsocialnetwork/backend:build yarn run test ########################################################################## # WEBAPP ################################################################# From 42b9446d0aa0f3cca718c4e17c42a3a7cd61677e Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 20 Jan 2021 14:53:48 +0100 Subject: [PATCH 22/50] define env variable in ci.yml --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5eeed2ae1..9687315d3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,9 +55,9 @@ jobs: # Unit Tests - name: backend | unit tests - run: | - docker run --rm ocelotsocialnetwork/backend:build mv /app/.env.template /app/.env - docker run --rm ocelotsocialnetwork/backend:build yarn run test + run: docker run --rm ocelotsocialnetwork/backend:build yarn run test + env: + MAPBOX_TOKEN: "123ABC" ########################################################################## # WEBAPP ################################################################# From cb27c737ee41913c7173521caaba8fb5f442e6dc Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 20 Jan 2021 15:02:07 +0100 Subject: [PATCH 23/50] env in docker run command --- .github/workflows/ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9687315d3..b158fb7bc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,9 +55,7 @@ jobs: # Unit Tests - name: backend | unit tests - run: docker run --rm ocelotsocialnetwork/backend:build yarn run test - env: - MAPBOX_TOKEN: "123ABC" + run: docker run --env MAPBOX_TOKEN=123ABC --rm ocelotsocialnetwork/backend:build yarn run test ########################################################################## # WEBAPP ################################################################# From 9f09c9f2fb2d59ae57576351b4f1cb874613f6e6 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 20 Jan 2021 15:07:55 +0100 Subject: [PATCH 24/50] define remaining envs required --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b158fb7bc..a2635738f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,7 +55,7 @@ jobs: # Unit Tests - name: backend | unit tests - run: docker run --env MAPBOX_TOKEN=123ABC --rm ocelotsocialnetwork/backend:build yarn run test + run: docker run --env MAPBOX_TOKEN=123ABC --env JWT_SECRET=123ABC --env PRIVATE_KEY_PASSPHRASE=123ABC --rm ocelotsocialnetwork/backend:build yarn run test ########################################################################## # WEBAPP ################################################################# From 0081219926ca38fa6d12137ee530dfd14ccd516b Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 20 Jan 2021 15:15:26 +0100 Subject: [PATCH 25/50] remove unit tests - its too complicated for this PR --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a2635738f..9152bccf4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,8 +54,8 @@ jobs: run: docker run --rm ocelotsocialnetwork/backend:build yarn run lint # Unit Tests - - name: backend | unit tests - run: docker run --env MAPBOX_TOKEN=123ABC --env JWT_SECRET=123ABC --env PRIVATE_KEY_PASSPHRASE=123ABC --rm ocelotsocialnetwork/backend:build yarn run test + #- name: backend | unit tests + # run: docker run --env MAPBOX_TOKEN=123ABC --env JWT_SECRET=123ABC --env PRIVATE_KEY_PASSPHRASE=123ABC --rm ocelotsocialnetwork/backend:build yarn run test ########################################################################## # WEBAPP ################################################################# @@ -85,6 +85,6 @@ jobs: run: docker run --rm ocelotsocialnetwork/webapp:build yarn run lint # Unit Tests - - name: webapp | unit tests - run: docker run --rm ocelotsocialnetwork/webapp:build yarn run test + #- name: webapp | unit tests + # run: docker run --rm ocelotsocialnetwork/webapp:build yarn run test From 930cce6b515a3d5a2b80e75bc9113027b70d1543 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 22 Jan 2021 11:31:31 +0100 Subject: [PATCH 26/50] fixed neo4j query browser name - its not called playground --- docker-compose.override.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 510a7f182..0f454a396 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -42,7 +42,7 @@ services: neo4j: image: ocelotsocialnetwork/neo4j:development ports: - # Also expose the playground + # Also expose the neo4j query browser - 7474:7474 networks: # So we can access the playground from our host machine From 36a5aaff36721212ab2a104c38b6830ad1df2a91 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 22 Jan 2021 13:52:31 +0100 Subject: [PATCH 27/50] Replaced HC Image with Ocelot Image --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4248ff57e..a254b3412 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ ocelot.social is a nonprofit social, action and knowledge network that connects * **Knowledge**: Read articles about interesting topics and find related posts in the **More Info** tab or by **Filtering** based on **Categories** and **Tagging** or by using the **Fulltext Search**. * **Action**: Don't just read about how to make the world a better place, but come into **Action** by following provided suggestions on the **Action** tab provided by other people or **Organisations**. - [![Human-Connection](.gitbook/assets/lets_get_together.png)](https://ocelot.social) + [![Ocelot-Social](webapp/static/img/custom/welcome.svg)](https://ocelot.social) ## Live demo From 5a6ad276b4f2d0a9b8083d89790f49c0f2869038 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 22 Jan 2021 13:56:54 +0100 Subject: [PATCH 28/50] removed link to gitbook --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index a254b3412..e0f63313f 100644 --- a/README.md +++ b/README.md @@ -110,10 +110,6 @@ docker-compose -f docker-compose.yml up This will start all required docker containers -## Documentation - -Learn how to set up a local development environment in our [Docs](https://docs.human-connection.org/human-connection/) :mag_right: - ## Developer Chat Join our friendly open-source community on [Discord](https://discordapp.com/invite/DFSjPaX) :heart_eyes_cat: From 6463705d03dcaadfe3224b6c38ee502f00d8e535 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 22 Jan 2021 13:58:26 +0100 Subject: [PATCH 29/50] simplified docker installation instructions, remove tabs --- README.md | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index e0f63313f..14c17a666 100644 --- a/README.md +++ b/README.md @@ -71,21 +71,9 @@ Docker is a software development container tool that combines software and its d There are [sevaral ways to install Docker CE](https://docs.docker.com/install/) on your computer or server. -{% tabs %} -{% tab title="Docker Desktop macOS" %} -Follow these instructions to [install Docker Desktop on macOS](https://docs.docker.com/docker-for-mac/install/). -{% endtab %} - -{% tab title="Docker Desktop Windows" %} -Follow these instructions to [install Docker Desktop on Windows](https://docs.docker.com/docker-for-windows/install/). -{% endtab %} - -{% tab title="Docker CE" %} -Follow these instructions to [install Docker CE](https://docs.docker.com/install/). - -This is a great option for Linux users. -{% endtab %} -{% endtabs %} + * [install Docker Desktop on macOS](https://docs.docker.com/docker-for-mac/install/) + * [install Docker Desktop on Windows](https://docs.docker.com/docker-for-windows/install/) + * [install Docker CE on Linux](https://docs.docker.com/install/) Check the correct Docker installation by checking the version before proceeding. E.g. we have the following versions: From 48d37156289263b7d7276c66d3ef86e0d483b862 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 22 Jan 2021 13:59:59 +0100 Subject: [PATCH 30/50] removed unfunctional maintainer list --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 14c17a666..d3561dbe1 100644 --- a/README.md +++ b/README.md @@ -107,8 +107,6 @@ Check out the [contribution guideline](./CONTRIBUTING.md), too! We give write permissions to every developer who asks for it. Just text us on [Discord](https://discord.gg/6ub73U3). -[![](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/images/0)](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/links/0)[![](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/images/1)](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/links/1)[![](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/images/2)](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/links/2)[![](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/images/3)](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/links/3)[![](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/images/4)](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/links/4)[![](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/images/5)](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/links/5)[![](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/images/6)](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/links/6)[![](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/images/7)](https://sourcerer.io/fame/roschaefer/Human-Connection/Human-Connection/links/7) - ## Technology Stack * [VueJS](https://vuejs.org/) From 9c7761eb1e861aac325addb7187c28e1b6ca92fe Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 22 Jan 2021 14:03:46 +0100 Subject: [PATCH 31/50] maintenance docu port corrected --- webapp/maintenance/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/maintenance/README.md b/webapp/maintenance/README.md index bef8b3fd6..ee00633ef 100644 --- a/webapp/maintenance/README.md +++ b/webapp/maintenance/README.md @@ -36,7 +36,7 @@ $ docker-compose up ```` And the maintenance mode page or service will be started as well in an own container. -In the browser you can reach it under `http://localhost:3503/`. +In the browser you can reach it under `http://localhost:5000/`. {% endtab %} {% tab title="On The Server" %} From 1c188250df2f6596eefbcdeeb8dfaee08cca95eb Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 22 Jan 2021 14:07:31 +0100 Subject: [PATCH 32/50] Update README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Wolfgang Huß --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d3561dbe1..985cd928e 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,7 @@ For Production docker-compose -f docker-compose.yml up ``` -This will start all required docker containers +This will start all required Docker containers ## Developer Chat @@ -124,4 +124,4 @@ Browser compatibility testing with [BrowserStack](https://www.browserstack.com/) BrowserStack Logo ## License -See the [LICENSE](LICENSE.md) file for license rights and limitations (MIT). \ No newline at end of file +See the [LICENSE](LICENSE.md) file for license rights and limitations (MIT). From 289e62ddb49170a2a810927fbc5dc002abe3e6e1 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 22 Jan 2021 14:14:34 +0100 Subject: [PATCH 33/50] corrected image & service names --- deployment/helm/ocelot.social/values.yaml | 8 ++++---- deployment/legacy-migration/README.md | 14 +++++++------- deployment/minikube/README.md | 4 ++-- scripts/deploy.sh | 4 ++-- scripts/docker_push.sh | 10 +++++----- webapp/Dockerfile | 4 +--- 6 files changed, 21 insertions(+), 23 deletions(-) diff --git a/deployment/helm/ocelot.social/values.yaml b/deployment/helm/ocelot.social/values.yaml index 42eed0c7b..4c15c99a7 100644 --- a/deployment/helm/ocelot.social/values.yaml +++ b/deployment/helm/ocelot.social/values.yaml @@ -7,13 +7,13 @@ dbInitializion: "yarn prod:migrate init" # dbMigrations runs the database migrations in a post-upgrade hook. dbMigrations: "yarn prod:migrate up" # bakendImage is the docker image for the backend deployment -backendImage: ocelotsocialnetwork/develop-backend +backendImage: ocelotsocialnetwork/backend # maintenanceImage is the docker image for the maintenance deployment -maintenanceImage: ocelotsocialnetwork/develop-maintenance +maintenanceImage: ocelotsocialnetwork/maintenance # neo4jImage is the docker image for the neo4j deployment -neo4jImage: ocelotsocialnetwork/develop-neo4j +neo4jImage: ocelotsocialnetwork/neo4j # webappImage is the docker image for the webapp deployment -webappImage: ocelotsocialnetwork/develop-webapp +webappImage: ocelotsocialnetwork/webapp # image configures pullPolicy related to the docker images image: # pullPolicy indicates when, if ever, pods pull a new image from docker hub. diff --git a/deployment/legacy-migration/README.md b/deployment/legacy-migration/README.md index b692305db..66100a3c8 100644 --- a/deployment/legacy-migration/README.md +++ b/deployment/legacy-migration/README.md @@ -43,13 +43,13 @@ Then temporarily delete backend and database deployments ```bash $ kubectl -n ocelot-social get deployments NAME READY UP-TO-DATE AVAILABLE AGE -develop-backend 1/1 1 1 3d11h -develop-neo4j 1/1 1 1 3d11h -develop-webapp 2/2 2 2 73d -$ kubectl -n ocelot-social delete deployment develop-neo4j -deployment.extensions "develop-neo4j" deleted -$ kubectl -n ocelot-social delete deployment develop-backend -deployment.extensions "develop-backend" deleted +backend 1/1 1 1 3d11h +neo4j 1/1 1 1 3d11h +webapp 2/2 2 2 73d +$ kubectl -n ocelot-social delete deployment neo4j +deployment.extensions "neo4j" deleted +$ kubectl -n ocelot-social delete deployment backend +deployment.extensions "backend" deleted ``` Deploy one-time develop-maintenance-worker pod: diff --git a/deployment/minikube/README.md b/deployment/minikube/README.md index cfa2c4a5c..014f9510c 100644 --- a/deployment/minikube/README.md +++ b/deployment/minikube/README.md @@ -18,8 +18,8 @@ minikube dashboard, expose the services you want on your host system. For example: ```text -$ minikube service develop-webapp --namespace=ocelotsocialnetwork +$ minikube service webapp --namespace=ocelotsocialnetwork # optionally -$ minikube service develop-backend --namespace=ocelotsocialnetwork +$ minikube service backend --namespace=ocelotsocialnetwork ``` diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 77b5501ca..c79223c69 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -2,5 +2,5 @@ sed -i "s//${TRAVIS_COMMIT}/g" $TRAVIS_BUILD_DIR/scripts/patches/patch-deployment.yaml sed -i "s//${TRAVIS_COMMIT}/g" $TRAVIS_BUILD_DIR/scripts/patches/patch-configmap.yaml kubectl -n ocelot-social patch configmap develop-configmap -p "$(cat $TRAVIS_BUILD_DIR/scripts/patches/patch-configmap.yaml)" -kubectl -n ocelot-social patch deployment develop-backend -p "$(cat $TRAVIS_BUILD_DIR/scripts/patches/patch-deployment.yaml)" -kubectl -n ocelot-social patch deployment develop-webapp -p "$(cat $TRAVIS_BUILD_DIR/scripts/patches/patch-deployment.yaml)" +kubectl -n ocelot-social patch deployment backend -p "$(cat $TRAVIS_BUILD_DIR/scripts/patches/patch-deployment.yaml)" +kubectl -n ocelot-social patch deployment webapp -p "$(cat $TRAVIS_BUILD_DIR/scripts/patches/patch-deployment.yaml)" diff --git a/scripts/docker_push.sh b/scripts/docker_push.sh index b1ae8fbc0..90e0fb8c1 100755 --- a/scripts/docker_push.sh +++ b/scripts/docker_push.sh @@ -4,14 +4,14 @@ ROOT_DIR=$(dirname "$0")/.. VERSION=$(jq -r '.version' $ROOT_DIR/package.json) IFS='.' read -r major minor patch <<< $VERSION -apps=(develop-webapp develop-backend develop-neo4j develop-maintenance) +apps=(webapp backend neo4j maintenance) tags=($major $major.$minor $major.$minor.$patch) # These three docker images have already been built by now: -# docker build --build-arg BUILD_COMMIT=$BUILD_COMMIT --target production -t ocelotsocialnetwork/develop-backend:latest $ROOT_DIR/backend -# docker build --build-arg BUILD_COMMIT=$BUILD_COMMIT --target production -t ocelotsocialnetwork/develop-webapp:latest $ROOT_DIR/webapp -# docker build --build-arg BUILD_COMMIT=$BUILD_COMMIT -t ocelotsocialnetwork/develop-neo4j:latest $ROOT_DIR/neo4j -docker build -t ocelotsocialnetwork/develop-maintenance:latest $ROOT_DIR/webapp/ -f $ROOT_DIR/webapp/Dockerfile.maintenance +# docker build --build-arg BUILD_COMMIT=$BUILD_COMMIT --target production -t ocelotsocialnetwork/backend:latest $ROOT_DIR/backend +# docker build --build-arg BUILD_COMMIT=$BUILD_COMMIT --target production -t ocelotsocialnetwork/webapp:latest $ROOT_DIR/webapp +# docker build --build-arg BUILD_COMMIT=$BUILD_COMMIT -t ocelotsocialnetwork/neo4j:latest $ROOT_DIR/neo4j +docker build -t ocelotsocialnetwork/maintenance:latest $ROOT_DIR/webapp/ -f $ROOT_DIR/webapp/Dockerfile.maintenance echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin diff --git a/webapp/Dockerfile b/webapp/Dockerfile index 84269c459..d6b186e1e 100644 --- a/webapp/Dockerfile +++ b/webapp/Dockerfile @@ -85,6 +85,4 @@ COPY --from=build ${DOCKER_WORKDIR}/locales ./locales RUN yarn install --production=true --frozen-lockfile --non-interactive --no-cache # Run command -CMD /bin/sh -c "yarn run start" - - +CMD /bin/sh -c "yarn run start" \ No newline at end of file From 29f8f005870a9740f9dd99d8474363850ade56ed Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 22 Jan 2021 14:17:39 +0100 Subject: [PATCH 34/50] Update README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Wolfgang Huß --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 985cd928e..8f1abf6ea 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ setup **frontend** and **backend**. There are two approaches: 1. Local installation, which means you have to take care of dependencies yourself -2. **Or** Install everything through docker which takes care of dependencies for you +2. **Or** Install everything through Docker which takes care of dependencies for you ## Installation From 169b0b452046c4c4544e4ea44575db580c5064ce Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 22 Jan 2021 14:17:53 +0100 Subject: [PATCH 35/50] Update docker-compose.override.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Wolfgang Huß --- docker-compose.override.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 0f454a396..4b696687c 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -54,6 +54,9 @@ services: maintenance: image: ocelotsocialnetwork/maintenance:development + ######################################################## + # MAILSERVER TO FAKE SMTP ########################################## + ######################################################## mailserver: image: djfarrelly/maildev ports: From c3147bbd4a46b411659e4c2e94ed121e7d8a2c3b Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 22 Jan 2021 14:19:23 +0100 Subject: [PATCH 36/50] Update docker-compose.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Wolfgang Huß --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index b1a86fd40..b3d034621 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -70,7 +70,7 @@ services: - ./backend/.env ######################################################## - # Neo4J ################################################ + # NEO4J ################################################ ######################################################## neo4j: image: ocelotsocialnetwork/neo4j:latest @@ -114,4 +114,4 @@ networks: volumes: backend_uploads: - neo4j_data: \ No newline at end of file + neo4j_data: From 47f58a3c5eec04a1170244729b2c236b69401f3d Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 22 Jan 2021 14:25:05 +0100 Subject: [PATCH 37/50] some comment-styling issues --- docker-compose.override.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 4b696687c..9f94372fd 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -37,7 +37,7 @@ services: - ./backend:/app ######################################################## - # Neo4J ################################################ + # NEO4J ################################################ ######################################################## neo4j: image: ocelotsocialnetwork/neo4j:development @@ -55,7 +55,7 @@ services: image: ocelotsocialnetwork/maintenance:development ######################################################## - # MAILSERVER TO FAKE SMTP ########################################## + # MAILSERVER TO FAKE SMTP ############################## ######################################################## mailserver: image: djfarrelly/maildev From 9ecdfdab448c2ac20b9ba1b7822a03c30149eabf Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 22 Jan 2021 14:45:09 +0100 Subject: [PATCH 38/50] frontend tests for ci (test) --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9152bccf4..9c69520ae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,6 +85,6 @@ jobs: run: docker run --rm ocelotsocialnetwork/webapp:build yarn run lint # Unit Tests - #- name: webapp | unit tests - # run: docker run --rm ocelotsocialnetwork/webapp:build yarn run test + - name: webapp | unit tests + run: docker run --rm ocelotsocialnetwork/webapp:build yarn run test From 4b04a6bb5ceeb2d01c9093eefa6a38b4630df102 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 22 Jan 2021 16:53:13 +0100 Subject: [PATCH 39/50] - fixed webfinger test to work with docker(hackfix) - fixed permissions middleware to properly authenticate users --- backend/src/activitypub/routes/webfinger.spec.js | 4 ++-- backend/src/middleware/permissionsMiddleware.js | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/backend/src/activitypub/routes/webfinger.spec.js b/backend/src/activitypub/routes/webfinger.spec.js index 213c1ab33..9dc9b9324 100644 --- a/backend/src/activitypub/routes/webfinger.spec.js +++ b/backend/src/activitypub/routes/webfinger.spec.js @@ -98,12 +98,12 @@ describe('webfinger', () => { expect(json).toHaveBeenCalledWith({ links: [ { - href: 'http://localhost:3000/activitypub/users/some-user', + href: 'http://webapp:3000/activitypub/users/some-user', rel: 'self', type: 'application/activity+json', }, ], - subject: 'acct:some-user@localhost:3000', + subject: 'acct:some-user@webapp:3000', }) }) }) diff --git a/backend/src/middleware/permissionsMiddleware.js b/backend/src/middleware/permissionsMiddleware.js index ddf12598b..b49b4bb0c 100644 --- a/backend/src/middleware/permissionsMiddleware.js +++ b/backend/src/middleware/permissionsMiddleware.js @@ -29,15 +29,25 @@ const onlyYourself = rule({ const isMyOwn = rule({ cache: 'no_cache', -})(async (parent, args, context, info) => { - return context.user.id === parent.id +})(async (parent, args, { user }, info) => { + return user && user.id === parent.id }) const isMySocialMedia = rule({ cache: 'no_cache', })(async (_, args, { user }) => { + // We need a User + if (!user){ + return false + } let socialMedia = await neode.find('SocialMedia', args.id) - socialMedia = await socialMedia.toJson() + // Did we find a social media node? + if(!socialMedia){ + return false + } + socialMedia = await socialMedia.toJson() // whats this for? + + //Is it my social media entry? return socialMedia.ownedBy.node.id === user.id }) From d8d22015d05614fbe87d35158314dd7e17708892 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 22 Jan 2021 17:29:58 +0100 Subject: [PATCH 40/50] - fixed webapp tests - corrected docker image name --- deployment/ocelot-social/deployment-webapp.yaml | 2 +- webapp/package.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/deployment/ocelot-social/deployment-webapp.yaml b/deployment/ocelot-social/deployment-webapp.yaml index 4b0fec2a1..2cc742deb 100644 --- a/deployment/ocelot-social/deployment-webapp.yaml +++ b/deployment/ocelot-social/deployment-webapp.yaml @@ -37,7 +37,7 @@ spec: name: configmap - secretRef: name: ocelot-social - image: ocelotsocialnetwork/develop-webapp:latest + image: ocelotsocialnetwork/webapp:latest imagePullPolicy: Always name: web ports: diff --git a/webapp/package.json b/webapp/package.json index 58d855809..a972cc1db 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -17,7 +17,7 @@ "lint": "eslint --ext .js,.vue .", "locales": "../scripts/translations/missing-keys.sh && ../scripts/translations/sort.sh", "precommit": "yarn lint", - "test": "jest", + "test": "cross-env NODE_ENV=test jest", "test:unit:debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --no-cache --runInBand" }, "jest": { @@ -33,7 +33,7 @@ ], "transform": { ".*\\.(vue)$": "vue-jest", - "^.+\\.js$": "/node_modules/babel-jest" + "^.+\\.js$": "babel-jest" }, "moduleFileExtensions": [ "js", From cd42824502bb5da433425201a91b22edaa472c72 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 22 Jan 2021 17:33:33 +0100 Subject: [PATCH 41/50] force NODE_ENV=test also on backend tests --- backend/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/package.json b/backend/package.json index 786fe6641..e5cc976d6 100644 --- a/backend/package.json +++ b/backend/package.json @@ -15,7 +15,7 @@ "dev": "nodemon --exec babel-node src/ -e js,gql", "dev:debug": "nodemon --exec babel-node --inspect=0.0.0.0:9229 src/ -e js,gql", "lint": "eslint src --config .eslintrc.js", - "test": "jest --forceExit --detectOpenHandles --runInBand", + "test": "cross-env NODE_ENV=test jest --forceExit --detectOpenHandles --runInBand", "db:clean": "babel-node src/db/clean.js", "db:reset": "yarn run db:clean", "db:seed": "babel-node src/db/seed.js", From c420e1854387ba38583fb8b5147a5eec163c999a Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 22 Jan 2021 17:38:54 +0100 Subject: [PATCH 42/50] - lint fixes --- backend/src/middleware/permissionsMiddleware.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/middleware/permissionsMiddleware.js b/backend/src/middleware/permissionsMiddleware.js index b49b4bb0c..44f3aeed6 100644 --- a/backend/src/middleware/permissionsMiddleware.js +++ b/backend/src/middleware/permissionsMiddleware.js @@ -37,17 +37,17 @@ const isMySocialMedia = rule({ cache: 'no_cache', })(async (_, args, { user }) => { // We need a User - if (!user){ + if (!user) { return false } let socialMedia = await neode.find('SocialMedia', args.id) // Did we find a social media node? - if(!socialMedia){ + if (!socialMedia) { return false } socialMedia = await socialMedia.toJson() // whats this for? - //Is it my social media entry? + // Is it my social media entry? return socialMedia.ownedBy.node.id === user.id }) From 203b4b80ab3cefd058d607e80498c0755a86315d Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 22 Jan 2021 17:51:00 +0100 Subject: [PATCH 43/50] - fixed typo --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c69520ae..eb0b3a35a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,6 +85,6 @@ jobs: run: docker run --rm ocelotsocialnetwork/webapp:build yarn run lint # Unit Tests - - name: webapp | unit tests + - name: webapp | Unit tests run: docker run --rm ocelotsocialnetwork/webapp:build yarn run test From 124ab5e31f8aef95ec705eb25df28c025c390761 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 23 Jan 2021 01:56:06 +0100 Subject: [PATCH 44/50] - test docker compose for backend tests --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb0b3a35a..03a688fcb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,8 +54,10 @@ jobs: run: docker run --rm ocelotsocialnetwork/backend:build yarn run lint # Unit Tests - #- name: backend | unit tests - # run: docker run --env MAPBOX_TOKEN=123ABC --env JWT_SECRET=123ABC --env PRIVATE_KEY_PASSPHRASE=123ABC --rm ocelotsocialnetwork/backend:build yarn run test + - name: backend | Unit tests + run: | + docker-compose up + docker-compose exec backend yarn test ########################################################################## # WEBAPP ################################################################# From 210e09a12ae81cb32c5156d5adb022ea56798d20 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 23 Jan 2021 02:03:01 +0100 Subject: [PATCH 45/50] docker compose does not work out of the box with ci. Therefore this is for another PR --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 03a688fcb..551f91c43 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,10 +54,10 @@ jobs: run: docker run --rm ocelotsocialnetwork/backend:build yarn run lint # Unit Tests - - name: backend | Unit tests - run: | - docker-compose up - docker-compose exec backend yarn test + #- name: backend | Unit tests + # run: | + # docker-compose up + # docker-compose exec backend yarn test ########################################################################## # WEBAPP ################################################################# From c5a1243b4b2b8b58a18623af4c7273642385c092 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 23 Jan 2021 02:09:44 +0100 Subject: [PATCH 46/50] - corrected comment --- docker-compose.override.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 9f94372fd..5c0280667 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -45,7 +45,7 @@ services: # Also expose the neo4j query browser - 7474:7474 networks: - # So we can access the playground from our host machine + # So we can access the neo4j query browser from our host machine - external-net ######################################################## From 52842c51bb9c30b184fb00c97adb72f7ccf0050e Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 23 Jan 2021 03:10:07 +0100 Subject: [PATCH 47/50] - working production docker-compose setup --- backend/Dockerfile | 5 +++-- webapp/Dockerfile | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index fcb978810..b1cd52b30 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -75,12 +75,13 @@ 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 # 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 -# yarn install -RUN yarn install --production=true --frozen-lockfile --non-interactive --no-cache +# Copy package.json for script definitions (lock file should not be needed) +COPY --from=build ${DOCKER_WORKDIR}/package.json ./package.json # Run command CMD /bin/sh -c "yarn run start" \ No newline at end of file diff --git a/webapp/Dockerfile b/webapp/Dockerfile index d6b186e1e..a82e51f94 100644 --- a/webapp/Dockerfile +++ b/webapp/Dockerfile @@ -75,14 +75,15 @@ FROM base as production # Copy "binary"-files from build image COPY --from=build ${DOCKER_WORKDIR}/.nuxt ./.nuxt -COPY --from=build ${DOCKER_WORKDIR}/nuxt.config.js ./ +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 should be one Folder containign all stuff needed to be copied COPY --from=build ${DOCKER_WORKDIR}/constants ./constants COPY --from=build ${DOCKER_WORKDIR}/static ./static COPY --from=build ${DOCKER_WORKDIR}/locales ./locales -# yarn install -RUN yarn install --production=true --frozen-lockfile --non-interactive --no-cache +# Copy package.json for script definitions (lock file should not be needed) +COPY --from=build ${DOCKER_WORKDIR}/package.json ./package.json # Run command CMD /bin/sh -c "yarn run start" \ No newline at end of file From 4842c5d7fef6cfdf53d430ac1639552844de45f9 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 23 Jan 2021 21:45:02 +0100 Subject: [PATCH 48/50] Fixed no-env-warning to be more precise --- backend/src/config/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/config/index.js b/backend/src/config/index.js index 9ebde6cee..0370d4552 100644 --- a/backend/src/config/index.js +++ b/backend/src/config/index.js @@ -8,7 +8,7 @@ if (require.resolve) { dotenv.config({ path: require.resolve('../../.env') }) } catch (error) { if (error.code !== 'MODULE_NOT_FOUND') throw error - console.log('WARN: No `.env` file found in /backend') // eslint-disable-line no-console + console.log('WARN: No `.env` file found in `/app` (docker) or `/backend` (no docker)') // eslint-disable-line no-console } } From f4bab1997d769dc5fced6c6a15a1b0c6b0674b5c Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 28 Jan 2021 00:46:11 +0100 Subject: [PATCH 49/50] -fixed test to work in docker and local environment --- backend/src/activitypub/routes/webfinger.spec.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/src/activitypub/routes/webfinger.spec.js b/backend/src/activitypub/routes/webfinger.spec.js index 9dc9b9324..d392da01c 100644 --- a/backend/src/activitypub/routes/webfinger.spec.js +++ b/backend/src/activitypub/routes/webfinger.spec.js @@ -1,6 +1,7 @@ import { handler } from './webfinger' import Factory, { cleanDatabase } from '../../db/factories' import { getDriver } from '../../db/neo4j' +import CONFIG from '../../config' let resource, res, json, status, contentType @@ -98,12 +99,12 @@ describe('webfinger', () => { expect(json).toHaveBeenCalledWith({ links: [ { - href: 'http://webapp:3000/activitypub/users/some-user', + href: `${CONFIG.CLIENT_URI}/activitypub/users/some-user`, rel: 'self', type: 'application/activity+json', }, ], - subject: 'acct:some-user@webapp:3000', + subject: `acct:some-user@${(new URL(CONFIG.CLIENT_URI)).host}`, }) }) }) From 3b8646b44e9a5c471f2f756012e64816d8f42498 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Thu, 28 Jan 2021 00:51:03 +0100 Subject: [PATCH 50/50] - lint fix --- backend/src/activitypub/routes/webfinger.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/activitypub/routes/webfinger.spec.js b/backend/src/activitypub/routes/webfinger.spec.js index d392da01c..528490541 100644 --- a/backend/src/activitypub/routes/webfinger.spec.js +++ b/backend/src/activitypub/routes/webfinger.spec.js @@ -104,7 +104,7 @@ describe('webfinger', () => { type: 'application/activity+json', }, ], - subject: `acct:some-user@${(new URL(CONFIG.CLIENT_URI)).host}`, + subject: `acct:some-user@${new URL(CONFIG.CLIENT_URI).host}`, }) }) })