Skip to content

Commit

Permalink
Merge pull request #152 from scout-ch/feature/v2Containerization
Browse files Browse the repository at this point in the history
Integrated Containerization
  • Loading branch information
bodobraegger authored Oct 18, 2023
2 parents 594e57e + 8bfb1b7 commit 80cabae
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 22 deletions.
7 changes: 7 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# React Dev Port
PORT=3000
REACT_APP_VERSION=1.0.0
REACT_APP_NAME=$npm_package_name

PUBLIC_URL=/
REACT_APP_BACKEND_URL=https://backend.thilo.ch/
4 changes: 3 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- master

jobs:
push_to_registry:
build-and-push-container:
name: Build and Push Thilo Container
runs-on: ubuntu-latest

Expand Down Expand Up @@ -41,6 +41,8 @@ jobs:
build:
name: Build Thilo App
runs-on: ubuntu-latest
env:
PUBLIC_URL: /

steps:
- uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
Expand Down
40 changes: 20 additions & 20 deletions docker-compose.stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ services:
image: ghcr.io/scout-ch/thilo/thilo_frontend:latest
restart: always
environment:
- BACKEND_URL=BACKEND_URL
- BACKEND_URL=http://localhost:3031
ports:
- 3000:3000
- 3030:3000

backend:
image: ghcr.io/scout-ch/thilo-api/thilo_api:latest
restart: always
networks:
- internal
ports:
- 3031:1337
depends_on:
- database
environment:
Expand All @@ -27,14 +29,14 @@ services:
- DATABASE_NAME=strapi
- DATABASE_USER=postgres
- DATABASE_PASSWORD=admin
ports:
- 1337:3001

linkshortner:
image: shlinkio/shlink:3.4.0
image: shlinkio/shlink:3.6.4
restart: always
networks:
- internal
ports:
- 8080:8080
depends_on:
- database
environment:
Expand All @@ -45,28 +47,26 @@ services:
- DB_PASSWORD=admin
- DEFAULT_DOMAIN=thilo.cloud
- IS_HTTPS_ENABLED=true
ports:
- 8080:8080

linkshortner-webgui:
image: shlinkio/shlink-web-client:3.9.1
image: shlinkio/shlink-web-client:3.10.2
restart: always
networks:
- internal
depends_on:
- linkshortner
ports:
- 8081:80
depends_on:
- linkshortner

feedback:
image: getfider/fider:stable
image: getfider/fider:main
restart: always
networks:
- internal
depends_on:
- database
ports:
- "9000:3000"
depends_on:
- database
environment:
BASE_URL: http://localhost:9000

Expand All @@ -89,37 +89,37 @@ services:
EMAIL_SMTP_ENABLE_STARTTLS: 'true'

database:
image: postgres:15.1
image: postgres:16.0
restart: always
networks:
- internal
ports:
- 5432:5432
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=admin
- POSTGRES_DB=postgres
- PGDATA=/data/postgres
volumes:
- postgres:/data/postgres
ports:
- 5432:5432
- ./docker/init.sql:/docker-entrypoint-initdb.d/init.sql

pgadmin:
image: dpage/pgadmin4
image: dpage/pgadmin4:7.7
restart: always
networks:
- internal
ports:
- 5050:80
environment:
PGADMIN_DEFAULT_EMAIL: [email protected]
PGADMIN_DEFAULT_PASSWORD: password
volumes:
- pgadmin:/var/lib/pgadmin
ports:
- 5050:80

networks:
internal:


volumes:
postgres:
pgadmin:
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ services:
build: .
environment:
- NODE_OPTIONS=--openssl-legacy-provider
- BACKEND_URL=http://localhost:8080
ports:
- 3000:3000
4 changes: 4 additions & 0 deletions docker/init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Create databases
CREATE DATABASE "strapi";
CREATE DATABASE "fider";
CREATE DATABASE "shlink";
5 changes: 5 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title></title>
<script>
window.env = {
BACKEND_URL: '${BACKEND_URL}',
};
</script>
</head>
<body data-light-theme="light" data-dark-theme="dark" data-color-mode="auto">
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
3 changes: 2 additions & 1 deletion src/client.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import axios from "axios";

export default axios.create({
baseURL: process.env.REACT_APP_BACKEND_URL || 'https://strapi.app.levell.ch/',
// read baseULR for dev from .env file, for production from window.env (set by webpack)
baseURL: process.env.REACT_APP_BACKEND_URL || window.env.BACKEND_URL || 'https://strapi.app.levell.ch/',
headers: {
"Content-type": "application/json",
},
Expand Down

0 comments on commit 80cabae

Please sign in to comment.