diff --git a/Caddyfile b/Caddyfile new file mode 100644 index 00000000..66e2580d --- /dev/null +++ b/Caddyfile @@ -0,0 +1,42 @@ +{ + admin off + email {$EMAIL_ADDRESS} + acme_ca https://acme-staging-v02.api.letsencrypt.org/directory + grace_period 30s + shutdown_delay 60s +} + + +(protect) { + @external { + not remote_ip private_ranges + } + abort @external 401 +} + +*.{$MAIN_DOMAIN} { + encode zstd gzip + + handle /ping { + @goingDown vars {http.shutting_down} true + respond @goingDown "Shutdown in {http.time_until_shutdown}" 503 + respond "pong" 200 + } + + handle / { + abort + } + + handle @stoneedge { + reverse_proxy stoneedge:8000 + } + + handle @stoneedge-staging { + import protect + abort + } + + handle { + abort 404 + } +} \ No newline at end of file diff --git a/README.md b/README.md index 25d768f2..eb71d615 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,19 @@ # OpenAssetManager Product for asset documentation for home to big business. Free base-system and non-free (paid) addons. -Our folder structure: +## Products + +All of the projects are located in this project. This is a monorepo. Make sure you have ASDF installed. + +### Web + +All web projects are under `web`, they are react projects. + +### API's +Our folder structure for the APIs: ``` fastapi-project -├── alembic/ +├── migrations/ ├── src │ ├── auth │ │ ├── router.py # auth main router with all the endpoints @@ -51,5 +60,5 @@ fastapi-project ├── .env ├── .gitignore ├── logging.ini -└── alembic.ini +└── pyproject.toml ``` diff --git a/docker-compose.yml b/docker-compose.yml index 303a4d09..24a1a4a6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,12 @@ -version: "3.7" +volumes: + caddy_data: + caddy_config: + pg_0_data: + pg_1_data: services: caddy: + container_name: caddy image: docker.io/caddy/caddy:2.9-alpine restart: unless-stopped ports: @@ -12,9 +17,15 @@ services: - ./Caddyfile:/etc/caddy/Caddyfile - caddy_data:/data - caddy_config:/config + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost/ping"] + interval: 5m + timeout: 5s + retries: 3 + start_period: 15s - fastapi: - container_name: "fastapi" + stoneedge: + container_name: "stoneedge" restart: unless-stopped build: context: ./api/asset_manager @@ -22,15 +33,14 @@ services: ports: - 8000:8000 healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:8000/health"] + test: ["CMD", "curl", "-f", "http://localhost:8000/ping"] interval: 5m timeout: 5s retries: 3 start_period: 15s - links: - - "postgres" pg-0: + container_name: "postgres-0" image: docker.io/bitnami/postgresql-repmgr:14 ports: - 5432 @@ -48,6 +58,7 @@ services: - REPMGR_NODE_NETWORK_NAME=pg-0 pg-1: + container_name: "postgres-1" image: docker.io/bitnami/postgresql-repmgr:14 ports: - 5432 @@ -65,6 +76,7 @@ services: - REPMGR_NODE_NETWORK_NAME=pg-1 pgpool: + container_name: "pgpool" image: docker.io/bitnami/pgpool:4 ports: - 5432:5432 @@ -73,7 +85,7 @@ services: - PGPOOL_SR_CHECK_USER=${POSTGRESQL_USERNAME:-user} - PGPOOL_SR_CHECK_PASSWORD=${POSTGRESQL_PASSWORD:-passwd} - PGPOOL_ENABLE_LDAP=no - - PGPOOL_POSTGRES_USERNAME=${PGPOOL_POSTGRES_USERNAME} + - PGPOOL_POSTGRES_USERNAME=${PGPOOL_POSTGRES_USERNAME:-user} - PGPOOL_POSTGRES_PASSWORD=${POSTGRESQL_ADMIN_PASSWD:-password} - PGPOOL_ADMIN_USERNAME=${PGPOOL_ADMIN_USERNAME:-admin} - PGPOOL_ADMIN_PASSWORD=${PGPOOL_ADMIN_PASSWORD:-adminpassword} @@ -83,6 +95,3 @@ services: timeout: 5s retries: 5 -volumes: - caddy_data: - caddy_config: diff --git a/web/README.md b/web/stoneedge/README.md similarity index 100% rename from web/README.md rename to web/stoneedge/README.md diff --git a/web/package-lock.json b/web/stoneedge/package-lock.json similarity index 100% rename from web/package-lock.json rename to web/stoneedge/package-lock.json diff --git a/web/package.json b/web/stoneedge/package.json similarity index 100% rename from web/package.json rename to web/stoneedge/package.json diff --git a/web/public/favicon.ico b/web/stoneedge/public/favicon.ico similarity index 100% rename from web/public/favicon.ico rename to web/stoneedge/public/favicon.ico diff --git a/web/public/index.html b/web/stoneedge/public/index.html similarity index 100% rename from web/public/index.html rename to web/stoneedge/public/index.html diff --git a/web/public/logo192.png b/web/stoneedge/public/logo192.png similarity index 100% rename from web/public/logo192.png rename to web/stoneedge/public/logo192.png diff --git a/web/public/logo512.png b/web/stoneedge/public/logo512.png similarity index 100% rename from web/public/logo512.png rename to web/stoneedge/public/logo512.png diff --git a/web/public/manifest.json b/web/stoneedge/public/manifest.json similarity index 100% rename from web/public/manifest.json rename to web/stoneedge/public/manifest.json diff --git a/web/public/robots.txt b/web/stoneedge/public/robots.txt similarity index 100% rename from web/public/robots.txt rename to web/stoneedge/public/robots.txt diff --git a/web/src/App.css b/web/stoneedge/src/App.css similarity index 100% rename from web/src/App.css rename to web/stoneedge/src/App.css diff --git a/web/src/App.test.tsx b/web/stoneedge/src/App.test.tsx similarity index 100% rename from web/src/App.test.tsx rename to web/stoneedge/src/App.test.tsx diff --git a/web/src/App.tsx b/web/stoneedge/src/App.tsx similarity index 100% rename from web/src/App.tsx rename to web/stoneedge/src/App.tsx diff --git a/web/src/index.css b/web/stoneedge/src/index.css similarity index 100% rename from web/src/index.css rename to web/stoneedge/src/index.css diff --git a/web/src/index.tsx b/web/stoneedge/src/index.tsx similarity index 100% rename from web/src/index.tsx rename to web/stoneedge/src/index.tsx diff --git a/web/src/logo.svg b/web/stoneedge/src/logo.svg similarity index 100% rename from web/src/logo.svg rename to web/stoneedge/src/logo.svg diff --git a/web/src/react-app-env.d.ts b/web/stoneedge/src/react-app-env.d.ts similarity index 100% rename from web/src/react-app-env.d.ts rename to web/stoneedge/src/react-app-env.d.ts diff --git a/web/src/reportWebVitals.ts b/web/stoneedge/src/reportWebVitals.ts similarity index 100% rename from web/src/reportWebVitals.ts rename to web/stoneedge/src/reportWebVitals.ts diff --git a/web/src/setupTests.ts b/web/stoneedge/src/setupTests.ts similarity index 100% rename from web/src/setupTests.ts rename to web/stoneedge/src/setupTests.ts diff --git a/web/tsconfig.json b/web/stoneedge/tsconfig.json similarity index 100% rename from web/tsconfig.json rename to web/stoneedge/tsconfig.json diff --git a/web/website/README.md b/web/website/README.md new file mode 100644 index 00000000..e69de29b