40 Commits

Author SHA1 Message Date
967ef4e440 Updates
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-13 10:44:21 -04:00
d9285e4bec Working setups for dev and staging! (mostly)
All checks were successful
continuous-integration/drone/push Build is passing
TODO: Still no access to routes on staging... hmmm...
2023-05-12 15:37:32 -04:00
17949255d3 Maybe with a shell script...
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-12 15:30:38 -04:00
c6e5eaf3a1 Def not
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-12 12:51:22 -04:00
0e220c0cf0 Remove console logging...
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-12 08:37:52 -04:00
ebfe4339dc a lil logging
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-12 08:23:17 -04:00
0d3ca5382b db init script running, but no user... hmmmm 2023-05-12 08:20:41 -04:00
4477af601a Remove git attempts
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-12 08:13:05 -04:00
3b27300249 force yes
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-12 07:58:23 -04:00
47c4f4816c apt?
Some checks failed
continuous-integration/drone/push Build is failing
2023-05-12 07:53:35 -04:00
95fdd8cf45 nope
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-11 22:57:06 -04:00
f7f6dcae12 Goodbye warnings?
Some checks failed
continuous-integration/drone/push Build is failing
2023-05-11 22:50:41 -04:00
62a917677d Perhaps, more correct...
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-11 22:17:17 -04:00
717e651cf9 Let's try this...
Some checks failed
continuous-integration/drone/push Build was killed
2023-05-11 22:08:27 -04:00
25688e1f03 Nope
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-11 22:00:49 -04:00
050a4f2b39 Or this?
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-11 21:27:56 -04:00
36093f0fb5 Or this?
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-11 21:25:20 -04:00
b9d5683d22 Arg...s.
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-11 21:20:24 -04:00
0b95587f53 Again...
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-11 20:20:06 -04:00
486ef52745 wrong version
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-11 20:13:30 -04:00
ca6a6a9ab3 Bringing back the mongo build stage...
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-11 20:02:53 -04:00
676124f23e Tried this before..
Some checks failed
continuous-integration/drone/push Build is failing
2023-05-11 19:35:32 -04:00
d25755775e Likely not
Some checks failed
continuous-integration/drone/push Build is failing
2023-05-11 19:02:27 -04:00
71904a53d9 Undo
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-11 18:36:22 -04:00
3dd7ccdcdc Giving up on a non-root user for now...
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-11 13:00:34 -04:00
c8e08ef567 Add db and user...
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-11 12:42:03 -04:00
cfad224c8d Revert "More paths"
All checks were successful
continuous-integration/drone/push Build is passing
This reverts commit 43dcdf4e6a.
2023-05-11 07:56:32 -04:00
43dcdf4e6a More paths
Some checks failed
continuous-integration/drone/push Build is failing
2023-05-10 21:46:12 -04:00
9e3f7e2714 More path fixes
Some checks failed
continuous-integration/drone/push Build is failing
2023-05-10 20:07:25 -04:00
4982175342 Fix paths
Some checks failed
continuous-integration/drone/push Build is failing
2023-05-10 20:06:26 -04:00
65ff23e406 Shouldn't matter... directory structure
Some checks failed
continuous-integration/drone/push Build is failing
2023-05-10 20:04:27 -04:00
a07e4ad9cc Muahahahaha
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-10 19:38:21 -04:00
4d813c6c2c And this
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-10 19:29:34 -04:00
9b0b9baf16 Give this a try (but it likely will have no effect) 2023-05-10 19:27:38 -04:00
9edbcc0bc2 Use the suboptimal...
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-10 14:32:31 -04:00
12bff5848a Bring back the separate build step
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-10 14:21:52 -04:00
1bb5151fce Was the mongo version really the problem all along?
Some checks failed
continuous-integration/drone/push Build was killed
2023-05-10 14:20:55 -04:00
75c6af122f Reollback
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-10 14:01:38 -04:00
da36606af3 Again...
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-10 13:50:13 -04:00
c3a689a007 DUH.
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-10 13:29:38 -04:00
8 changed files with 68 additions and 55 deletions

