6 Commits

Author SHA1 Message Date
a2fd91fe34 Ha! Got it! And version bump
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-16 22:24:22 -04:00
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
8 changed files with 39 additions and 38 deletions

View File

@@ -4,7 +4,7 @@ ARG PORT=9001
## mongo build stage ## mongo build stage
FROM mongo:$MONGO_VERSION AS database FROM mongo:$MONGO_VERSION AS database
COPY mongo-init.js /docker-entrypoint-initdb.d COPY mongo-init.sh /docker-entrypoint-initdb.d
## stage one, build the service ## stage one, build the service
FROM node:20-alpine AS build FROM node:20-alpine AS build

View File

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

View File

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

View File

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

View File

@@ -9,8 +9,7 @@ import passport from '../passport';
import { ErrorCodes, getErrorBody } from '../../constants/errors'; import { ErrorCodes, getErrorBody } from '../../constants/errors';
import { authenticated } from '../middleware/authenication'; import { authenticated } from '../middleware/authenication';
// const routerOpts: Router.IRouterOptions = { prefix }; const routerOpts: Router.IRouterOptions = { prefix };
const routerOpts: Router.IRouterOptions = {};
const router: Router = new Router(routerOpts); const router: Router = new Router(routerOpts);
router.get('/info', (ctx) => { router.get('/info', (ctx) => {

View File

@@ -1,16 +0,0 @@
/* eslint-disable no-undef */
console.log('mongo-init.js', {
user: process.env.DB_USERNAME,
pass: process.env.DB_PASSWORD,
db: 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

View File

@@ -1,6 +1,6 @@
{ {
"name": "@mifi/auth", "name": "@mifi/auth",
"version": "0.0.38", "version": "0.0.39",
"author": "mifi (Mike Fitzpatrick)", "author": "mifi (Mike Fitzpatrick)",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {