34 Commits

Author SHA1 Message Date
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
b0ed748712 ??
Some checks failed
continuous-integration/drone/push Build is failing
2023-05-10 13:28:04 -04:00
08a5b44660 hmmm 2023-05-10 13:19:49 -04:00
c80856f3c5 Adding the build back...
Some checks failed
continuous-integration/drone/push Build is failing
2023-05-10 13:16:03 -04:00
70737658c7 Hmmm..,.
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-10 13:14:09 -04:00
ebf0c6d970 Some crazy shit right here... mongo in the Dockerfile
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-10 13:09:30 -04:00
c92cefa903 This should work, but is suboptimal
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-10 12:40:16 -04:00
63e4270c89 La la la
Some checks failed
continuous-integration/drone/push Build is failing
2023-05-10 12:33:16 -04:00
721edb71a1 - Build the db?
Some checks failed
continuous-integration/drone/push Build is failing
2023-05-10 12:18:48 -04:00
8f20452e1a Sigh...
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-10 11:47:08 -04:00
de58630958 Ha.
Some checks failed
continuous-integration/drone/push Build encountered an error
2023-05-10 11:42:39 -04:00
f61b2b4535 Temp folder?
Some checks failed
continuous-integration/drone/push Build encountered an error
2023-05-10 11:41:13 -04:00
6863d64112 Changes..
Some checks failed
continuous-integration/drone/push Build is failing
2023-05-10 11:30:15 -04:00
aa52473f90 Ugh
Some checks failed
continuous-integration/drone/push Build is failing
2023-05-10 11:15:43 -04:00
465e47fc10 Symlinks?
Some checks failed
continuous-integration/drone/push Build is failing
2023-05-10 11:03:57 -04:00
3a721987dd This absolutely won't work...
Some checks failed
continuous-integration/drone/push Build is failing
2023-05-10 10:47:29 -04:00
2792753d3d Change volume inclusion back
Some checks failed
continuous-integration/drone/push Build is failing
2023-05-10 10:34:47 -04:00
af6184d581 More tweaks
Some checks failed
continuous-integration/drone/push Build is failing
2023-05-10 10:13:23 -04:00
40a3cdabc9 trying again... same ol mongo-init
Some checks failed
continuous-integration/drone/push Build is failing
2023-05-10 10:04:09 -04:00
08e6af2eae - Trying to fix the mongo init
Some checks failed
continuous-integration/drone/push Build encountered an error
2023-05-10 10:01:17 -04:00
09332aca24 fixed clone issue
Some checks failed
continuous-integration/drone/push Build is failing
2023-05-10 09:54:33 -04:00
b161f926a9 Merge pull request 'Resolve branch name issue in pipeline trigger' (#8) from bugfix/pipeline-boken into develop
Some checks failed
continuous-integration/drone/push Build is failing
Reviewed-on: #8
2023-05-10 13:50:40 +00:00
c406d6226c Resolve branch name issue in pipeline trigger
All checks were successful
continuous-integration/drone/pr Build is passing
2023-05-10 09:45:01 -04:00
74fd2bf32c Merge pull request 'Working Local Dev' (#7) from feature/working-local-dev into develop
Reviewed-on: #7
2023-05-10 13:40:42 +00:00
377300d288 Merge branch 'feature/working-local-dev' of ssh://git.mifi.dev:12022/mifi/auth into feature/working-local-dev
All checks were successful
continuous-integration/drone/pr Build is passing
2023-05-10 09:36:56 -04:00
83cc9be24c Drone pipeline fixes 2023-05-10 09:36:33 -04:00
4eaf354912 Merge branch 'develop' into feature/working-local-dev 2023-05-10 13:35:17 +00:00
c9a8e0746a Last second changes 2023-05-10 09:33:45 -04:00
07cca921bf Lots of updates! Working in local dev... not sure about staging yet... 2023-05-10 09:15:49 -04:00
10 changed files with 128 additions and 45 deletions

View File

@@ -3,7 +3,7 @@ type: docker
name: Test Pipeline
workspace:
path: /drone/grow
path: /drone/auth
steps:
- name: yarn install
@@ -70,7 +70,7 @@ type: docker
name: Publish Pipeline
workspace:
path: /drone/grow
path: /drone/auth
steps:
- name: Build Package
@@ -85,7 +85,7 @@ steps:
- yarn publish -t ${DRONE_TAG}
volumes:
- name: npmrc
path: /drone/grow/.npmrc
path: /drone/auth/.npmrc
- name: Report NPM Publish Status
image: plugins/webhook
settings:
@@ -151,10 +151,74 @@ trigger:
---
kind: pipeline
type: docker
name: Deploy Pipeline
name: Staging Deploy Pipeline
workspace:
path: /drone/grow
path: /drone/auth
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.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
- name: dockersock
path: /var/run/docker.sock
- name: dockerconfig
path: /drone/auth/.docker/config.json
- name: Send Status Notifications
image: plugins/webhook
privileged: true
settings:
urls: https://lab.mifi.dev/hooks/ccw34hdf7tgbjmzp96nptn938r
content_type: application/json
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}}",
"username":"DroneBot"
}
when:
status:
- 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
trigger:
branch:
- develop
event:
- push
---
kind: pipeline
type: docker
name: Production Deploy Pipeline
workspace:
path: /drone/auth
clone:
disable: true
@@ -169,17 +233,17 @@ steps:
ROUTE_PREFIX: /auth
PORT: 9001
commands:
- docker compose -f docker-compose.staging_image.yml pull
- docker compose -f docker-compose.staging_image.yml build --no-cache
- docker compose -f docker-compose.staging_image.yml rm --stop
- docker compose -f docker-compose.staging_image.yml up --wait
- 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/grow/staging.env
path: /drone/auth/production.env
- name: dockersock
path: /var/run/docker.sock
- name: dockerconfig
path: /drone/grow/.docker/config.json
path: /drone/auth/.docker/config.json
- name: Send Status Notifications
image: plugins/webhook
privileged: true

