Skip to content

Commit

Permalink
modify axios config, add pipeline, expose application to the web
Browse files Browse the repository at this point in the history
  • Loading branch information
dreth committed Jul 25, 2024
1 parent 89fa423 commit 3f0edca
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 5 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI/CD for website

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
deploy-project:
runs-on: home-server

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Check docker compose is present
run: |
docker compose --version
- name: Navigate to the hbd dir and build + bring up the container
run: |
cd /home/dreth/IOTstack/volumes/hbd &&
git pull &&
docker compose build &&
docker stop hbd || true &&
docker rm hbd || true &&
docker compose up -d hbd
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,6 @@ go.work.sum

# env file
.env

# hbd-data directory
hbd-data/
38 changes: 38 additions & 0 deletions docker-compose-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
services:
hbd:
build:
context: .
dockerfile: Dockerfile
container_name: hbd
ports:
- "8417:8417"
- "8418:8418"
environment:
- DB_TYPE=sqlite
- DATABASE_URL=/app/backend/hbd.db
- MASTER_KEY=35e150e7ca83247f18cb1a37d61d8e161dddec06027f5db009b34da48c25f1b5
- PORT=8418
- ENVIRONMENT=production
- CUSTOM_DOMAIN=https://hbd.lotiguere.com
labels:
# Frontend
- "traefik.enable=true"
- "traefik.http.routers.hbd.rule=Host(`hbd.lotiguere.com`)"
- "traefik.http.routers.hbd.entrypoints=websecure"
- "traefik.http.routers.hbd.tls.certresolver=myresolver"
- "traefik.http.services.hbd.loadbalancer.server.port=8418"

# Backend
- "traefik.http.routers.hbd-api.rule=Host(`hbd.lotiguere.com`) && PathPrefix(`/api`)"
- "traefik.http.routers.hbd-api.entrypoints=websecure"
- "traefik.http.routers.hbd-api.tls.certresolver=myresolver"
- "traefik.http.services.hbd-api.loadbalancer.server.port=8417"

networks:
proxy:
external: true

volumes:
hbd-data:
driver: local
6 changes: 2 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ services:
ports:
- "8417:8417"
- "8418:8418"
volumes:
- ./hbd-data:/app
environment:
- DB_TYPE=sqlite
- DATABASE_URL=/app/backend/hbd.db
Expand All @@ -19,7 +21,3 @@ services:
networks:
default:
name: hbd-network

volumes:
hbd-data:
driver: local
2 changes: 1 addition & 1 deletion frontend/lib/api/axiosConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import axios from 'axios';

let baseURL = 'http://localhost:8417';
if (process.env.ENVIRONMENT === 'production') {
baseURL = 'https://hbd.lotiguere.com';
baseURL = 'https://hbd.lotiguere.com/api';
}

// Create an Axios instance
Expand Down

0 comments on commit 3f0edca

Please sign in to comment.