View File

@@ -166,8 +166,8 @@ steps:
ROUTE_PREFIX: /auth
PORT: 9001
commands:
# - docker compose -f docker-compose.staging-build.yml build --pull --no-cache
- docker compose -f docker-compose.staging-build.yml up --remove-orphans --pull always --build --force-recreate --wait
- docker compose -f docker-compose.staging-build.yml build --pull --no-cache
- docker compose -f docker-compose.staging-build.yml up --remove-orphans --force-recreate --wait
volumes:
- name: env-secrets
path: /drone/auth/staging.env

View File

@@ -6,14 +6,14 @@ ROUTE_PREFIX=/auth
LOGIN_ROUTE=/login
RESET_ROUTE=/reset
DB_ADMIN_USERNAME=root
DB_ADMIN_PASSWORD=password
# DB_ADMIN_USERNAME=root
# DB_ADMIN_PASSWORD=password
DB_USERNAME=user
DB_PASSWORD=password
DB_NAME=auth
MONGO_INITDB_ROOT_USERNAME=$DB_ADMIN_USERNAME
MONGO_INITDB_ROOT_PASSWORD=$DB_ADMIN_PASSWORD
MONGO_INITDB_ROOT_USERNAME=$DB_USERNAME
MONGO_INITDB_ROOT_PASSWORD=$DB_PASSWORD
MONGO_INITDB_DATABASE=$DB_NAME
SESSION_KEY=shjhakjfhfjdshjksdhfdshfhfduyeyb73te4

View File

@@ -1,8 +1,10 @@
## stage zero, setup mongo
FROM mongo:latest
WORKDIR /docker-entrypoint-initdb.d
COPY mongo-init.js ./
EXPOSE 27017
ARG ENV=production
ARG MONGO_VERSION=latest
ARG PORT=9001
## mongo build stage
FROM mongo:$MONGO_VERSION AS database
COPY mongo-init.sh /docker-entrypoint-initdb.d
## stage one, build the service
FROM node:20-alpine AS build
@@ -17,10 +19,10 @@ RUN yarn build
## this is stage two , where the app actually runs
FROM node:20-alpine AS containerize
ENV NODE_ENV ${ENV:-production}
ENV NODE_ENV $ENV
WORKDIR /home/node/app
COPY package*.json ./
RUN yarn install --frozen-lockfile --production
COPY --from=0 /home/node/app/dist .
EXPOSE ${PORT:-9001}
COPY --from=build /home/node/app/dist .
EXPOSE $PORT
CMD ["node","server/index.js"]

View File

@@ -3,7 +3,7 @@ version: '3.8'
services:
auth-service_mongo:
env_file: .env.dev
container_name: ${CONTAINER_PREFIX:-dev}-auth-service_mongo
container_name: ${CONTAINER_PREFIX}-auth-service_mongo
ports:
- 27017:27017
networks:
@@ -11,7 +11,6 @@ services:
volumes:
- auth-db:/data/db
- auth-db:/data/configdb
- ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
restart: unless-stopped
image: mongo:latest
auth-service:
@@ -21,11 +20,11 @@ services:
args:
- PORT
- ENV
container_name: ${CONTAINER_PREFIX:-dev}-auth-service
container_name: ${CONTAINER_PREFIX}-auth-service
ports:
- 9001:9001
environment:
- DB_HOST=${CONTAINER_PREFIX:-dev}-auth-service_mongo
- DB_HOST=${CONTAINER_PREFIX}-auth-service_mongo
networks:
- labs-net
- backend

View File

@@ -2,43 +2,53 @@ version: '3.8'
services:
auth-service_mongo:
container_name: ${CONTAINER_PREFIX:-staging}-auth-service_mongo
env_file:
- staging.env
build: .
networks:
- docknet
volumes:
- 'auth-db:/data/db'
- 'auth-db:/data/configdb'
restart: unless-stopped
image: mongo:latest
auth-service:
container_name: ${CONTAINER_PREFIX}-auth-service_mongo
env_file:
- staging.env
build:
context: .
target: database
args:
MONGO_VERSION: 4.4
networks:
- auth-backend
volumes:
- 'auth-db:/data/db'
- 'auth-db:/data/configdb'
restart: unless-stopped
image: mongo:4.4
auth-service:
container_name: ${CONTAINER_PREFIX}-auth-service
env_file:
- staging.env
build:
context: .
target: containerize
args:
- PORT
- ENV
container_name: ${CONTAINER_PREFIX:-staging}-auth-service
environment:
- DB_HOST=${CONTAINER_PREFIX:-staging}-auth-service_mongo
- DB_HOST=${CONTAINER_PREFIX}-auth-service_mongo
labels:
- 'traefik.enable=true'
- 'traefik.http.routers.grow.rule=Host(`${HOST}`) && Path(`${ROUTE_PREFIX}`)'
- 'traefik.http.routers.grow.entrypoints=websecure'
- 'traefik.http.routers.grow.tls=true'
- 'traefik.http.routers.grow.tls.certresolver=letsencrypt'
- 'traefik.http.routers.grow.service=grow-service'
- 'traefik.http.services.grow-service.loadbalancer.server.port=${PORT}'
- 'traefik.docker.network=docknet'
- 'traefik.http.routers.labs-auth.rule=Host(`${HOST}`) && Path(`${ROUTE_PREFIX}`)'
- 'traefik.http.routers.labs-auth.entrypoints=websecure'
- 'traefik.http.routers.labs-auth.tls=true'
- 'traefik.http.routers.labs-auth.tls.certresolver=letsencrypt'
- 'traefik.http.routers.labs-auth.service=labs-auth-service'
- 'traefik.http.services.labs-auth-service.loadbalancer.server.port=${PORT}'
networks:
- auth-backend
- docknet
restart: unless-stopped
image: node:20-alpine
depends_on:
- auth-service_mongo
networks:
auth-backend:
driver: bridge
external: false
docknet:
name: docknet
external: true

View File

@@ -2,7 +2,7 @@ version: '3.8'
services:
auth-service_mongo:
container_name: ${CONTAINER_PREFIX:-staging}-auth-service_mongo
container_name: ${CONTAINER_PREFIX}-auth-service_mongo
env_file:
- staging.env
networks:
@@ -11,13 +11,13 @@ services:
- auth-db:/data
- ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
restart: unless-stopped
image: mongo:latest
image: mongo:4.4
auth-service:
env_file:
- staging.env
container_name: ${CONTAINER_PREFIX:-staging}-auth-service
container_name: ${CONTAINER_PREFIX}-auth-service
environment:
- DB_HOST=${CONTAINER_PREFIX:-staging}-auth-service_mongo
- DB_HOST=${CONTAINER_PREFIX}-auth-service_mongo
labels:
- 'traefik.enable=true'
- 'traefik.http.routers.grow.rule=Host(`${HOST}`) && Path(`${ROUTE_PREFIX}`)'
@@ -29,9 +29,9 @@ services:
networks:
- docknet
restart: unless-stopped
image: git.mifi.dev/mifi/mifi/auth:latest
depends_on:
- auth-service_mongo
image: git.mifi.dev/mifi/mifi/auth:latest
networks:
docknet:

View File

@@ -1,12 +0,0 @@
/* eslint-disable no-undef */
db = db.getSiblingDB(process.env.DB_NAME);
db.createUser({
user: process.env.DB_USERNAME,
pwd: process.env.DB_PASSWORD,
roles: [
{
role: 'readWrite',
db: process.env.DB_NAME,
},
],
});

14
mongo-init.sh Normal file
View File

@@ -0,0 +1,14 @@
set -e
mongo <<EOF
use $MONGO_INITDB_DATABASE
db.createUser({
user: '$DB_USERNAME',
pwd: '$DB_PASSWORD',
roles: [{
role: 'readWrite',
db: '$MONGO_INITDB_DATABASE'
}]
})
EOF