View File

@@ -27,3 +27,5 @@ RESET_VALID_MINUTES=15
DEFAULT_TOKEN_DAYS=1
CONTAINER_PREFIX=dev
SERVICE_NAME=auth-service
ENV=development

View File

@@ -1,4 +1,6 @@
## stage one, build the service
FROM node:20-alpine AS build
ENV NODE_ENV development
WORKDIR /home/node/app
COPY package*.json ./
COPY tsconfig.json ./
@@ -8,11 +10,11 @@ RUN yarn install
RUN yarn build
## this is stage two , where the app actually runs
FROM node:20-alpine AS containerize
FROM node:20-alpine AS auth-service
ENV NODE_ENV ${ENV:-production}
WORKDIR /home/node/app
COPY package*.json ./
RUN yarn install --frozen-lockfile --production
COPY --from=0 /home/node/app/dist .
EXPOSE ${PORT}
EXPOSE ${PORT:-9001}
CMD ["node","server/index.js"]

View File

@@ -1,2 +1,2 @@
# grow-api
# @mifi/auth

View File

@@ -3,16 +3,14 @@ version: '3.8'
services:
auth-service_mongo:
env_file: .env.dev
build:
args:
- CONTAINER_PREFIX=${CONTAINER_PREFIX}
container_name: ${CONTAINER_PREFIX:-dev}-auth-service_mongo
ports:
- 27017:27017
networks:
- labs-net
- backend
volumes:
- /var/tmp/labs:/data/db
- 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
@@ -21,10 +19,8 @@ services:
build:
context: .
args:
- HOST=${HOST}
- PORT=${PORT}
- ROUTE_PREFIX=${ROUTE_PREFIX}
- CONTAINER_PREFIX=${CONTAINER_PREFIX}
- PORT
- ENV
container_name: ${CONTAINER_PREFIX:-dev}-auth-service
ports:
- 9001:9001
@@ -32,6 +28,7 @@ services:
- DB_HOST=${CONTAINER_PREFIX:-dev}-auth-service_mongo
networks:
- labs-net
- backend
restart: unless-stopped
image: node:20-alpine
depends_on:
@@ -39,3 +36,7 @@ services:
networks:
labs-net:
name: labs-net
volumes:
auth-db:
external: true

