14 Commits

Author SHA1 Message Date
d745869cc0 Last bits to make it whole again...
Some checks are pending
continuous-integration/drone/push Build is running
2023-05-05 11:10:13 -04:00
e6389d8b9b More tweaks... 2023-05-05 11:05:18 -04:00
47f1bdf485 More path fixes...
Some checks failed
continuous-integration/drone/push Build is failing
2023-05-05 10:56:33 -04:00
bc96664b7c Path fixes ... and the dumbest environment error yet...
Some checks are pending
continuous-integration/drone/push Build is running
2023-05-05 10:53:42 -04:00
04ec6e2de3 Hmmmm
Some checks failed
continuous-integration/drone/push Build encountered an error
2023-05-05 10:42:22 -04:00
ba31f4b8be More changes
Some checks failed
continuous-integration/drone/push Build encountered an error
2023-05-05 10:01:42 -04:00
d5f9bc4d05 fix bad commands
Some checks failed
continuous-integration/drone/push Build encountered an error
2023-05-05 09:20:14 -04:00
ad9ffc89b5 With links and fixed names...
Some checks failed
continuous-integration/drone/push Build encountered an error
2023-05-05 09:09:06 -04:00
f482750d08 this may break everything...
Some checks failed
continuous-integration/drone/push Build encountered an error
2023-05-05 08:47:54 -04:00
7b77df0c4c v0.0.13 - fixed triggers perhaps...
Some checks failed
continuous-integration/drone/push Build encountered an error
2023-05-05 08:32:17 -04:00
8ee5d627aa Resolving stupid errors
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-05 08:21:02 -04:00
775dd60b56 Mostly passing pipelines, still a broken deploy... 2023-05-05 08:19:29 -04:00
b3365607c5 Muahahahha 2023-05-04 23:28:40 -04:00
96058995be New approach...
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-04 23:19:45 -04:00
8 changed files with 65 additions and 58 deletions

View File

@@ -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,13 +57,11 @@ steps:
- success - success
- failure - failure
depends_on:
- Test Pipeline
trigger: trigger:
branch: branch:
- main - main
event: event:
- pull_request
- push - push
--- ---
@@ -100,7 +74,7 @@ workspace:
path: /drone/grow path: /drone/grow
steps: steps:
- name: Build Service - name: Build Package
image: node:latest image: node:latest
commands: commands:
- yarn install - yarn install
@@ -117,7 +91,8 @@ steps:
token: token:
- from_secret: gitea_token - from_secret: gitea_token
volumes: volumes:
- name: yarnrc - name: npmrc
path: /drone/grow/.npmrc
- name: Report NPM Publish Status - name: Report NPM Publish Status
image: plugins/webhook image: plugins/webhook
settings: settings:
@@ -175,15 +150,18 @@ volumes:
- name: dockersock - name: dockersock
host: host:
path: /var/run/docker.sock path: /var/run/docker.sock
- name: yarnrc - name: npmrc
host: host:
path: /volume1/docker/.yarnrc.yml path: /volume1/docker/beethoven/labs-auth/.npmrc
depends_on: depends_on:
- Build Pipeline - Test Pipeline
trigger: trigger:
branch:
- main
event: event:
- push
- tag - tag
--- ---
@@ -199,7 +177,9 @@ steps:
image: docker image: docker
privileged: true privileged: true
commands: commands:
- docker compose pull
- docker compose build --no-cache - docker compose build --no-cache
- docker compose rm --stop
- docker compose up --wait - docker compose up --wait
volumes: volumes:
- name: env - name: env
@@ -234,11 +214,14 @@ volumes:
path: /var/run/docker.sock path: /var/run/docker.sock
- name: env - name: env
host: host:
path: /volume1/docker/labs/grow-auth/.env path: /volume1/docker/beethoven/labs-auth/staging.env
depends_on: depends_on:
- Build Pipeline - Test Pipeline
trigger: trigger:
branch:
- main
event: event:
- push
- tag - tag

3
.npmrc
View File

@@ -1,3 +0,0 @@
@mifi:registry=https://git.mifi.dev/api/packages/mifi/npm
//git.mifi.dev/api/packages/mifi/npm/:_authToken=${NPM_TOKEN}
@mifi/grow:registry=https://git.mifi.dev

View File

@@ -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
View 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

View File

@@ -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:package}-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:package}-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:package}-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,17 +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
restart: unless-stopped restart: unless-stopped
image: node image: node
links:
- auth-service_mongo:${CONTAINER_PREFIX:package}-auth-service_mongo
depends_on: depends_on:
- auth-service_mongo - auth-service_mongo
networks: networks:

View File

@@ -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';

View File

@@ -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}`);

View File

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