20 Commits

Author SHA1 Message Date
117c78e7a9 Merge pull request 'develop' (#2) from develop into main
Reviewed-on: #2
2023-05-26 16:49:33 +00:00
95ed9bf158 Hehehehe
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2023-05-26 12:19:35 -04:00
9dc3520989 Finishing touches and version bump... let the development continue!
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-26 12:10:06 -04:00
62c50964fa Yay!
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-26 12:05:46 -04:00
392414354b staging
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-26 11:26:49 -04:00
224eeae092 trying again
Some checks failed
continuous-integration/drone/push Build is failing
2023-05-26 11:23:56 -04:00
64c4345c28 Hmm...
Some checks failed
continuous-integration/drone/push Build is failing
2023-05-26 11:22:24 -04:00
6921bea5b5 Lets try this... kickstart for the db...
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-26 11:06:37 -04:00
ebe086e70f oops
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-26 10:24:49 -04:00
af943c1e84 done test update 2023-05-26 10:22:07 -04:00
50af0b3065 Merge branch 'main' of ssh://git.mifi.dev:12022/mifi/auth-service
# Conflicts:
#	Dockerfile
2023-05-26 10:21:43 -04:00
50e691cf05 Why do I suck at Dockerfiles? 2023-05-26 10:17:36 -04:00
e706ef1924 Why do I suck at Dockerfiles? 2023-05-26 09:35:56 -04:00
0ad99d3f0a Maybe with ENV vars? 2023-05-26 09:13:02 -04:00
bb7b15351d More attempts at publishing... 2023-05-26 09:08:33 -04:00
bc73ab271b ugh 2023-05-25 13:30:17 -04:00
b1b1f3e0b9 Muahahahaha. Or not... 2023-05-25 13:08:14 -04:00
30c86accf6 Hmmm. 2023-05-25 13:00:16 -04:00
0882e8754e Incrementing versions we go... 2023-05-25 12:42:27 -04:00
73ac3d2dc6 Trying this... 2023-05-25 12:33:21 -04:00
9 changed files with 78 additions and 62 deletions

View File

@@ -91,6 +91,7 @@ steps:
commands:
- yarn set version stable
- yarn install
- yarn build:package
volumes:
- name: yarnrc
path: /drone/auth/.yarnrc.yml
@@ -124,6 +125,11 @@ steps:
auto_tag: true
repo: git.mifi.dev/mifi/auth-service
registry: git.mifi.dev
build_args:
- MONGO_ENTRY_FILE=latest
- MONGO_VERSION=latest
- NPM_TOKEN:
from_secret: reg_token
ssh-agent-key:
from_secret: reg_token
username: <token>
@@ -203,7 +209,7 @@ steps:
template: |
{
"icon_url":"https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/apple/198/freezing-face_1f976.png",
"text": "[{{ repo.name }} - Build # {{ build.number }}] Deploy {{ build.status }} {{#success build.status}}:tada:{{else}}:poop:{{/success}}",
"text": "[{{ repo.name }} - Build # {{ build.number }}] Staging Deploy {{ build.status }} {{#success build.status}}:tada:{{else}}:poop:{{/success}}",
"username":"DroneBot"
}
when:
@@ -244,25 +250,9 @@ clone:
steps:
- name: Deploy Container
image: docker
privileged: true
environment:
CONTAINER_PREFIX: staging
HOST: area51.mifi.dev
ROUTE_PREFIX: /auth
PORT: 9001
commands:
- docker compose -f docker-compose.production-build.yml pull
- docker compose -f docker-compose.production-build.yml build --no-cache
- docker compose -f docker-compose.production-build.yml rm --stop
- docker compose -f docker-compose.production-build.yml up --wait
volumes:
- name: env-secrets
path: /drone/auth/production.env
- name: dockersock
path: /var/run/docker.sock
- name: dockerconfig
path: /drone/auth/.docker/config.json
image: plugins/webhook
settings:
urls: https://portainer.mifi.dev/api/stacks/webhooks/968d2244-2548-4f0b-8c18-bbc9bc35305d
- name: Send Status Notifications
image: plugins/webhook
privileged: true
@@ -272,7 +262,7 @@ steps:
template: |
{
"icon_url":"https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/apple/198/freezing-face_1f976.png",
"text": "[{{ repo.name }} - Build # {{ build.number }}] Deploy {{ build.status }} {{#success build.status}}:tada:{{else}}:poop:{{/success}}",
"text": "[{{ repo.name }} - Build # {{ build.number }}] Production Deploy {{ build.status }} {{#success build.status}}:tada:{{else}}:poop:{{/success}}",
"username":"DroneBot"
}
when:
@@ -280,19 +270,8 @@ steps:
- success
- failure
volumes:
- name: dockerconfig
host:
path: /volume1/docker/dockerconfig.json
- name: dockersock
host:
path: /var/run/docker.sock
- name: env-secrets
host:
path: /volume1/docker/beethoven/labs-auth/staging.env
depends_on:
- Test Pipeline
- Publish Pipeline
trigger:
event:

View File

@@ -1,18 +1,20 @@
ARG ENV=production
ARG MONGO_ENTRY_FILE
ARG MONGO_VERSION=latest
ARG NPM_TOKEN
ARG PORT=9001
ARG NPM_TOKEN=not_set
ARG YARN_VERSION=3.5.0
## mongo build stage
FROM mongo:$MONGO_VERSION AS database
COPY docker-entrypoint-initdb.d/mongo-init-$MONGO_VERSION.sh ./docker-entrypoint-initdb.d/mongo-init.sh
FROM mongo:${MONGO_VERSION} AS database
ARG MONGO_ENTRY_FILE=${MONGO_ENTRY_FILE:-latest}
COPY docker-entrypoint-initdb.d/mongo-init-${MONGO_ENTRY_FILE}.sh ./docker-entrypoint-initdb.d/mongo-init.sh
## stage one, build the service
FROM node:20-bullseye-slim AS build
ENV YARN_VERSION $YARN_VERSION
ENV NODE_ENV development
ENV NPM_TOKEN $NPM_TOKEN
ENV YARN_VERSION=${YARN_VERSION}
ENV NODE_ENV=development
ENV NPM_TOKEN=${NPM_TOKEN}
WORKDIR /home/node/app
COPY .npmrc /root
COPY .build.yarnrc.yml /root/.yarnrc.yml
@@ -22,9 +24,9 @@ RUN yarn build:production
## this is stage two , where the app actually runs
FROM node:20-bullseye-slim AS containerize
ENV YARN_VERSION $YARN_VERSION
ENV NODE_ENV $ENV
ENV NPM_TOKEN $NPM_TOKEN
ENV YARN_VERSION=${YARN_VERSION}
ENV NODE_ENV=${ENV}
ENV NPM_TOKEN=${NPM_TOKEN}
WORKDIR /home/node/app
COPY .npmrc /root
COPY .build.yarnrc.yml /root/.yarnrc.yml

View File

@@ -8,7 +8,7 @@ services:
context: .
target: database
args:
MONGO_VERSION: 6.0.5
MONGO_VERSION: latest
ports:
- 27017:27017
networks:

View File

@@ -9,7 +9,8 @@ services:
context: .
target: database
args:
MONGO_VERSION: 4.4
- MONGO_ENTRY_FILE=4.4
- MONGO_VERSION=4.4
networks:
- auth-backend
volumes:
@@ -55,4 +56,4 @@ networks:
volumes:
auth-db:
external: false
external: true

View File

@@ -3,41 +3,57 @@ version: '3.8'
services:
auth-service_mongo:
container_name: ${CONTAINER_PREFIX}-auth-service_mongo
env_file:
- staging.env
networks:
- auth-backend
- docknet
volumes:
- auth-db:/data
- ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
- auth-db:/data/db
- auth-db:/data/configdb
restart: unless-stopped
image: mongo:4.4
image: mongo:${MONGO_VERSION}
auth-service:
env_file:
- staging.env
container_name: ${CONTAINER_PREFIX}-auth-service
environment:
- DB_HOST=${CONTAINER_PREFIX}-auth-service_mongo
- DB_NAME=${DB_NAME}
- DB_PASSWORD=${DB_PASSWORD}
- DB_USERNAME=${DB_USERNAME}
- DEFAULT_TOKEN_DAYS=${DEFAULT_TOKEN_DAYS}
- JWT_AUDIENCE=${JWT_AUDIENCE}
- JWT_ISSUER=${JWT_ISSUER}
- JWT_SECRET=${JWT_SECRET}
- LOGIN_ROUTE=${LOGIN_ROUTE}
- LOGIN_VALID_TIME=${LOGIN_VALID_TIME}
- PORT=${PORT}
- RESET_ROUTE=${RESET_ROUTE}
- RESET_VALID_MINUTES=${RESET_VALID_MINUTES}
- ROUTE_PREFIX=${ROUTE_PREFIX}
- SESSION_KEY=${SESSION_KEY}
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.auth.rule=Host(`${HOST}`) && PathPrefix(`${ROUTE_PREFIX}`)'
- 'traefik.http.routers.auth.entrypoints=websecure'
- 'traefik.http.routers.auth.tls=true'
- 'traefik.http.routers.auth.tls.certresolver=letsencrypt'
- 'traefik.http.routers.auth.service=auth-service'
- 'traefik.http.services.auth-service.loadbalancer.server.port=${PORT}'
networks:
- auth-backend
- docknet
restart: unless-stopped
depends_on:
- auth-service_mongo
image: git.mifi.dev/mifi/mifi/auth:latest
image: git.mifi.dev/mifi/auth-service:latest
networks:
auth-backend:
driver: bridge
external: false
docknet:
name: docknet
external: true
volumes:
auth-db:
external: false
external: true

View File

@@ -1,10 +1,11 @@
{
"name": "@mifi/auth-service",
"version": "1.0.3",
"version": "1.0.12",
"author": "mifi (Mike Fitzpatrick)",
"license": "MIT",
"scripts": {
"build": "tsc",
"build:package": "tsc -p ./tsconfig.package.json",
"build:production": "tsc -p ./tsconfig.production.json",
"format": "prettier:fix && lint:fix",
"lint": "eslint --ext .ts,.tsx src/",

17
tsconfig.package.json Normal file
View File

@@ -0,0 +1,17 @@
{
"extends": "@tsconfig/node16/tsconfig.json",
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"declaration": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"noImplicitAny": true,
"outDir": "dist/",
"rootDirs": ["./", "src/"],
"strict": true,
"esModuleInterop": true,
"sourceMap": false,
"removeComments": true
},
"include": ["./src"]
}

View File

@@ -2,7 +2,7 @@
"extends": "@tsconfig/node16/tsconfig.json",
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"declaration": true,
"declaration": false,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"noImplicitAny": true,