View File

@@ -2,23 +2,28 @@ version: '3.8'
services:
auth-service_mongo:
container_name: ${CONTAINER_PREFIX}-auth-service_mongo
container_name: ${CONTAINER_PREFIX:-staging}-auth-service_mongo
env_file:
- staging.env
networks:
- docknet
volumes:
- '/volume1/docker/labs/auth/mongo:/data/db'
# - ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
- 'auth-db:/data/db'
- 'auth-db:/data/configdb'
- '/volume1/docker/beethoven/labs-auth/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
build: .
container_name: ${CONTAINER_PREFIX}-auth-service
build:
context: .
args:
- PORT
- ENV
container_name: ${CONTAINER_PREFIX:-staging}-auth-service
environment:
- DB_HOST=${CONTAINER_PREFIX}-auth-service_mongo
- DB_HOST=${CONTAINER_PREFIX:-staging}-auth-service_mongo
labels:
- 'traefik.enable=true'
- 'traefik.http.routers.grow.rule=Host(`${HOST}`) && Path(`${ROUTE_PREFIX}`)'
@@ -36,4 +41,8 @@ services:
networks:
docknet:
name: docknet
external: true
external: true
volumes:
auth-db:
external: false

View File

@@ -2,22 +2,22 @@ version: '3.8'
services:
auth-service_mongo:
container_name: ${CONTAINER_PREFIX}-auth-service_mongo
container_name: ${CONTAINER_PREFIX:-staging}-auth-service_mongo
env_file:
- staging.env
networks:
- docknet
volumes:
- '/volume1/docker/labs/auth/mongo:/data/db'
# - ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
- 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}-auth-service
container_name: ${CONTAINER_PREFIX:-staging}-auth-service
environment:
- DB_HOST=${CONTAINER_PREFIX}-auth-service_mongo
- DB_HOST=${CONTAINER_PREFIX:-staging}-auth-service_mongo
labels:
- 'traefik.enable=true'
- 'traefik.http.routers.grow.rule=Host(`${HOST}`) && Path(`${ROUTE_PREFIX}`)'
@@ -32,7 +32,12 @@ services:
image: git.mifi.dev/mifi/mifi/auth:latest
depends_on:
- auth-service_mongo
networks:
docknet:
name: docknet
external: true
external: true
volumes:
auth-db:
external: false

View File

@@ -1,5 +1,5 @@
export const DB_HOST = process.env.DB_HOST || 'not_set';
export const DB_HOST = process.env.DB_HOST;
export const DB_PORT = process.env.DB_PORT || 27017;
export const DB_USERNAME = process.env.DB_USERNAME || 'not_set';
export const DB_PASSWORD = process.env.DB_PASSWORD || 'not_set';
export const DB_NAME = process.env.DB_NAME || 'not_set';
export const DB_USERNAME = process.env.DB_USERNAME;
export const DB_PASSWORD = process.env.DB_PASSWORD;
export const DB_NAME = process.env.DB_NAME;

View File

@@ -5,7 +5,7 @@ import { PORT } from '../constants/env';
connection.then(
() => {
app.listen(PORT);
console.log('LISTENING', process.env);
console.debug('Server up and listening', { env: process.env });
},
(err) => console.error('SERVER ERROR!', { err, env: process.env }),
(err) => console.error('Could not reach database', { err, env: process.env }),
);

View File

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