Update .env values and set up woodpecker.yml

This commit is contained in:
Keannu Bernasol 2024-08-30 16:52:15 +08:00
parent d8065bc70a
commit 67a20a3330
5 changed files with 41 additions and 6 deletions

View file

@ -2,4 +2,5 @@ firefox/
chrome/
dumps/
media/
TODO.md
TODO.md
.env

View file

@ -46,8 +46,10 @@ STRIPE_SECRET_WEBHOOK = ''
USE_VAULT = 'False'
SERVE_MEDIA = 'False'
BACKEND_URL = 'localhost:8000'
FRONTEND_URL = 'localhost:4200'
BACKEND_ADDRESS = 'localhost'
BACKEND_PORT = 8000
FRONTEND_ADDRESS = 'localhost'
FRONTEND_PORT = 4200
USE_HTTPS = 'False'
TIMEZONE = 'Asia/Manila'

30
.woodpecker.yml Normal file
View file

@ -0,0 +1,30 @@
# .woodpecker.yml
steps:
- name: build & push
image: alpine:3.20.2
when:
- branch: master
- event: push
commands:
- apt update && apt install -y docker docker-buildx-plugin
- docker buildx build . -t git.keannu1.duckdns.org/keannu125/drf_template
- cat "$GITEA_PASSWORD" | docker login git.keannu1.duckdns.org --username "$GITEA_USERNAME" --pasword-stdin
- docker push git.keannu1.duckdns.org/keannu125/drf_template
- name: update deployment and reset database
image: alpine:3.20.2
when:
- branch: master
- event: push
commands:
- mkdir -p /root/.ssh/
- echo "$SSH_KEY" | tr -d '\r' > /root/.ssh/id_rsa
- chmod 600 /root/.ssh/id_rsa
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > /root/.ssh/config
- ssh root@10.0.10.4 '
cd /mnt/nvme/files/docker projects/EquipmentTracker-Backend;
docker-compose down;
docker image rm git.keannu1.duckdns.org/keannu125/drf_template;
docker volume rm git.keannu1.duckdns.org/keannu125/drf_template_db_data;
docker compose up -d'
- scp -r dist/* root@10.0.10.4:/mnt/nvme/www/equipment_tracker_frontend
secrets: [SSH_KEY, REGISTRY_USERNAME, REGISTRY_PASSWORD]

View file

@ -37,8 +37,10 @@ def get_secret(secret_name):
# URL Prefixes
USE_HTTPS = (get_secret('USE_HTTPS') == 'True')
URL_PREFIX = 'https://' if USE_HTTPS else 'http://'
BACKEND_URL = URL_PREFIX + get_secret('BACKEND_URL')
FRONTEND_URL = URL_PREFIX + get_secret('FRONTEND_URL')
BACKEND_URL = URL_PREFIX + \
get_secret('BACKEND_ADDRESS') + ':' + get_secret('BACKEND_PORT')
FRONTEND_URL = URL_PREFIX + \
get_secret('FRONTEND_ADDRESS') + ':' + get_secret('FRONTEND_PORT')
ALLOWED_HOSTS = ['*']
CSRF_TRUSTED_ORIGINS = [

View file

@ -10,7 +10,7 @@ services:
dockerfile: Dockerfile
image: drf_template:latest
ports:
- "8000:8000"
- "${BACKEND_PORT}:${BACKEND_PORT}"
environment:
- PYTHONBUFFERED=1
- RUN_TYPE=web