From cbf83273fb8b36d198818447eec45bcd50bcb1a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Fri, 19 Oct 2018 23:06:59 +0200 Subject: [PATCH 1/4] Provide installation with docker --- Dockerfile | 18 ++++++++++++++++++ docker-compose.yml | 29 +++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..36d94ffa5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM node:10-alpine +LABEL Description="Server part of the social network Human Connection" Vendor="Human-Connection gGmbH" Version="0.0.1" Maintainer="Human-Connection gGmbH (developer@human-connection.org)" + +# expose the app port +EXPOSE 4000 + +ARG WORKDIR=/HC-Server + +RUN mkdir -p $WORKDIR +WORKDIR $WORKDIR + +COPY package.json . +COPY yarn.lock . +RUN yarn install --production=false --frozen-lockfile --non-interactive + +COPY . . + +CMD ["yarn", "run", "start"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..013fad907 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,29 @@ +version: "3.7" + +services: + server: + build: . + networks: + - hc-network + depends_on: + - neo4j + ports: + - 4000:4000 + environment: + - NEO4J_URI=bolt://neo4j:7687 + - GRAPHQL_LISTEN_PORT=4000 + - GRAPHQL_URI=http://localhost:4000 + - CLIENT_URI=http://localhost:3000 + - JWT_SECRET=b/&&7b78BF&fv/Vd + - MOCK=false + + neo4j: + image: neo4j:3.4 + networks: + - hc-network + environment: + - NEO4J_AUTH=none + +networks: + hc-network: + name: hc-network From 91fb18f77dca7ea3c0d8478b902baa6d10c99df7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Fri, 19 Oct 2018 23:18:22 +0200 Subject: [PATCH 2/4] DB volume (for cleaning) + Naming: server->backend --- docker-compose.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 013fad907..afb8037e7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: "3.7" services: - server: + backend: build: . networks: - hc-network @@ -21,9 +21,14 @@ services: image: neo4j:3.4 networks: - hc-network + volumes: + - neo4j-data:/data environment: - NEO4J_AUTH=none networks: hc-network: name: hc-network + +volumes: + neo4j-data: From 67e330d10efd93af9543c60767cc9f3163ec6e7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Fri, 19 Oct 2018 23:19:32 +0200 Subject: [PATCH 3/4] Add Documentation for Installation with Docker --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index b75488607..1a47ee398 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,26 @@ ## Quick Start +### Installation with Docker + +Run: +```sh +docker-compose up +# if you want seed data +# open another terminal and run +docker-compose exec backend yarn run seedDb +``` + +App is [running on port 4000](http://localhost:4000/) + +To wipe out your neo4j database run: +```sh +docker-compose down -v +``` + + +### Installation without Docker + Install dependencies: ```bash From 036e4a602be5c6da55c8d7c60329c7ab17294d62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Sat, 20 Oct 2018 01:25:53 +0200 Subject: [PATCH 4/4] Add .dockerignore --- .dockerignore | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..ccb6f6091 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,9 @@ +.vscode/ + +node_modules/ +npm-debug.log + +Dockerfile +docker-compose*.yml + +.env