Skip to content

Instantly share code, notes, and snippets.

@Kafva
Created September 19, 2021 17:13
Show Gist options
  • Save Kafva/4fc9f9bb6924070d09980ec7fc569b43 to your computer and use it in GitHub Desktop.
Save Kafva/4fc9f9bb6924070d09980ec7fc569b43 to your computer and use it in GitHub Desktop.
diff --git a/docker-compose.local.yml b/docker-compose.local.yml
index e0d092b..4711da4 100644
--- a/docker-compose.local.yml
+++ b/docker-compose.local.yml
@@ -3,21 +3,113 @@ version: '3'
services:
db:
image: postgres
+ restart: always
environment:
POSTGRES_DB: bc
POSTGRES_USER: bc
POSTGRES_PASSWORD: bc
- ports:
- - 5432:5432
+ healthcheck:
+ interval: 10s
+ retries: 10
+ test:
+ [
+ 'CMD',
+ 'pg_isready',
+ '-U',
+ '${POSTGRES_USER}',
+ '-P',
+ '${POSTGRES_PASSWORD}',
+ ]
+ timeout: 45s
volumes:
- - ./pg.sql:/docker-entrypoint-initdb.d/pg.sql
+ - ./pg.sql:/docker-entrypoint-initdb.d/pg.sql
+ nodejs:
+ image: neuralegion/brokencrystals
+ container_name: nodejs
+ restart: always
+ deploy:
+ resources:
+ limits:
+ cpus: 3.5
+ logging:
+ options:
+ max-file: '5'
+ max-size: '10m'
+ depends_on:
+ - db
+ - keycloak
proxy:
image: nginx:1.17.3-alpine
+ restart: always
ports:
- 8090:80
volumes:
- ./nginx-config/local.conf:/etc/nginx/conf.d/default.conf
- ./public/build:/htdocs
+ watchtower:
+ image: containrrr/watchtower
+ restart: always
+ logging:
+ options:
+ max-file: '5'
+ max-size: '10m'
+ volumes:
+ - /var/run/docker.sock:/var/run/docker.sock
+ command: --interval 300 --debug
+ keycloak-db:
+ image: 'postgres:12.2-alpine'
+ environment:
+ POSTGRES_DB: keycloak
+ POSTGRES_USER: keycloak
+ POSTGRES_PASSWORD: password
+ healthcheck:
+ interval: 10s
+ retries: 10
+ test:
+ [
+ 'CMD',
+ 'pg_isready',
+ '-U',
+ '${POSTGRES_USER}',
+ '-P',
+ '${POSTGRES_PASSWORD}',
+ ]
+ timeout: 45s
+ restart: on-failure
+ stdin_open: true
+ tty: true
+ volumes:
+ - './keycloak/db:/var/lib/postgresql/data/'
+
+ keycloak:
+ image: jboss/keycloak:latest
+ volumes:
+ - './keycloak/imports/realm-export.json:/opt/jboss/keycloak/imports/realm-export.json'
+ environment:
+ DB_VENDOR: POSTGRES
+ DB_ADDR: keycloak-db
+ DB_DATABASE: keycloak
+ DB_USER: keycloak
+ DB_SCHEMA: public
+ DB_PASSWORD: password
+ KEYCLOAK_USER: admin
+ KEYCLOAK_PASSWORD: Pa55w0rd
+ KEYCLOAK_IMPORT: /opt/jboss/keycloak/imports/realm-export.json -Dkeycloak.profile.feature.upload_scripts=enabled
+ healthcheck:
+ test:
+ [
+ 'CMD',
+ 'curl',
+ '-f',
+ 'http://localhost:8080/auth/realms/brokencrystals/health/check/database',
+ ]
+ timeout: 10s
+ interval: 30s
+ retries: 3
+ depends_on:
+ - keycloak-db
+volumes:
+ letsencrypt:
diff --git a/nginx-config/local.conf b/nginx-config/local.conf
index 0f1bd0d..be464f8 100644
--- a/nginx-config/local.conf
+++ b/nginx-config/local.conf
@@ -11,8 +11,30 @@ server {
index index.html;
try_files $uri /index.html;
+ location / {
+ autoindex on;
+ try_files $uri $uri/ /index.html =404;
+ }
+
location /api {
- proxy_pass http://172.17.0.1:3000;
+ proxy_pass http://nodejs:3000;
+ }
+
+ location /swagger {
+ proxy_pass http://nodejs:3000;
+ }
+
+ location /put.raw {
+ rewrite put.raw /api/file/raw?path=./gil.txt break;
+ proxy_pass http://nodejs:3000;
+ }
+
+ error_page 404 /404.html;
+ location = /404.html {
+ }
+
+ error_page 500 502 503 504 /50x.html;
+ location = /50x.html {
}
}
diff --git a/public/public/index.html b/public/public/index.html
index 63bb2a5..95d68ad 100644
--- a/public/public/index.html
+++ b/public/public/index.html
@@ -8,21 +8,21 @@
<!-- Favicons -->
<link rel="manifest" href="/api/config" charset="UTF-8"/>
- <link rel="apple-touch-icon" sizes="57x57" href="%PUBLIC_URL%/favicons/apple-icon-57x57.png">
- <link rel="apple-touch-icon" sizes="60x60" href="%PUBLIC_URL%/favicons/apple-icon-60x60.png">
- <link rel="apple-touch-icon" sizes="72x72" href="%PUBLIC_URL%/favicons/apple-icon-72x72.png">
- <link rel="apple-touch-icon" sizes="76x76" href="%PUBLIC_URL%/favicons/apple-icon-76x76.png">
- <link rel="apple-touch-icon" sizes="114x114" href="%PUBLIC_URL%/favicons/apple-icon-114x114.png">
- <link rel="apple-touch-icon" sizes="120x120" href="%PUBLIC_URL%/favicons/apple-icon-120x120.png">
- <link rel="apple-touch-icon" sizes="144x144" href="%PUBLIC_URL%/favicons/apple-icon-144x144.png">
- <link rel="apple-touch-icon" sizes="152x152" href="%PUBLIC_URL%/favicons/apple-icon-152x152.png">
- <link rel="apple-touch-icon" sizes="180x180" href="%PUBLIC_URL%/favicons/apple-icon-180x180.png">
- <link rel="icon" type="image/png" sizes="192x192" href="%PUBLIC_URL%/favicons/android-icon-192x192.png">
- <link rel="icon" type="image/png" sizes="32x32" href="%PUBLIC_URL%/favicons/favicon-32x32.png">
- <link rel="icon" type="image/png" sizes="96x96" href="%PUBLIC_URL%/favicons/favicon-96x96.png">
- <link rel="icon" type="image/png" sizes="16x16" href="%PUBLIC_URL%/favicons/favicon-16x16.png">
+ <link rel="apple-touch-icon" sizes="57x57" href="public/favicons/apple-icon-57x57.png">
+ <link rel="apple-touch-icon" sizes="60x60" href="public/favicons/apple-icon-60x60.png">
+ <link rel="apple-touch-icon" sizes="72x72" href="public/favicons/apple-icon-72x72.png">
+ <link rel="apple-touch-icon" sizes="76x76" href="public/favicons/apple-icon-76x76.png">
+ <link rel="apple-touch-icon" sizes="114x114" href="public/favicons/apple-icon-114x114.png">
+ <link rel="apple-touch-icon" sizes="120x120" href="public/favicons/apple-icon-120x120.png">
+ <link rel="apple-touch-icon" sizes="144x144" href="public/favicons/apple-icon-144x144.png">
+ <link rel="apple-touch-icon" sizes="152x152" href="public/favicons/apple-icon-152x152.png">
+ <link rel="apple-touch-icon" sizes="180x180" href="public/favicons/apple-icon-180x180.png">
+ <link rel="icon" type="image/png" sizes="192x192" href="public/favicons/android-icon-192x192.png">
+ <link rel="icon" type="image/png" sizes="32x32" href="public/favicons/favicon-32x32.png">
+ <link rel="icon" type="image/png" sizes="96x96" href="public/favicons/favicon-96x96.png">
+ <link rel="icon" type="image/png" sizes="16x16" href="public/favicons/favicon-16x16.png">
<meta name="msapplication-TileColor" content="#ffffff">
- <meta name="msapplication-TileImage" content="%PUBLIC_URL%/favicons/ms-icon-144x144.png">
+ <meta name="msapplication-TileImage" content="public/favicons/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff" />
<meta name="insight-app-sec-validation" content="38936a45-0c2c-4f3c-89c0-a26817f2a5a8">
<script id="config" type="application/json" src="/api/config">
@@ -32,13 +32,13 @@
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
- <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
+ <link rel="manifest" href="public/manifest.json" />
<!--
- Notice the use of %PUBLIC_URL% in the tags above.
+ Notice the use of public in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
- Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
+ Unlike "/favicon.ico" or "favicon.ico", "public/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment