Provision maintenance-worker to seed/reset db

This commit is contained in:
Robert Schäfer 2019-04-19 01:23:51 +02:00
parent be9980f2aa
commit 45c0dbd5a8
4 changed files with 51 additions and 9 deletions

View File

@ -23,6 +23,13 @@ services:
depends_on:
- backend
environment:
- GRAPHQL_PORT=4000
- GRAPHQL_URI=http://localhost:4000
- CLIENT_URI=http://localhost:3000
- JWT_SECRET=b/&&7b78BF&fv/Vd
- MOCK=false
- MAPBOX_TOKEN=pk.eyJ1IjoiaHVtYW4tY29ubmVjdGlvbiIsImEiOiJjajl0cnBubGoweTVlM3VwZ2lzNTNud3ZtIn0.KZ8KK9l70omjXbEkkbHGsQ
- PRIVATE_KEY_PASSPHRASE=a7dsf78sadg87ad87sfagsadg78
- NEO4J_URI=bolt://neo4j:7687
- "SSH_USERNAME=${SSH_USERNAME}"
- "SSH_HOST=${SSH_HOST}"

View File

@ -1,13 +1,24 @@
FROM mongo:4
FROM humanconnection/neo4j:latest as base
RUN apk upgrade --update
RUN apk add mongodb mongodb-tools openssh nodejs yarn
RUN apt-get update && apt-get -y install --no-install-recommends wget apt-transport-https \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN wget -O - https://debian.neo4j.org/neotechnology.gpg.key | apt-key add -
RUN echo 'deb https://debian.neo4j.org/repo stable/' | tee /etc/apt/sources.list.d/neo4j.list
RUN apt-get update && apt-get -y install --no-install-recommends openjdk-8-jre openssh-client neo4j rsync \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY migration ./migration
COPY migrate.sh /usr/local/bin/migrate
COPY sync_uploads.sh /usr/local/bin/sync_uploads
ENV NODE_ENV=maintenance
FROM humanconnection/nitro-backend:latest as backend
FROM base
COPY --from=backend /nitro-backend /nitro-backend
COPY seeding/package.json .
# Install graphql-request manually, it's required for seeding and not included
# in backend's preinstalled node_modules/
RUN yarn install && \
cp -r ./node_modules/* /nitro-backend/node_modules/ && \
rm -rf ./node_modules/ yarn.lock && \
mv package.json /nitro-backend/package.json
# We have to do this odd copying to prevent cleaning `node_modules` folder which
# would happen if we `yarn install|add` in the target directory

View File

@ -0,0 +1,12 @@
NEO4J_URI=bolt://localhost:7687
NEO4J_USER=neo4j
NEO4J_PASSWORD=letmein
GRAPHQL_PORT=4000
GRAPHQL_URI=http://localhost:4000
CLIENT_URI=http://localhost:3000
MOCK=false
JWT_SECRET="b/&&7b78BF&fv/Vd"
MAPBOX_TOKEN="pk.eyJ1IjoiaHVtYW4tY29ubmVjdGlvbiIsImEiOiJjajl0cnBubGoweTVlM3VwZ2lzNTNud3ZtIn0.KZ8KK9l70omjXbEkkbHGsQ"
PRIVATE_KEY_PASSPHRASE="a7dsf78sadg87ad87sfagsadg78"

View File

@ -0,0 +1,12 @@
{
"license": "MIT",
"scripts": {
"start": "node dist/",
"db:script:seed": "wait-on tcp:4001 && node dist/seed/seed-db.js",
"db:reset": "node dist/seed/reset-db.js",
"db:seed": "cross-env GRAPHQL_URI=http://localhost:4001 GRAPHQL_PORT=4001 DISABLED_MIDDLEWARES=permissions run-p --race start db:script:seed"
},
"dependencies": {
"graphql-request": "*"
}
}