Compare commits
60 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
995dd9a015
|
|||
|
5b0c9ba72d
|
|||
|
d745869cc0
|
|||
|
e6389d8b9b
|
|||
|
47f1bdf485
|
|||
|
bc96664b7c
|
|||
|
04ec6e2de3
|
|||
|
ba31f4b8be
|
|||
|
d5f9bc4d05
|
|||
|
ad9ffc89b5
|
|||
|
f482750d08
|
|||
|
7b77df0c4c
|
|||
|
8ee5d627aa
|
|||
|
775dd60b56
|
|||
|
b3365607c5
|
|||
|
96058995be
|
|||
|
1d43b78590
|
|||
|
243682758a
|
|||
|
695c4d84e8
|
|||
|
25908dd9d7
|
|||
|
34a28b8134
|
|||
|
7e1f9a1f33
|
|||
|
f0ba205a58
|
|||
|
1a717cd83e
|
|||
|
1e932d97c8
|
|||
|
d879de2a6b
|
|||
|
34e3eb04af
|
|||
|
ff5f88588e
|
|||
|
ac5c09b7da
|
|||
|
d1b42fe79f
|
|||
|
3d32c77bd1
|
|||
|
8e077810f5
|
|||
|
5e0621e37d
|
|||
|
e6f9f9b523
|
|||
|
1c5fdabca6
|
|||
|
7bbb4bb036
|
|||
|
159f87d07e
|
|||
|
244db86113
|
|||
|
00d9a4f734
|
|||
|
b7a3c12eff
|
|||
|
8e263d7ace
|
|||
|
641cbcfd47
|
|||
|
8af84d42e5
|
|||
|
d31a47f46c
|
|||
|
ddb8ad0948
|
|||
|
73cb0c23f5
|
|||
|
59738f5711
|
|||
|
f3ff19098b
|
|||
|
8bc852fa7d
|
|||
|
8e06b98695
|
|||
|
809255baa6
|
|||
|
21e80ca883
|
|||
|
cfb7c7e453
|
|||
|
82498e7714
|
|||
|
87a611459a
|
|||
|
0a09208766
|
|||
|
99ce364dc4
|
|||
|
2daa33f3ac
|
|||
|
2814c6820b
|
|||
|
d9cafe009d
|
150
.drone.yml
150
.drone.yml
@@ -10,23 +10,19 @@ steps:
|
|||||||
image: node:latest
|
image: node:latest
|
||||||
commands:
|
commands:
|
||||||
- yarn install
|
- yarn install
|
||||||
|
|
||||||
- name: Code Style Checks
|
- name: Code Style Checks
|
||||||
image: node:latest
|
image: node:latest
|
||||||
commands:
|
commands:
|
||||||
- yarn prettier
|
- yarn prettier
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
image: node:latest
|
image: node:latest
|
||||||
commands:
|
commands:
|
||||||
- yarn lint
|
- yarn lint
|
||||||
|
|
||||||
- name: Unit Tests
|
- name: Unit Tests
|
||||||
image: node:latest
|
image: node:latest
|
||||||
commands:
|
commands:
|
||||||
- yarn test
|
- yarn test
|
||||||
|
- name: Send Test Status Notification
|
||||||
- name: Send Status Notification
|
|
||||||
image: plugins/webhook
|
image: plugins/webhook
|
||||||
settings:
|
settings:
|
||||||
urls: https://lab.mifi.dev/hooks/9p65zpagctgkmndo8nwwm4199r
|
urls: https://lab.mifi.dev/hooks/9p65zpagctgkmndo8nwwm4199r
|
||||||
@@ -41,34 +37,14 @@ steps:
|
|||||||
status:
|
status:
|
||||||
- success
|
- success
|
||||||
- failure
|
- failure
|
||||||
|
|
||||||
trigger:
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: Build Pipeline
|
|
||||||
|
|
||||||
workspace:
|
|
||||||
path: /drone/grow
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: yarn install
|
|
||||||
image: node:latest
|
|
||||||
commands:
|
|
||||||
- yarn install
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
image: node:latest
|
image: node:latest
|
||||||
commands:
|
commands:
|
||||||
- yarn build
|
- yarn build
|
||||||
|
- name: Send Build Status Notifications
|
||||||
- name: Send Status Notifications
|
|
||||||
image: plugins/webhook
|
image: plugins/webhook
|
||||||
settings:
|
settings:
|
||||||
urls: https://lab.mifi.dev/hooks/ccw34hdf7tgbjmzp96nptn938r
|
urls: https://lab.mifi.dev/hooks/9p65zpagctgkmndo8nwwm4199r
|
||||||
content_type: application/json
|
content_type: application/json
|
||||||
template: |
|
template: |
|
||||||
{
|
{
|
||||||
@@ -81,54 +57,43 @@ steps:
|
|||||||
- success
|
- success
|
||||||
- failure
|
- failure
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- Test Pipeline
|
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
branch:
|
||||||
- main
|
- main
|
||||||
event:
|
event:
|
||||||
|
- pull_request
|
||||||
- push
|
- push
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: Publish Pipeline
|
name: Publish Pipeline
|
||||||
|
group: publish
|
||||||
|
|
||||||
workspace:
|
workspace:
|
||||||
path: /drone/grow
|
path: /drone/grow
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Build Service
|
- name: Build Package
|
||||||
image: node:latest
|
image: node:latest
|
||||||
commands:
|
commands:
|
||||||
- cp /drone/grow/package.json ./
|
- yarn install
|
||||||
- cp /drone/grow/yarn.lock ./
|
|
||||||
- yarn install --frozen-lockfile
|
|
||||||
- cp -r /drone/grow/* .
|
|
||||||
- yarn build
|
- yarn build
|
||||||
- name: Publish NPM
|
- name: Publish NPM
|
||||||
image: plugins/npm
|
image: plugins/npm
|
||||||
|
failure: ignore
|
||||||
settings:
|
settings:
|
||||||
username: mifi
|
username:
|
||||||
registry: git.mifi.dev
|
from_secret: registry_username
|
||||||
|
password:
|
||||||
|
from_secret: registry_password
|
||||||
|
registry: https://git.mifi.dev/api/packages/mifi/npm
|
||||||
token:
|
token:
|
||||||
- from_secret: gitea_token
|
- from_secret: gitea_token
|
||||||
- name: Publish Image
|
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
|
||||||
auto_tag: true
|
|
||||||
squash: true
|
|
||||||
repo: git.mifi.dev/mifi/auth
|
|
||||||
registry: git.mifi.dev
|
|
||||||
ssh-agent-key:
|
|
||||||
from_secret: gitea_token
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: dockersock
|
- name: npmrc
|
||||||
Path: /var/run/docker.sock
|
path: /drone/grow/.npmrc
|
||||||
- name: dockerconfig
|
- name: Report NPM Publish Status
|
||||||
Path: /.docker/config.json
|
|
||||||
- name: Send Status Notifications
|
|
||||||
image: plugins/webhook
|
image: plugins/webhook
|
||||||
settings:
|
settings:
|
||||||
urls: https://lab.mifi.dev/hooks/ccw34hdf7tgbjmzp96nptn938r
|
urls: https://lab.mifi.dev/hooks/ccw34hdf7tgbjmzp96nptn938r
|
||||||
@@ -136,7 +101,41 @@ steps:
|
|||||||
template: |
|
template: |
|
||||||
{
|
{
|
||||||
"icon_url":"https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/apple/198/freezing-face_1f976.png",
|
"icon_url":"https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/apple/198/freezing-face_1f976.png",
|
||||||
"text": "[{{ repo.name }} - New tagged docker image release {{tag}} from # {{ build.number }}] Deploy {{ build.status }} {{#success build.status}}:tada:{{else}}:poop:{{/success}}",
|
"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: plugins/docker
|
||||||
|
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
|
||||||
|
volumes:
|
||||||
|
- name: dockersock
|
||||||
|
path: /var/run/docker.sock
|
||||||
|
- name: dockerconfig
|
||||||
|
path: /drone/grow/.docker/config.json
|
||||||
|
- name: Report Image 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 docker image release {{tag}} from # {{ build.number }}] Deploy {{ build.status }} {{#success build.status}}:tada:{{else}}:poop:{{/success}}",
|
||||||
"username":"DroneBot"
|
"username":"DroneBot"
|
||||||
}
|
}
|
||||||
when:
|
when:
|
||||||
@@ -145,18 +144,24 @@ steps:
|
|||||||
- failure
|
- failure
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: dockersock
|
|
||||||
path: /var/run/docker.sock
|
|
||||||
- name: dockerconfig
|
- name: dockerconfig
|
||||||
path: /volume1/docker/labs/grow-auth/dockerconfig.json
|
host:
|
||||||
|
path: /volume1/docker/dockerconfig.json
|
||||||
|
- name: dockersock
|
||||||
|
host:
|
||||||
|
path: /var/run/docker.sock
|
||||||
|
- name: npmrc
|
||||||
|
host:
|
||||||
|
path: /volume1/docker/beethoven/labs-auth/.npmrc
|
||||||
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- Build Pipeline
|
- Test Pipeline
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
branch:
|
||||||
- main
|
- main
|
||||||
event:
|
event:
|
||||||
|
- push
|
||||||
- tag
|
- tag
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -167,24 +172,25 @@ name: Deploy Pipeline
|
|||||||
workspace:
|
workspace:
|
||||||
path: /drone/grow
|
path: /drone/grow
|
||||||
|
|
||||||
# image_pull_secrets:
|
|
||||||
# - from_secret: gitea_token
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Deploy Container
|
- name: Deploy Container
|
||||||
image: docker
|
image: docker
|
||||||
|
privileged: true
|
||||||
commands:
|
commands:
|
||||||
- compose build .
|
- docker compose pull
|
||||||
- compose up --wait
|
- docker compose build --no-cache
|
||||||
|
- docker compose rm --stop
|
||||||
|
- docker compose up --wait
|
||||||
volumes:
|
volumes:
|
||||||
- name: env
|
- name: env
|
||||||
path: /.env
|
path: /drone/grow/.env
|
||||||
- name: dockersock
|
- name: dockersock
|
||||||
Path: /var/run/docker.sock
|
path: /var/run/docker.sock
|
||||||
- name: dockerconfig
|
- name: dockerconfig
|
||||||
Path: /.docker/config.json
|
path: /drone/grow/.docker/config.json
|
||||||
- name: Send Status Notifications
|
- name: Send Status Notifications
|
||||||
image: plugins/webhook
|
image: plugins/webhook
|
||||||
|
privileged: true
|
||||||
settings:
|
settings:
|
||||||
urls: https://lab.mifi.dev/hooks/ccw34hdf7tgbjmzp96nptn938r
|
urls: https://lab.mifi.dev/hooks/ccw34hdf7tgbjmzp96nptn938r
|
||||||
content_type: application/json
|
content_type: application/json
|
||||||
@@ -200,18 +206,22 @@ steps:
|
|||||||
- failure
|
- failure
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: env
|
|
||||||
path: /volume1/docker/labs/grow-auth/.env
|
|
||||||
- name: dockersock
|
|
||||||
path: /var/run/docker.sock
|
|
||||||
- name: dockerconfig
|
- name: dockerconfig
|
||||||
path: /volume1/docker/labs/grow-auth/dockerconfig.json
|
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
|
||||||
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- Build Pipeline
|
- Test Pipeline
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
branch:
|
||||||
- main
|
- main
|
||||||
event:
|
event:
|
||||||
|
- push
|
||||||
- tag
|
- tag
|
||||||
|
|||||||
@@ -23,5 +23,4 @@ WORKDIR /home/node/app
|
|||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN yarn install --frozen-lockfile --production
|
RUN yarn install --frozen-lockfile --production
|
||||||
COPY --from=0 /home/node/app/dist .
|
COPY --from=0 /home/node/app/dist .
|
||||||
EXPOSE 80
|
|
||||||
CMD ["node","server/index.js"]
|
CMD ["node","server/index.js"]
|
||||||
|
|||||||
25
dev.env
Normal file
25
dev.env
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
HOST=localhost
|
||||||
|
PORT=9001
|
||||||
|
|
||||||
|
ROUTE_PREFIX=/auth
|
||||||
|
|
||||||
|
LOGIN_ROUTE=/login
|
||||||
|
RESET_ROUTE=/reset
|
||||||
|
|
||||||
|
DB_USERNAME=user
|
||||||
|
DB_PASSWORD=password
|
||||||
|
DB_NAME=auth
|
||||||
|
|
||||||
|
SESSION_KEY=shjhakjfhfjdshjksdhfdshfhfduyeyb73te4
|
||||||
|
|
||||||
|
JWT_AUDIENCE=Grow.io
|
||||||
|
JWT_ISSUER=Grow Latch
|
||||||
|
JWT_SECRET='Th!sIs a d3v3lopm3nt server $#cr¢T.'
|
||||||
|
|
||||||
|
LOGIN_VALID_TIME=12H
|
||||||
|
RESET_VALID_MINUTES=15
|
||||||
|
DEFAULT_TOKEN_DAYS=1
|
||||||
|
|
||||||
|
CONTAINER_PREFIX=sso
|
||||||
|
SERVICE_NAME=auth-service
|
||||||
|
DB_TYPE=mongo
|
||||||
@@ -2,29 +2,31 @@ version: '3.8'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
auth-service_mongo:
|
auth-service_mongo:
|
||||||
container_name: ${CONTAINER_PREFIX}${SERVICE_NAME}_${DB_TYPE}
|
container_name: ${CONTAINER_PREFIX}-auth-service_mongo
|
||||||
|
env_file: .env
|
||||||
environment:
|
environment:
|
||||||
- ALLOW_EMPTY_PASSWORD=yes
|
- ALLOW_EMPTY_PASSWORD=yes
|
||||||
- MONGO_INITDB_ROOT_USERNAME=${DB_USER}
|
- MONGO_INITDB_ROOT_USERNAME=${DB_USERNAME}
|
||||||
- MONGO_INITDB_ROOT_PASSWORD=${DB_PASS}
|
- MONGO_INITDB_ROOT_PASSWORD=${DB_PASSWORD}
|
||||||
- MONGO_INITDB_DATABASE=${DB_NAME}
|
- MONGO_INITDB_DATABASE=${DB_NAME}
|
||||||
networks:
|
networks:
|
||||||
- docknet
|
- docknet
|
||||||
volumes:
|
volumes:
|
||||||
- '/volume1/docker/labs/grow-auth/mongo:/data/db'
|
- '/volume1/docker/labs/auth/mongo:/data/db'
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
image: mongo
|
image: mongo
|
||||||
auth-service:
|
auth-service:
|
||||||
|
env_file: .env
|
||||||
build: .
|
build: .
|
||||||
container_name: ${CONTAINER_PREFIX}-${SERVICE_NAME}
|
container_name: ${CONTAINER_PREFIX}-auth-service
|
||||||
environment:
|
environment:
|
||||||
- PORT=${PORT}
|
- PORT=${PORT}
|
||||||
- ROUTE_PREFIX=${ROUTE_PREFIX}
|
- ROUTE_PREFIX=${ROUTE_PREFIX}
|
||||||
- LOGIN_ROUTE=${LOGIN_ROUTE}
|
- LOGIN_ROUTE=${LOGIN_ROUTE}
|
||||||
- RESET_ROUTE=${RESET_ROUTE}
|
- RESET_ROUTE=${RESET_ROUTE}
|
||||||
- DB_HOST=${CONTAINER_PREFIX}-${SERVICE_NAME}_${DB_TYPE}
|
- DB_HOST=${CONTAINER_PREFIX}-auth-service_mongo
|
||||||
- DB_USER=${DB_USER}
|
- DB_USERNAME=${DB_USERNAME}
|
||||||
- DB_PASS=${DB_PASS}
|
- DB_PASSWORD=${DB_PASSWORD}
|
||||||
- DB_NAME=${DB_NAME}
|
- DB_NAME=${DB_NAME}
|
||||||
- SESSION_KEY=${SESSION_KEY}
|
- SESSION_KEY=${SESSION_KEY}
|
||||||
- JWT_AUDIENCE=${JWT_AUDIENCE}
|
- JWT_AUDIENCE=${JWT_AUDIENCE}
|
||||||
@@ -35,20 +37,18 @@ services:
|
|||||||
- DEFAULT_TOKEN_DAYS=${DEFAULT_TOKEN_DAYS}
|
- DEFAULT_TOKEN_DAYS=${DEFAULT_TOKEN_DAYS}
|
||||||
labels:
|
labels:
|
||||||
- 'traefik.enable=true'
|
- 'traefik.enable=true'
|
||||||
- 'traefik.http.routers.grow.rule=Host(`${HOST}`)'
|
- 'traefik.http.routers.grow.rule=Host(`${HOST}`) && Path(`${ROUTE_PREFIX}`)'
|
||||||
- 'traefik.http.routers.grow.rule=Path(`${ROUTE_PREFIX}`)'
|
|
||||||
- 'traefik.http.routers.grow.entrypoints=websecure'
|
- 'traefik.http.routers.grow.entrypoints=websecure'
|
||||||
- 'traefik.http.routers.grow.tls=true'
|
- 'traefik.http.routers.grow.tls=true'
|
||||||
- 'traefik.http.routers.grow.tls.certresolver=letsencrypt'
|
- 'traefik.http.routers.grow.tls.certresolver=letsencrypt'
|
||||||
- 'traefik.http.routers.grow.service=gitea'
|
- 'traefik.http.routers.grow.service=grow-service'
|
||||||
- 'traefik.http.services.gitea.loadbalancer.server.port=${PORT}'
|
- 'traefik.http.services.grow-service.loadbalancer.server.port=${PORT}'
|
||||||
networks:
|
networks:
|
||||||
- docknet
|
- docknet
|
||||||
volumes:
|
|
||||||
- '/Volume1/docker/.yarnrc.yml:/.yarnrc.yml'
|
|
||||||
- '/Volume1/docker/labs/grow-auth/.env:/.env'
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
image: node
|
image: node
|
||||||
|
links:
|
||||||
|
- auth-service_mongo:${CONTAINER_PREFIX}-auth-service_mongo
|
||||||
depends_on:
|
depends_on:
|
||||||
- auth-service_mongo
|
- auth-service_mongo
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export const DB_HOST = process.env.DB_HOST || 'mongodb';
|
export const DB_HOST = process.env.DB_HOST || 'mongodb';
|
||||||
export const DB_PORT = process.env.DB_PORT || 27017;
|
export const DB_PORT = process.env.DB_PORT || 27017;
|
||||||
export const DB_USER = process.env.DB_USER || 'test';
|
export const DB_USERNAME = process.env.DB_USERNAME || 'test';
|
||||||
export const DB_PASS = process.env.DB_PASSWORD || 'test';
|
export const DB_PASSWORD = process.env.DB_PASSWORD || 'test';
|
||||||
export const DB_NAME = process.env.DB_NAME || 'auth';
|
export const DB_NAME = process.env.DB_NAME || 'auth';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import mongoose from 'mongoose';
|
import mongoose from 'mongoose';
|
||||||
|
|
||||||
import { DB_HOST, DB_NAME, DB_PASS, DB_PORT, DB_USER } from '../constants/db';
|
import { DB_HOST, DB_NAME, DB_PASSWORD, DB_PORT, DB_USERNAME } from '../constants/db';
|
||||||
|
|
||||||
export const connection = mongoose.connect(`mongodb://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}`);
|
export const connection = mongoose.connect(`mongodb://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}`);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@mifi/auth",
|
"name": "@mifi/auth",
|
||||||
"version": "0.0.6",
|
"version": "0.0.24",
|
||||||
"author": "mifi (Mike Fitzpatrick)",
|
"author": "mifi (Mike Fitzpatrick)",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -80,5 +80,6 @@
|
|||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.mifi.dev/mifi/auth.git"
|
"url": "https://git.mifi.dev/mifi/auth.git"
|
||||||
}
|
},
|
||||||
|
"registry": "https://git.mifi.dev"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user