Skip to content

Commit

Permalink
Release 1.4.0: 2.0.0 Feature Flag Off (#216)
Browse files Browse the repository at this point in the history
* 2.0.0 draft1

* remove pycache

* clean assets dir

* ignore vscode settings

* getting ready to deploy 1.4.0

* testing production build

* ready to deploy 1.4.0

* updated codecov config

* add a test for disabled feature flag
  • Loading branch information
amthorn authored Oct 25, 2021
1 parent ef75dce commit d2fd9b7
Show file tree
Hide file tree
Showing 227 changed files with 43,619 additions and 46 deletions.
47 changes: 45 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,54 @@ jobs:
uses: CultureHQ/actions-yarn@master
with:
args: --cwd services/bot install
- name: Build and publish Docker Image to GitHub Packages Registry
- name: Build and publish qutex_bot
uses: VaultVulp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
image-name: qutex_bot
extract-git-tag: true
build-context: ./services/bot
dockerfile: ./services/bot/Dockerfile
dockerfile: ./services/bot/Dockerfile
- name: Build and publish qutex_nginx
uses: VaultVulp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
image-name: qutex_nginx
extract-git-tag: true
build-context: ./services/nginx
dockerfile: ./services/nginx/Dockerfile
- name: Build and publish qutex_ui
uses: VaultVulp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
image-name: qutex_ui
extract-git-tag: true
build-context: ./services/ui
dockerfile: ./services/ui/Dockerfile
- name: Build and publish qutex_projects
uses: VaultVulp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
image-name: qutex_projects
extract-git-tag: true
build-context: .
dockerfile: ./services/_api_service_template/Dockerfile
custom-args: --build-arg SERVICE_PREFIX=projects
- name: Build and publish qutex_users
uses: VaultVulp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
image-name: qutex_users
extract-git-tag: true
build-context: .
dockerfile: ./services/_api_service_template/Dockerfile
custom-args: --build-arg SERVICE_PREFIX=users
- name: Build and publish qutex_auth
uses: VaultVulp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
image-name: qutex_auth
extract-git-tag: true
build-context: .
dockerfile: ./services/_api_service_template/Dockerfile
custom-args: --build-arg SERVICE_PREFIX=auth
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ coverage/
.DS_Store
site/
secrets
*.pyc
__pycache__/
.vscode
.version.env

# Jekyll
docs/_site
Expand Down
13 changes: 13 additions & 0 deletions .local.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
AUTH_SERVICE_TOKEN_CHECK_ROUTE=/api/v1/auth/token/check
AUTH_SERVICE_HOST=http://auth:4000
FLASK_ENV=development
FQDN=http://localhost
NODE_ENV=development

# UI
DANGEROUSLY_DISABLE_HOST_CHECK=true
HOST=0.0.0.0
PORT=3000

# FEATURE FLAGS
BOT_2_0_0=true
15 changes: 15 additions & 0 deletions .production.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
AUTH_SERVICE_TOKEN_CHECK_ROUTE=/api/v1/auth/token/check
AUTH_SERVICE_HOST=http://auth:4000
FLASK_ENV=production
FQDN=https://qutexbot.com
NODE_ENV=production
AUTHOR_NAME=Ava Thorn
AUTHOR_EMAIL=[email protected]
DEBUG_EMAIL=[email protected]
SUPER_ADMINS=["Y2lzY29zcGFyazovL3VzL1BFT1BMRS9kODRkZjI1MS1iYmY3LTRlZTEtOTM1OS00Y2I0MGIyOTBhN2I"]
MONGO_INITDB_ROOT_USERNAME=root
MONGO_INITDB_DATABASE=qutex
MONGO_INITDB_ROOT_PASSWORD_FILE=/run/secrets/mongoPassword

# FEATURE FLAGS
BOT_2_0_0=false
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ build:
.PHONY: up
up:
docker compose -f docker-compose.yml -f docker-compose.dev.yml up --build -d
yarn --cwd services/bot start:dev-bot

.PHONY: deploy $(VERSION)
deploy:
Expand All @@ -28,4 +27,6 @@ test:
.PHONY: lint
lint:
yarn --cwd services/bot lint
yarn --cwd services/ui lint
docker run -it -v $(PWD)services:/apps/services alpine/flake8 /apps

11 changes: 6 additions & 5 deletions bin/deploy_stack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ today=$(date +"%b %d, %Y")
# Deploy the docs to docs.qutexbot.com
mkdocs gh-deploy

export QUTEX_RELEASE_DATE="$today"
export QUTEX_VERSION=$1
export QUTEX_IMAGE=docker.pkg.github.com/amthorn/qutex/qutex_bot:${QUTEX_VERSION}
QUTEX_RELEASE_DATE="$today"
QUTEX_VERSION=$1

echo "
Release Date: ${QUTEX_RELEASE_DATE}
Version: ${QUTEX_VERSION}
Image: ${QUTEX_IMAGE}
"

read -p "Press enter to continue"

docker --context qutex stack deploy --with-registry-auth qutex -c docker-compose.yml
echo "QUTEX_RELEASE_DATE=${QUTEX_RELEASE_DATE}
QUTEX_VERSION=${QUTEX_VERSION}" > .version.env

env QUTEX_VERSION="${QUTEX_VERSION}" docker --context qutex stack deploy --with-registry-auth qutex -c docker-compose.yml
2 changes: 2 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ coverage:
status:
project:
default:
paths:
- servies/bot
target: auto
76 changes: 72 additions & 4 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,92 @@
version: '3.9'
x-env_files: &env_files
- .local.env
- .version.env
x-interactive: &interactive
tty: true
stdin_open: true
services:
nginx:
image: qutex_nginx:latest
build:
context: services/nginx
bot:
<<: *interactive
image: qutex_bot:latest
build:
context: ./services/bot
command: start:dev
tty: true
environment:
NODE_ENV: development
env_file: *env_files
volumes:
- ./services/bot:/app
- ./services/bot/tsconfig.json:/app/tsconfig.json
- ./services/bot/package.json:/app/package.json
ui:
<<: *interactive
image: qutex_ui:latest
build:
context: services/ui/
args:
DEVELOPMENT: "true"
env_file: *env_files
volumes:
- ./services/ui/src:/qutex/src
- ./services/ui/public:/qutex/public
- compiled_css:/qutex/src/assets/css
projects:
<<: *interactive
image: qutex_projects:latest
build:
context: .
dockerfile: services/_api_service_template/Dockerfile
args:
SERVICE_PREFIX: projects
env_file: *env_files
volumes:
- ./services/projects/api:/projects/api
- ./services/projects/documents:/projects/documents
users:
<<: *interactive
image: qutex_users:latest
build:
context: .
dockerfile: services/_api_service_template/Dockerfile
args:
SERVICE_PREFIX: users
env_file: *env_files
volumes:
- ./services/users/api:/users/api
- ./services/users/documents:/users/documents
auth:
<<: *interactive
image: qutex_auth:latest
build:
context: .
dockerfile: services/_api_service_template/Dockerfile
args:
SERVICE_PREFIX: auth
env_file: *env_files
volumes:
- ./services/auth/api:/auth/api
- ./services/auth/documents:/auth/documents
migrate:
image: qutex_bot:latest
build:
context: ./services/bot
env_file: *env_files
mongo:
env_file: *env_files
ports:
- 27017:27017
volumes:
# ignore all css from the docker container and do not mount to my local dir
# This is because the CSS files shouldn't be modified. Only the sass files
# So no need to store them locally.
compiled_css:
secrets:
token:
file: secrets/local/token
mongoPassword:
file: secrets/local/mongoPassword
file: secrets/local/mongoPassword
privateKey:
file: secrets/local/privateKey
89 changes: 61 additions & 28 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,84 @@
version: '3.9'
x-env_files: &env_files
- .production.env
- .version.env
x-common: &common
restart: always
env_file: *env_files
services:
nginx:
<<: *common
image: docker.pkg.github.com/amthorn/qutex/qutex_nginx:${QUTEX_VERSION:-latest}
depends_on:
- web
- auth
- projects
ports:
- 80:80
bot:
image: ${QUTEX_IMAGE:-qutex_bot:latest}
restart: always
<<: *common
image: docker.pkg.github.com/amthorn/qutex/qutex_bot:${QUTEX_VERSION:-latest}
depends_on:
- mongo
ports:
- target: 3000
published: 80
published: 3000
mode: host
environment:
NODE_ENV: production
VERSION: ${QUTEX_VERSION}
RELEASE_DATE: ${QUTEX_RELEASE_DATE}
AUTHOR_NAME: Ava Thorn
AUTHOR_EMAIL: [email protected]
DEBUG_EMAIL: [email protected]
SUPER_ADMINS: '["Y2lzY29zcGFyazovL3VzL1BFT1BMRS9kODRkZjI1MS1iYmY3LTRlZTEtOTM1OS00Y2I0MGIyOTBhN2I"]'
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_DATABASE: qutex
secrets:
- token
- mongoPassword
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/healthcheck"]
interval: 1m30s
timeout: 10s
retries: 3
ui:
<<: *common
image: docker.pkg.github.com/amthorn/qutex/qutex_ui:${QUTEX_VERSION:-latest}
depends_on:
- mongo
- bot
# - api
build:
context: services/ui/
projects:
<<: *common
image: docker.pkg.github.com/amthorn/qutex/qutex_projects:${QUTEX_VERSION:-latest}
depends_on:
- mongo
- auth
secrets:
- mongoPassword
users:
<<: *common
image: docker.pkg.github.com/amthorn/qutex/qutex_users:${QUTEX_VERSION:-latest}
depends_on:
- auth
secrets:
- token
- mongoPassword
auth:
<<: *common
image: docker.pkg.github.com/amthorn/qutex/qutex_auth:${QUTEX_VERSION:-latest}
depends_on:
- redis
- mongo
secrets:
- privateKey
- token
- mongoPassword
redis:
restart: always
image: redis:6.2.1
migrate:
depends_on:
- mongo
image: ${QUTEX_IMAGE:-qutex_bot:latest}
environment:
NODE_ENV: production
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_DATABASE: qutex
image: docker.pkg.github.com/amthorn/qutex/qutex_bot:${QUTEX_VERSION:-latest}
env_file: *env_files
secrets:
- mongoPassword
entrypoint: node_modules/migrate-mongo/bin/migrate-mongo.js
command: up
# command: down # undo-last
# command: status # status
mongo:
<<: *common
image: mongo:4.4.5
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_DATABASE: qutex
MONGO_INITDB_ROOT_PASSWORD_FILE: /run/secrets/mongoPassword
volumes:
- mongo_volume:/data/db
secrets:
Expand All @@ -57,5 +88,7 @@ secrets:
file: secrets/prod/token
mongoPassword:
file: secrets/prod/mongoPassword
privateKey:
file: secrets/prod/privateKey
volumes:
mongo_volume:
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"dependencies": {
"eslint": "^7.32.0",
"qutex_web": "file:services/ui"
}
}
Loading

0 comments on commit d2fd9b7

Please sign in to comment.