Compare commits
48 Commits
0.0.27
...
3788de2609
| Author | SHA1 | Date | |
|---|---|---|---|
|
3788de2609
|
|||
|
0f9aafe418
|
|||
|
13b90e9ee6
|
|||
|
6e19a6217d
|
|||
|
34fd4e7304
|
|||
|
5e04012aa4
|
|||
|
e8f2928543
|
|||
|
91a3b2fabf
|
|||
|
964b9a03ef
|
|||
|
bf693645d4
|
|||
|
082b4826c2
|
|||
|
e68c3002d8
|
|||
|
30d2f4a644
|
|||
|
875a45f2b8
|
|||
|
6bf7afbe09
|
|||
|
5c94dbbff5
|
|||
|
cb44eb1fab
|
|||
|
df63d7947f
|
|||
|
01a5ff907c
|
|||
|
e22e3d8bc3
|
|||
|
efecd78355
|
|||
|
ed4246ba0e
|
|||
|
4acc228fe3
|
|||
|
42279b0592
|
|||
|
e417ab64d8
|
|||
|
93b11c3a35
|
|||
|
1ef2c4919e
|
|||
|
6ff8f74317
|
|||
|
bf70ca98f3
|
|||
|
52e5befd93
|
|||
|
a047b49073
|
|||
|
59b20578bb
|
|||
|
cdd6c6a72a
|
|||
|
1d16473d2d
|
|||
|
cd2bef9811
|
|||
|
62118b6d64
|
|||
|
8290b332fb
|
|||
|
61236719f4
|
|||
|
aa699d5009
|
|||
|
9a4f9cdf4c
|
|||
|
5532fc51a9
|
|||
|
99db648a36
|
|||
|
adcab6afcb
|
|||
|
8e40c0a06c
|
|||
|
db5e4858b8
|
|||
|
d800311ae7
|
|||
|
32fdde5d90
|
|||
|
2eacdaeece
|
362
.drone.yml
362
.drone.yml
@@ -1,142 +1,147 @@
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: Test Pipeline
|
||||
# kind: pipeline
|
||||
# type: docker
|
||||
# name: Test Pipeline
|
||||
|
||||
workspace:
|
||||
path: /drone/grow
|
||||
# workspace:
|
||||
# path: /drone/grow
|
||||
|
||||
steps:
|
||||
- name: yarn install
|
||||
image: node:latest
|
||||
commands:
|
||||
- yarn install
|
||||
- name: Code Style Checks
|
||||
image: node:latest
|
||||
commands:
|
||||
- yarn prettier
|
||||
- name: Lint
|
||||
image: node:latest
|
||||
commands:
|
||||
- yarn lint
|
||||
- name: Unit Tests
|
||||
image: node:latest
|
||||
commands:
|
||||
- yarn test
|
||||
- name: Send Test Status Notification
|
||||
image: plugins/webhook
|
||||
settings:
|
||||
urls: https://lab.mifi.dev/hooks/9p65zpagctgkmndo8nwwm4199r
|
||||
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 }}] Code Quality Checks {{ build.status }} {{#success build.status}}:tada:{{else}}:poop:{{/success}}",
|
||||
"username":"DroneBot"
|
||||
}
|
||||
when:
|
||||
status:
|
||||
- success
|
||||
- failure
|
||||
- name: Build
|
||||
image: node:latest
|
||||
commands:
|
||||
- yarn build
|
||||
- name: Send Build Status Notifications
|
||||
image: plugins/webhook
|
||||
settings:
|
||||
urls: https://lab.mifi.dev/hooks/9p65zpagctgkmndo8nwwm4199r
|
||||
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 }}] Build package {{ build.status }} {{#success build.status}}:tada:{{else}}:poop:{{/success}}",
|
||||
"username":"DroneBot"
|
||||
}
|
||||
when:
|
||||
status:
|
||||
- success
|
||||
- failure
|
||||
# steps:
|
||||
# - name: yarn install
|
||||
# image: node:latest
|
||||
# commands:
|
||||
# - yarn install
|
||||
# - name: Code Style Checks
|
||||
# image: node:latest
|
||||
# commands:
|
||||
# - yarn prettier
|
||||
# - name: Lint
|
||||
# image: node:latest
|
||||
# commands:
|
||||
# - yarn lint
|
||||
# - name: Unit Tests
|
||||
# image: node:latest
|
||||
# commands:
|
||||
# - yarn test
|
||||
# - name: Send Test Status Notification
|
||||
# image: plugins/webhook
|
||||
# settings:
|
||||
# urls: https://lab.mifi.dev/hooks/9p65zpagctgkmndo8nwwm4199r
|
||||
# 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 }}] Code Quality Checks {{ build.status }} {{#success build.status}}:tada:{{else}}:poop:{{/success}}",
|
||||
# "username":"DroneBot"
|
||||
# }
|
||||
# when:
|
||||
# status:
|
||||
# - success
|
||||
# - failure
|
||||
# - name: Build
|
||||
# image: node:latest
|
||||
# commands:
|
||||
# - yarn build
|
||||
# - name: Send Build Status Notifications
|
||||
# image: plugins/webhook
|
||||
# settings:
|
||||
# urls: https://lab.mifi.dev/hooks/9p65zpagctgkmndo8nwwm4199r
|
||||
# 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 }}] Build package {{ build.status }} {{#success build.status}}:tada:{{else}}:poop:{{/success}}",
|
||||
# "username":"DroneBot"
|
||||
# }
|
||||
# when:
|
||||
# status:
|
||||
# - success
|
||||
# - failure
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- main
|
||||
event:
|
||||
- pull_request
|
||||
- push
|
||||
# trigger:
|
||||
# branch:
|
||||
# - main
|
||||
# event:
|
||||
# # - pull_request
|
||||
# - push
|
||||
|
||||
---
|
||||
# ---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: Publish Pipeline
|
||||
group: publish
|
||||
|
||||
workspace:
|
||||
path: /drone/grow
|
||||
|
||||
steps:
|
||||
- name: Build Package
|
||||
image: node:latest
|
||||
commands:
|
||||
- yarn install
|
||||
- yarn build
|
||||
- name: Publish NPM
|
||||
image: plugins/npm
|
||||
failure: ignore
|
||||
settings:
|
||||
username:
|
||||
from_secret: registry_username
|
||||
password:
|
||||
from_secret: registry_password
|
||||
registry: https://git.mifi.dev/api/packages/mifi/npm
|
||||
token:
|
||||
- from_secret: gitea_token
|
||||
volumes:
|
||||
- name: npmrc
|
||||
path: /drone/grow/.npmrc
|
||||
- name: Report NPM Publish Status
|
||||
image: plugins/webhook
|
||||
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 }} - New npm package release {{tag}} from # {{ build.number }}] Deploy {{ build.status }} {{#success build.status}}:tada:{{else}}:poop:{{/success}}",
|
||||
"username":"DroneBot"
|
||||
}
|
||||
when:
|
||||
status:
|
||||
- success
|
||||
- failure
|
||||
- name: Publish Image
|
||||
image: docker
|
||||
commands:
|
||||
- docker build -f docker-compose.staging.yml -t git.mifi.dev/mifi/mifi/auth:latest .
|
||||
- docker push git.mifi.dev/mifi/mifi/auth:latest
|
||||
volumes:
|
||||
- name: dockersock
|
||||
path: /var/run/docker.sock
|
||||
- name: dockerconfig
|
||||
path: /drone/grow/.docker/config.json
|
||||
# - name: Publish Image
|
||||
# image: plugins/docker
|
||||
# - name: Build Package
|
||||
# image: node:latest
|
||||
# commands:
|
||||
# - yarn install
|
||||
# - yarn build
|
||||
# - name: Publish NPM
|
||||
# image: node:20-alpine
|
||||
# failure: ignore
|
||||
# commands:
|
||||
# - yarn publish -t ${DRONE_TAG}
|
||||
# volumes:
|
||||
# - name: npmrc
|
||||
# path: /drone/grow/.npmrc
|
||||
# - name: Publish NPM
|
||||
# image: plugins/npm
|
||||
# failure: ignore
|
||||
# settings:
|
||||
# auto_tag: true
|
||||
# squash: true
|
||||
# repo: git.mifi.dev/mifi/auth
|
||||
# context: mifi
|
||||
# registry: git.mifi.dev
|
||||
# username:
|
||||
# from_secret: registry_username
|
||||
# password:
|
||||
# from_secret: registry_password
|
||||
# ssh-agent-key:
|
||||
# from_secret: gitea_token
|
||||
# registry: https://git.mifi.dev/api/packages/mifi/npm
|
||||
# token:
|
||||
# - from_secret: gitea_token
|
||||
# volumes:
|
||||
# - name: npmrc
|
||||
# path: /drone/grow/.npmrc
|
||||
# - name: Report NPM Publish Status
|
||||
# image: plugins/webhook
|
||||
# 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 }} - New npm package release {{tag}} from # {{ build.number }}] Deploy {{ build.status }} {{#success build.status}}:tada:{{else}}:poop:{{/success}}",
|
||||
# "username":"DroneBot"
|
||||
# }
|
||||
# when:
|
||||
# status:
|
||||
# - success
|
||||
# - failure
|
||||
- name: Publish Image
|
||||
image: docker
|
||||
failure: ignore
|
||||
commands:
|
||||
- 'echo U - $REGISTRY_USERNAME P - ${{REGISTRY_PASSWORD}}'
|
||||
- docker login -u $REGISTRY_USERNAME -p $REGISTRY_PASSWORD git.mifi.dev
|
||||
- 'docker build -t git.mifi.dev/mifi/mifi/auth:latest -t git.mifi.dev/mifi/mifi/auth:${DRONE_TAG:-latest} .'
|
||||
- docker push git.mifi.dev/mifi/mifi/auth:latest
|
||||
secrets: [registry_username, registry_password]
|
||||
volumes:
|
||||
- name: dockersock
|
||||
path: /var/run/docker.sock
|
||||
- name: dockerconfig
|
||||
path: /drone/grow/.docker/config.json
|
||||
- name: Publish Image (plugin)
|
||||
image: plugins/docker
|
||||
settings:
|
||||
auto_tag: true
|
||||
repo: git.mifi.dev/mifi/mifi/auth
|
||||
registry: git.mifi.dev
|
||||
debug: true
|
||||
# ssh-agent-key:
|
||||
# from_secret: reg_token
|
||||
# username:
|
||||
# from_secret: registry_username
|
||||
# password:
|
||||
# from_secret: registry_password
|
||||
- name: Report Image Publish Status
|
||||
image: plugins/webhook
|
||||
settings:
|
||||
@@ -164,74 +169,79 @@ volumes:
|
||||
host:
|
||||
path: /volume1/docker/beethoven/labs-auth/.npmrc
|
||||
|
||||
depends_on:
|
||||
- Test Pipeline
|
||||
# depends_on:
|
||||
# - Test Pipeline
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- main
|
||||
event:
|
||||
- push
|
||||
- tag
|
||||
# - tag
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: Deploy Pipeline
|
||||
# ---
|
||||
# kind: pipeline
|
||||
# type: docker
|
||||
# name: Deploy Pipeline
|
||||
|
||||
workspace:
|
||||
path: /drone/grow
|
||||
# workspace:
|
||||
# path: /drone/grow
|
||||
|
||||
steps:
|
||||
- name: Deploy Container
|
||||
image: docker
|
||||
privileged: true
|
||||
commands:
|
||||
- docker compose -f docker-compose.staging.yml pull
|
||||
- docker compose -f docker-compose.staging.yml build --no-cache
|
||||
- docker compose -f docker-compose.staging.yml rm --stop
|
||||
- docker compose -f docker-compose.staging.yml up --wait
|
||||
volumes:
|
||||
- name: env
|
||||
path: /drone/grow/staging.env
|
||||
- name: dockersock
|
||||
path: /var/run/docker.sock
|
||||
- name: dockerconfig
|
||||
path: /drone/grow/.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
|
||||
# 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.yml pull
|
||||
# - docker compose -f docker-compose.staging.yml build --no-cache
|
||||
# - docker compose -f docker-compose.staging.yml rm --stop
|
||||
# - docker compose -f docker-compose.staging.yml up --wait
|
||||
# volumes:
|
||||
# - name: env-secrets
|
||||
# path: /drone/grow/staging.env
|
||||
# - name: dockersock
|
||||
# path: /var/run/docker.sock
|
||||
# - name: dockerconfig
|
||||
# path: /drone/grow/.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
|
||||
host:
|
||||
path: /volume1/docker/beethoven/labs-auth/staging.env
|
||||
# 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
|
||||
# # depends_on:
|
||||
# # - Test Pipeline
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- main
|
||||
event:
|
||||
- push
|
||||
- tag
|
||||
# trigger:
|
||||
# branch:
|
||||
# - main
|
||||
# event:
|
||||
# - push
|
||||
# # - tag
|
||||
|
||||
@@ -27,5 +27,3 @@ RESET_VALID_MINUTES=15
|
||||
DEFAULT_TOKEN_DAYS=1
|
||||
|
||||
CONTAINER_PREFIX=dev
|
||||
SERVICE_NAME=auth-service
|
||||
DB_TYPE=mongo
|
||||
18
Dockerfile
18
Dockerfile
@@ -1,13 +1,3 @@
|
||||
# FROM node:20-alpine AS build
|
||||
# RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
|
||||
# WORKDIR /home/node/app
|
||||
# COPY package*.json .
|
||||
# COPY dist/lib .
|
||||
# USER node
|
||||
# RUN yarn install --frozen-lockfile --production
|
||||
# COPY --chown=node:node node_modules ./node_modules
|
||||
# CMD ["node", "dist/lib/server/index.js"]
|
||||
|
||||
FROM node:20-alpine AS build
|
||||
WORKDIR /home/node/app
|
||||
COPY package*.json ./
|
||||
@@ -15,14 +5,14 @@ COPY tsconfig.json ./
|
||||
COPY lib ./lib
|
||||
RUN ls -a
|
||||
RUN yarn install
|
||||
RUN yarn build:production
|
||||
RUN yarn build
|
||||
|
||||
## this is stage two , where the app actually runs
|
||||
FROM node:20-alpine AS containerize
|
||||
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 9001
|
||||
EXPOSE 27017
|
||||
COPY --from=0 /home/node/app/dist/**/*.js .
|
||||
EXPOSE ${PORT}
|
||||
CMD ["node","server/index.js"]
|
||||
|
||||
@@ -2,7 +2,10 @@ version: '3.8'
|
||||
|
||||
services:
|
||||
auth-service_mongo:
|
||||
env_file: dev.env
|
||||
env_file: .env.dev
|
||||
build:
|
||||
args:
|
||||
- CONTAINER_PREFIX=${CONTAINER_PREFIX}
|
||||
container_name: ${CONTAINER_PREFIX:-dev}-auth-service_mongo
|
||||
ports:
|
||||
- 27017:27017
|
||||
@@ -14,8 +17,14 @@ services:
|
||||
restart: unless-stopped
|
||||
image: mongo:latest
|
||||
auth-service:
|
||||
env_file: dev.env
|
||||
build: .
|
||||
env_file: .env.dev
|
||||
build:
|
||||
context: .
|
||||
args:
|
||||
- HOST=${HOST}
|
||||
- PORT=${PORT}
|
||||
- ROUTE_PREFIX=${ROUTE_PREFIX}
|
||||
- CONTAINER_PREFIX=${CONTAINER_PREFIX}
|
||||
container_name: ${CONTAINER_PREFIX:-dev}-auth-service
|
||||
ports:
|
||||
- 9001:9001
|
||||
|
||||
@@ -2,20 +2,23 @@ version: '3.8'
|
||||
|
||||
services:
|
||||
auth-service_mongo:
|
||||
container_name: ${CONTAINER_PREFIX:-mifi}-auth-service_mongo
|
||||
env_file: staging.env
|
||||
container_name: ${CONTAINER_PREFIX}-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
|
||||
restart: unless-stopped
|
||||
image: mongo:latest
|
||||
auth-service:
|
||||
env_file: staging.env
|
||||
env_file:
|
||||
- staging.env
|
||||
build: .
|
||||
container_name: ${CONTAINER_PREFIX:-mifi}-auth-service
|
||||
container_name: ${CONTAINER_PREFIX}-auth-service
|
||||
environment:
|
||||
- DB_HOST=${CONTAINER_PREFIX:-mifi}-auth-service_mongo
|
||||
- DB_HOST=${CONTAINER_PREFIX}-auth-service_mongo
|
||||
labels:
|
||||
- 'traefik.enable=true'
|
||||
- 'traefik.http.routers.grow.rule=Host(`${HOST}`) && Path(`${ROUTE_PREFIX}`)'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@mifi/auth",
|
||||
"version": "0.0.27",
|
||||
"version": "0.0.34",
|
||||
"author": "mifi (Mike Fitzpatrick)",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user