From a4b8738ac5fd64aad6d2e91e3da98366219091b2 Mon Sep 17 00:00:00 2001 From: Carsten Schafer Date: Thu, 25 Jul 2024 17:44:03 -0400 Subject: [PATCH 1/3] Make postgres the default storage option --- docker-compose/README.md | 164 ++++++++++-------- .../openwifi-cloudsdk-docker-compose.yml | 2 - .../docker-compose.lb.letsencrypt.yml | 41 +++++ .../docker-compose.lb.selfsigned.yml | 43 +++++ docker-compose/docker-compose.postgresql.yml | 75 -------- docker-compose/docker-compose.yml | 43 +++++ docker-compose/owanalytics.env | 13 +- docker-compose/owfms.env | 13 +- docker-compose/owgw.env | 14 +- docker-compose/owprov.env | 13 +- docker-compose/owsec.env | 13 +- docker-compose/owsub.env | 13 +- docker-compose/postgresql/init-db.sh | 2 + 13 files changed, 267 insertions(+), 182 deletions(-) delete mode 100644 docker-compose/docker-compose.postgresql.yml diff --git a/docker-compose/README.md b/docker-compose/README.md index 070b491..720ca1f 100644 --- a/docker-compose/README.md +++ b/docker-compose/README.md @@ -1,10 +1,10 @@ # OpenWifi SDK Docker Compose + ### Overview With the provided Docker Compose files you can instantiate a deployment of the OpenWifi microservices and related components. The repository contains a self-signed certificate and a TIP-signed gateway certificate which are valid for the `*.wlan.local` domain. You also have the possibility to either generate and use Let's Encrypt certs or provide your own certificates. Furthermore the deployments are split by whether Traefik is used as a reverse proxy/load balancer in front of the microservices or if they are exposed directly on the host. The advantage of using the deployments with Traefik is that you can use Let's Encrypt certs (automatic certificate generation and renewal) and you have the ability to scale specific containers to multiple replicas. The repository also contains a separate Docker Compose deployment to set up the [OWLS microservice](https://github.com/Telecominfraproject/wlan-cloud-owls) and related components for running a load simulation test against an existing controller. - [Non-LB deployment with self-signed certificates](#non-lb-deployment-with-self-signed-certificates) - [Non-LB deployment with own certificates](#non-lb-deployment-with-own-certificates) -- [Non-LB deployment with PostgreSQL](#non-lb-deployment-with-postgresql) - [LB deployment with self-signed certificates](#lb-deployment-with-self-signed-certificates) - [LB deployment with Let's Encrypt certificates](#lb-deployment-with-letsencrypt-certificates) - [OWLS deployment with self-signed certificates](owls/README.md) @@ -15,11 +15,87 @@ Config files for the microservices are generated on every startup based on the e Be aware that local changes to the config files will be overwritten on every startup if `TEMPLATE_CONFIG` is set to `true` in the microservice env files. If you want to bind mount your own config file or make local changes, please set this variable to `false`. #### Required password changing on the first startup One important action that must be done before using the deployment is changing password for the default user in owsec as described in [owsec docs](https://github.com/Telecominfraproject/wlan-cloud-ucentralsec/tree/main#changing-default-password). Please use these docs to find the actions that must be done **after** the deployment in order to start using your deployment. + ### Ports Every OpenWifi service is exposed via a separate port either directly on the host or through Traefik. For an overview of the exposed ports have a look into the deployment specific Docker Compose file. If you use your own certificates, you can also configure different hostnames for the microservices. Please note that the OWProv-UI is exposed on port `8080(HTTP)/8443(HTTPS)` by default. + ### owsec templates and wwwassets On the startup of owsec directories for wwwassets and mailer templates are created from the base files included in Docker image. After the initial startup you may edit those files as you wish in the [owsec-data/persist](./owsec-data/persist) directory. + +## PostgreSQL +PostgreSQL is used by default for the database for all components. +The following variables may be set in the env files. It is highly recommended that you change the DB passwords to some random string. The defaults are shown here. + +### owgw.env +| Variable | Value/Description | +| ---------------------------------- | ----------------- | +| `STORAGE_TYPE` | `postgresql` | +| `STORAGE_TYPE_POSTGRESQL_HOST` | `postgresql` | +| `STORAGE_TYPE_POSTGRESQL_USERNAME` | `owgw` | +| `STORAGE_TYPE_POSTGRESQL_PASSWORD` | `owgw` | +| `STORAGE_TYPE_POSTGRESQL_DATABASE` | `owgw` | + +### owsec.env +| Variable | Value/Description | +| ---------------------------------- | ----------------- | +| `STORAGE_TYPE` | `postgresql` | +| `STORAGE_TYPE_POSTGRESQL_HOST` | `postgresql` | +| `STORAGE_TYPE_POSTGRESQL_USERNAME` | `owsec` | +| `STORAGE_TYPE_POSTGRESQL_PASSWORD` | `owsec` | +| `STORAGE_TYPE_POSTGRESQL_DATABASE` | `owsec` | + +### owfms.env +| Variable | Value/Description | +| ---------------------------------- | ----------------- | +| `STORAGE_TYPE` | `postgresql` | +| `STORAGE_TYPE_POSTGRESQL_HOST` | `postgresql` | +| `STORAGE_TYPE_POSTGRESQL_USERNAME` | `owfms` | +| `STORAGE_TYPE_POSTGRESQL_PASSWORD` | `owfms` | +| `STORAGE_TYPE_POSTGRESQL_DATABASE` | `owfms` | + +### owprov.env +| Variable | Value/Description | +| ---------------------------------- | ----------------- | +| `STORAGE_TYPE` | `postgresql` | +| `STORAGE_TYPE_POSTGRESQL_HOST` | `postgresql` | +| `STORAGE_TYPE_POSTGRESQL_USERNAME` | `owprov` | +| `STORAGE_TYPE_POSTGRESQL_PASSWORD` | `owprov` | +| `STORAGE_TYPE_POSTGRESQL_DATABASE` | `owprov` | + +### owanalytics.env +| Variable | Value/Description | +| ---------------------------------- | ----------------- | +| `STORAGE_TYPE` | `postgresql` | +| `STORAGE_TYPE_POSTGRESQL_HOST` | `postgresql` | +| `STORAGE_TYPE_POSTGRESQL_USERNAME` | `owanalytics` | +| `STORAGE_TYPE_POSTGRESQL_PASSWORD` | `owanalytics` | +| `STORAGE_TYPE_POSTGRESQL_DATABASE` | `owanalytics` | + +### postgresql.env +| Variable | Value | +| --------------------------| ------------- | +| `POSTGRES_PASSWORD` | `postgres` | +| `POSTGRES_USER` | `postgres` | +| `OWGW_DB` | `owgw` | +| `OWGW_DB_USER` | `owgw` | +| `OWGW_DB_PASSWORD` | `owgw` | +| `OWSEC_DB` | `owsec` | +| `OWSEC_DB_USER` | `owsec` | +| `OWSEC_DB_PASSWORD` | `owsec` | +| `OWFMS_DB` | `owfms` | +| `OWFMS_DB_USER` | `owfms` | +| `OWFMS_DB_PASSWORD` | `owfms` | +| `OWPROV_DB` | `owprov` | +| `OWPROV_DB_USER` | `owprov` | +| `OWPROV_DB_PASSWORD` | `owprov` | +| `OWANALYTICS_DB` | `owanalytics` | +| `OWANALYTICS_DB_USER` | `owanalytics` | +| `OWANALYTICS_DB_PASSWORD` | `owanalytics` | +| `OWSUB_DB` | `owsub` | +| `OWSUB_DB_USER` | `owsub` | +| `OWSUB_DB_PASSWORD` | `owsub` | + ## Non-LB deployment with self-signed certificates 1. Switch into the project directory with `cd docker-compose/`. 2. Add an entry for `openwifi.wlan.local` in your hosts file which points to `127.0.0.1` or whatever the IP of the host running the deployment is. @@ -34,9 +110,11 @@ export OWSEC="openwifi.wlan.local:16001" export FLAGS="-s --cacert /docker-compose/certs/restapi-ca.pem" ``` ⚠️**Note**: When deploying with self-signed certificates you can not use the 'Trace' and 'Connect' features in the UI since the AP will throw a TLS error. Please use the Let's Encrypt deployment or provide your own valid certificates if you want to use these features. + ## Non-LB deployment with own certificates 1. Switch into the project directory with `cd docker-compose/`. Copy your websocket and REST API certificates into the `certs/` directory. Make sure to reference the certificates accordingly in the service config if you use different file names or if you want to use different certificates for the respective microservices. 2. Adapt the following hostname and URI variables according to your environment: + ### .env | Variable | Description | | ------------------------------- | ---------------------------------------------------------------------------------- | @@ -46,6 +124,7 @@ export FLAGS="-s --cacert /docker-comp | `INTERNAL_OWPROV_HOSTNAME` | Set this to your OWProv hostname, for example `owprov.example.com`. | | `INTERNAL_OWANALYTICS_HOSTNAME` | Set this to your OWAnalytics hostname, for example `owanalytics.example.com`. | | `INTERNAL_OWSUB_HOSTNAME` | Set this to your OWSub hostname, for example `owsub.example.com`. | + ### owgw.env | Variable | Description | | ---------------------------------------- | ----------------------------------------------------------------------------------- | @@ -54,29 +133,35 @@ export FLAGS="-s --cacert /docker-comp | `SYSTEM_URI_PRIVATE`,`SYSTEM_URI_PUBLIC` | Set this to your OWGW REST API URL, for example `https://owgw.example.com:16002`. | | `RTTY_SERVER` | Set this to your OWGW RTTYS hostname, for example `owgw.example.com`. | | `SYSTEM_URI_UI` | Set this to your OWGW-UI URL, for example `https://owgw-ui.example.com`. | + ### owgw-ui.env | Variable | Description | | --------------------------- | -------------------------------------------------------------------------- | | `REACT_APP_UCENTRALSEC_URL` | Set this to your OWSec URL, for example `https://owsec.example.com:16001`. | + ### owsec.env | Variable | Description | | ---------------------------------------- | ----------------------------------------------------------------------------------- | | `SYSTEM_URI_PRIVATE`,`SYSTEM_URI_PUBLIC` | Set this to your OWSec URL, for example `https://owsec.example.com:16001`. | | `SYSTEM_URI_UI` | Set this to your OWGW-UI URL, for example `https://owgw-ui.example.com`. | + ### owfms.env | Variable | Description | | ---------------------------------------- | ----------------------------------------------------------------------------------- | | `SYSTEM_URI_PRIVATE`,`SYSTEM_URI_PUBLIC` | Set this to your OWFms URL, for example `https://owfms.example.com:16004`. | | `SYSTEM_URI_UI` | Set this to your OWGW-UI URL, for example `https://owgw-ui.example.com`. | + ### owprov.env | Variable | Description | | ---------------------------------------- | ------------------------------------------------------------------------------------- | | `SYSTEM_URI_PRIVATE`,`SYSTEM_URI_PUBLIC` | Set this to your OWProv URL, for example `https://owprov.example.com:16005`. | | `SYSTEM_URI_UI` | Set this to your OWGW-UI URL, for example `https://owgw-ui.example.com`. | + ### owprov-ui.env | Variable | Description | | --------------------------- | -------------------------------------------------------------------------- | | `REACT_APP_UCENTRALSEC_URL` | Set this to your OWSec URL, for example `https://owsec.example.com:16001`. | + ### owanalytics.env | Variable | Description | | ---------------------------------------- | -------------------------------------------------------------------------------------- | @@ -86,79 +171,15 @@ export FLAGS="-s --cacert /docker-comp 3. Spin up the deployment with `docker-compose up -d`. 4. Check if the containers are up and running with `docker-compose ps`. 5. Login to the UI and and follow the instructions to change your default password. -## Non-LB deployment with PostgreSQL -1. Switch into the project directory with `cd docker-compose/`. -2. Set the following variables in the env files and make sure to uncomment the lines. It is highly recommended that you change the DB passwords to some random string. -### owgw.env -| Variable | Value/Description | -| ---------------------------------- | ----------------- | -| `STORAGE_TYPE` | `postgresql` | -| `STORAGE_TYPE_POSTGRESQL_HOST` | `postgresql` | -| `STORAGE_TYPE_POSTGRESQL_USERNAME` | `owgw` | -| `STORAGE_TYPE_POSTGRESQL_PASSWORD` | `owgw` | -| `STORAGE_TYPE_POSTGRESQL_DATABASE` | `owgw` | -### owsec.env -| Variable | Value/Description | -| ---------------------------------- | ----------------- | -| `STORAGE_TYPE` | `postgresql` | -| `STORAGE_TYPE_POSTGRESQL_HOST` | `postgresql` | -| `STORAGE_TYPE_POSTGRESQL_USERNAME` | `owsec` | -| `STORAGE_TYPE_POSTGRESQL_PASSWORD` | `owsec` | -| `STORAGE_TYPE_POSTGRESQL_DATABASE` | `owsec` | -### owfms.env -| Variable | Value/Description | -| ---------------------------------- | ----------------- | -| `STORAGE_TYPE` | `postgresql` | -| `STORAGE_TYPE_POSTGRESQL_HOST` | `postgresql` | -| `STORAGE_TYPE_POSTGRESQL_USERNAME` | `owfms` | -| `STORAGE_TYPE_POSTGRESQL_PASSWORD` | `owfms` | -| `STORAGE_TYPE_POSTGRESQL_DATABASE` | `owfms` | -### owprov.env -| Variable | Value/Description | -| ---------------------------------- | ----------------- | -| `STORAGE_TYPE` | `postgresql` | -| `STORAGE_TYPE_POSTGRESQL_HOST` | `postgresql` | -| `STORAGE_TYPE_POSTGRESQL_USERNAME` | `owprov` | -| `STORAGE_TYPE_POSTGRESQL_PASSWORD` | `owprov` | -| `STORAGE_TYPE_POSTGRESQL_DATABASE` | `owprov` | -### owanalytics.env -| Variable | Value/Description | -| ---------------------------------- | ----------------- | -| `STORAGE_TYPE` | `postgresql` | -| `STORAGE_TYPE_POSTGRESQL_HOST` | `postgresql` | -| `STORAGE_TYPE_POSTGRESQL_USERNAME` | `owanalytics` | -| `STORAGE_TYPE_POSTGRESQL_PASSWORD` | `owanalytics` | -| `STORAGE_TYPE_POSTGRESQL_DATABASE` | `owanalytics` | -### postgresql.env -| Variable | Value | -| --------------------------| ------------- | -| `POSTGRES_PASSWORD` | `postgres` | -| `POSTGRES_USER` | `postgres` | -| `OWGW_DB` | `owgw` | -| `OWGW_DB_USER` | `owgw` | -| `OWGW_DB_PASSWORD` | `owgw` | -| `OWSEC_DB` | `owsec` | -| `OWSEC_DB_USER` | `owsec` | -| `OWSEC_DB_PASSWORD` | `owsec` | -| `OWFMS_DB` | `owfms` | -| `OWFMS_DB_USER` | `owfms` | -| `OWFMS_DB_PASSWORD` | `owfms` | -| `OWPROV_DB` | `owprov` | -| `OWPROV_DB_USER` | `owprov` | -| `OWPROV_DB_PASSWORD` | `owprov` | -| `OWANALYTICS_DB` | `owanalytics` | -| `OWANALYTICS_DB_USER` | `owanalytics` | -| `OWANALYTICS_DB_PASSWORD` | `owanalytics` | -| `OWSUB_DB` | `owsub` | -| `OWSUB_DB_USER` | `owsub` | -| `OWSUB_DB_PASSWORD` | `owsub` | -3. Depending on whether you want to use [self-signed certificates](#non-lb-deployment-with-self-signed-certificates) or [provide your own](#non-lb-deployment-with-own-certificates), follow the instructions of the according deployment model. Spin up the deployment with `docker-compose -f docker-compose.yml -f docker-compose.postgresql.yml up -d`. It is recommended to create an alias for this deployment model with `alias docker-compose-postgresql="docker-compose -f docker-compose.yml -f docker-compose.postgresql.yml"`. + ## LB deployment with self-signed certificates Follow the same instructions as for the self-signed deployment without Traefik. The only difference is that you have to spin up the deployment with `docker-compose -f docker-compose.lb.selfsigned.yml --env-file .env.selfsigned up -d`. Make sure to specify the Compose and the according .env file every time you're working with the deployment or create an alias, for example `alias docker-compose-lb-selfsigned="docker-compose -f docker-compose.lb.selfsigned.yml --env-file .env.selfsigned"`. You also have the possibility to scale specific services to a specified number of instances with `docker-compose-lb-selfsigned up -d --scale SERVICE=NUM`, where `SERVICE` is the service name as defined in the Compose file. + ## LB deployment with Let's Encrypt certificates For the Let's Encrypt challenge to work you need a public IP address. The hostname which you set in the `$SDKHOSTNAME` env variable has to resolve to this IP address to pass the HTTP-01 challenge (https://letsencrypt.org/docs/challenge-types/#http-01-challenge). 1. Switch into the project directory with `cd docker-compose/`. 2. Adapt the following hostname and URI variables according to your environment. + ### .env.letsencrypt | Variable | Description | | ------------- | ---------------------------------------------------------------------------------------------------------- | @@ -189,24 +210,29 @@ For the Let's Encrypt challenge to work you need a public IP address. The hostna | ------------------- | ----------------------------------------------------------------------------- | | `SYSTEM_URI_PUBLIC` | Set this to your OWFms URL, for example `https://openwifi.example.com:16004`. | | `SYSTEM_URI_UI` | Set this to your OWGW-UI URL, for example `https://openwifi.example.com`. | + ### owprov.env -| Variable | Description | +| Variable | Description | | -------------------- | ------------------------------------------------------------------------------ | | `SYSTEM_URI_PUBLIC` | Set this to your OWProv URL, for example `https://openwifi.example.com:16005`. | | `SYSTEM_URI_UI` | Set this to your OWGW-UI URL, for example `https://openwifi.example.com`. | + ### owprov-ui.env | Variable | Description | | --------------------------- | ----------------------------------------------------------------------------- | | `REACT_APP_UCENTRALSEC_URL` | Set this to your OWSec URL, for example `https://openwifi.example.com:16001`. | + ### owanalytics.env | Variable | Description | | -------------------- | ----------------------------------------------------------------------------------- | | `SYSTEM_URI_PUBLIC` | Set this to your OWAnalytics URL, for example `https://openwifi.example.com:16009`. | | `SYSTEM_URI_UI` | Set this to your OWProv-UI URL, for example `https://openwifi.example.com`. | + ### owsub.env | Variable | Description | | -------------------- | ----------------------------------------------------------------------------- | | `SYSTEM_URI_PUBLIC` | Set this to your OWSub URL, for example `https://openwifi.example.com:16006`. | + | `SYSTEM_URI_UI` | Set this to your OWGW-UI URL, for example `https://openwifi.example.com`. | ### traefik.env | Variable | Description | diff --git a/docker-compose/cloudformation/openwifi-cloudsdk-docker-compose.yml b/docker-compose/cloudformation/openwifi-cloudsdk-docker-compose.yml index 4d95001..39bf4f0 100644 --- a/docker-compose/cloudformation/openwifi-cloudsdk-docker-compose.yml +++ b/docker-compose/cloudformation/openwifi-cloudsdk-docker-compose.yml @@ -205,8 +205,6 @@ Resources: docker-compose.lb.letsencrypt.yml --env-file .env.letsencrypt" alias docker-compose-lb-selfsigned="docker-compose -f \ docker-compose.lb.selfsigned.yml --env-file .env.selfsigned" - alias docker-compose-postgresql="docker-compose -f \ - docker-compose.yml -f docker-compose.postgresql.yml" mode: "000644" owner: "root" group: "root" diff --git a/docker-compose/docker-compose.lb.letsencrypt.yml b/docker-compose/docker-compose.lb.letsencrypt.yml index e808a27..e34261b 100644 --- a/docker-compose/docker-compose.lb.letsencrypt.yml +++ b/docker-compose/docker-compose.lb.letsencrypt.yml @@ -36,6 +36,9 @@ services: depends_on: init-kafka: condition: service_completed_successfully + postgresql: + condition: service_healthy + command: ["./wait-for-postgres.sh", "postgresql", "/openwifi/owgw"] restart: unless-stopped volumes: - owgw_data:${OWGW_ROOT}/persist @@ -72,6 +75,9 @@ services: depends_on: init-kafka: condition: service_completed_successfully + postgresql: + condition: service_healthy + command: ["./wait-for-postgres.sh", "postgresql", "/openwifi/owsec"] restart: unless-stopped volumes: - owsec_data:${OWSEC_ROOT}/persist @@ -89,6 +95,9 @@ services: depends_on: init-kafka: condition: service_completed_successfully + postgresql: + condition: service_healthy + command: ["./wait-for-postgres.sh", "postgresql", "/openwifi/owfms"] restart: unless-stopped volumes: - owfms_data:${OWFMS_ROOT}/persist @@ -106,6 +115,9 @@ services: depends_on: init-kafka: condition: service_completed_successfully + postgresql: + condition: service_healthy + command: ["./wait-for-postgres.sh", "postgresql", "/openwifi/owprov"] restart: unless-stopped volumes: - owprov_data:${OWPROV_ROOT} @@ -138,6 +150,9 @@ services: depends_on: init-kafka: condition: service_completed_successfully + postgresql: + condition: service_healthy + command: ["./wait-for-postgres.sh", "postgresql", "/openwifi/owanalytics"] restart: unless-stopped volumes: - owanalytics_data:${OWANALYTICS_ROOT} @@ -155,6 +170,9 @@ services: depends_on: init-kafka: condition: service_completed_successfully + postgresql: + condition: service_healthy + command: ["./wait-for-postgres.sh", "postgresql", "/openwifi/owsub"] restart: unless-stopped volumes: - owsub_data:${OWSUB_ROOT} @@ -247,3 +265,26 @@ services: - "1812:1812/udp" - "1813:1813/udp" - "3799:3799/udp" + + postgresql: + image: "postgres:${POSTGRESQL_TAG}" + networks: + openwifi: + command: + - "postgres" + - "-c" + - "max_connections=400" + - "-c" + - "shared_buffers=20MB" + env_file: + - postgresql.env + restart: unless-stopped + volumes: + - postgresql_data:/var/lib/postgresql/data + - ./postgresql/init-db.sh:/docker-entrypoint-initdb.d/init-db.sh + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres -d owgw"] + interval: 10s + retries: 5 + start_period: 30s + timeout: 10s diff --git a/docker-compose/docker-compose.lb.selfsigned.yml b/docker-compose/docker-compose.lb.selfsigned.yml index 5eadd44..4b5acd4 100644 --- a/docker-compose/docker-compose.lb.selfsigned.yml +++ b/docker-compose/docker-compose.lb.selfsigned.yml @@ -17,6 +17,8 @@ volumes: driver: local kafka_data: driver: local + postgresql_data: + driver: local networks: openwifi: @@ -34,6 +36,9 @@ services: depends_on: init-kafka: condition: service_completed_successfully + postgresql: + condition: service_healthy + command: ["./wait-for-postgres.sh", "postgresql", "/openwifi/owgw"] restart: unless-stopped volumes: - owgw_data:${OWGW_ROOT}/persist @@ -72,6 +77,9 @@ services: depends_on: init-kafka: condition: service_completed_successfully + postgresql: + condition: service_healthy + command: ["./wait-for-postgres.sh", "postgresql", "/openwifi/owsec"] restart: unless-stopped volumes: - owsec_data:${OWSEC_ROOT}/persist @@ -89,6 +97,9 @@ services: depends_on: init-kafka: condition: service_completed_successfully + postgresql: + condition: service_healthy + command: ["./wait-for-postgres.sh", "postgresql", "/openwifi/owfms"] restart: unless-stopped volumes: - owfms_data:${OWFMS_ROOT}/persist @@ -106,6 +117,9 @@ services: depends_on: init-kafka: condition: service_completed_successfully + postgresql: + condition: service_healthy + command: ["./wait-for-postgres.sh", "postgresql", "/openwifi/owprov"] restart: unless-stopped volumes: - owprov_data:${OWPROV_ROOT} @@ -138,6 +152,9 @@ services: depends_on: init-kafka: condition: service_completed_successfully + postgresql: + condition: service_healthy + command: ["./wait-for-postgres.sh", "postgresql", "/openwifi/owanalytics"] restart: unless-stopped volumes: - owanalytics_data:${OWANALYTICS_ROOT} @@ -155,6 +172,9 @@ services: depends_on: init-kafka: condition: service_completed_successfully + postgresql: + condition: service_healthy + command: ["./wait-for-postgres.sh", "postgresql", "/openwifi/owsub"] restart: unless-stopped volumes: - owsub_data:${OWSUB_ROOT} @@ -241,3 +261,26 @@ services: - "1812:1812/udp" - "1813:1813/udp" - "3799:3799/udp" + + postgresql: + image: "postgres:${POSTGRESQL_TAG}" + networks: + openwifi: + command: + - "postgres" + - "-c" + - "max_connections=400" + - "-c" + - "shared_buffers=20MB" + env_file: + - postgresql.env + restart: unless-stopped + volumes: + - postgresql_data:/var/lib/postgresql/data + - ./postgresql/init-db.sh:/docker-entrypoint-initdb.d/init-db.sh + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres -d owgw"] + interval: 10s + retries: 5 + start_period: 30s + timeout: 10s diff --git a/docker-compose/docker-compose.postgresql.yml b/docker-compose/docker-compose.postgresql.yml deleted file mode 100644 index c8865f5..0000000 --- a/docker-compose/docker-compose.postgresql.yml +++ /dev/null @@ -1,75 +0,0 @@ -volumes: - postgresql_data: - driver: local - -services: - owgw: - depends_on: - init-kafka: - condition: service_completed_successfully - postgresql: - condition: service_healthy - command: ["./wait-for-postgres.sh", "postgresql", "/openwifi/owgw"] - - owsec: - depends_on: - init-kafka: - condition: service_completed_successfully - postgresql: - condition: service_healthy - command: ["./wait-for-postgres.sh", "postgresql", "/openwifi/owsec"] - - owfms: - depends_on: - init-kafka: - condition: service_completed_successfully - postgresql: - condition: service_healthy - command: ["./wait-for-postgres.sh", "postgresql", "/openwifi/owfms"] - - owprov: - depends_on: - init-kafka: - condition: service_completed_successfully - postgresql: - condition: service_healthy - command: ["./wait-for-postgres.sh", "postgresql", "/openwifi/owprov"] - - owanalytics: - depends_on: - init-kafka: - condition: service_completed_successfully - postgresql: - condition: service_healthy - command: ["./wait-for-postgres.sh", "postgresql", "/openwifi/owanalytics"] - - owsub: - depends_on: - init-kafka: - condition: service_completed_successfully - postgresql: - condition: service_healthy - command: ["./wait-for-postgres.sh", "postgresql", "/openwifi/owsub"] - - postgresql: - image: "postgres:${POSTGRESQL_TAG}" - networks: - openwifi: - command: - - "postgres" - - "-c" - - "max_connections=400" - - "-c" - - "shared_buffers=20MB" - env_file: - - postgresql.env - restart: unless-stopped - volumes: - - postgresql_data:/var/lib/postgresql/data - - ./postgresql/init-db.sh:/docker-entrypoint-initdb.d/init-db.sh - healthcheck: - test: ["CMD-SHELL", "pg_isready -U postgres -d owgw"] - interval: 10s - retries: 5 - start_period: 30s - timeout: 10s diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml index 5686851..5f2bd3c 100644 --- a/docker-compose/docker-compose.yml +++ b/docker-compose/docker-compose.yml @@ -5,6 +5,8 @@ volumes: driver: local kafka_data: driver: local + postgresql_data: + driver: local networks: openwifi: @@ -21,6 +23,9 @@ services: depends_on: init-kafka: condition: service_completed_successfully + postgresql: + condition: service_healthy + command: ["./wait-for-postgres.sh", "postgresql", "/openwifi/owgw"] restart: unless-stopped volumes: - "./owgw_data:${OWGW_ROOT}" @@ -73,6 +78,9 @@ services: depends_on: init-kafka: condition: service_completed_successfully + postgresql: + condition: service_healthy + command: ["./wait-for-postgres.sh", "postgresql", "/openwifi/owsec"] restart: unless-stopped volumes: - "./owsec_data:${OWSEC_ROOT}" @@ -92,6 +100,9 @@ services: depends_on: init-kafka: condition: service_completed_successfully + postgresql: + condition: service_healthy + command: ["./wait-for-postgres.sh", "postgresql", "/openwifi/owfms"] restart: unless-stopped volumes: - "./owfms_data:${OWFMS_ROOT}" @@ -111,6 +122,9 @@ services: depends_on: init-kafka: condition: service_completed_successfully + postgresql: + condition: service_healthy + command: ["./wait-for-postgres.sh", "postgresql", "/openwifi/owprov"] restart: unless-stopped volumes: - "./owprov_data:${OWPROV_ROOT}" @@ -152,6 +166,9 @@ services: depends_on: init-kafka: condition: service_completed_successfully + postgresql: + condition: service_healthy + command: ["./wait-for-postgres.sh", "postgresql", "/openwifi/owanalytics"] restart: unless-stopped volumes: - "./owanalytics_data:${OWANALYTICS_ROOT}" @@ -171,6 +188,9 @@ services: depends_on: init-kafka: condition: service_completed_successfully + postgresql: + condition: service_healthy + command: ["./wait-for-postgres.sh", "postgresql", "/openwifi/owsub"] restart: unless-stopped volumes: - "./owsub_data:${OWSUB_ROOT}" @@ -220,3 +240,26 @@ services: --create --if-not-exists --topic $$topic --replication-factor 1 \ --partitions 1 --bootstrap-server kafka:9092 done && echo "Successfully created Kafka topics, exiting." && exit 0 + + postgresql: + image: "postgres:${POSTGRESQL_TAG}" + networks: + openwifi: + command: + - "postgres" + - "-c" + - "max_connections=400" + - "-c" + - "shared_buffers=20MB" + env_file: + - postgresql.env + restart: unless-stopped + volumes: + - postgresql_data:/var/lib/postgresql/data + - ./postgresql/init-db.sh:/docker-entrypoint-initdb.d/init-db.sh + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres -d owgw"] + interval: 10s + retries: 5 + start_period: 30s + timeout: 10s diff --git a/docker-compose/owanalytics.env b/docker-compose/owanalytics.env index aa94a1f..8c943dc 100644 --- a/docker-compose/owanalytics.env +++ b/docker-compose/owanalytics.env @@ -26,14 +26,15 @@ SYSTEM_URI_UI=https://openwifi.wlan.local #SECURITY_RESTAPI_DISABLE=false #KAFKA_ENABLE=true KAFKA_BROKERLIST=kafka:9092 -#STORAGE_TYPE=sqlite -#STORAGE_TYPE_POSTGRESQL_HOST=localhost -#STORAGE_TYPE_POSTGRESQL_USERNAME=owanalytics -#STORAGE_TYPE_POSTGRESQL_PASSWORD=owanalytics -#STORAGE_TYPE_POSTGRESQL_DATABASE=owanalytics -#STORAGE_TYPE_POSTGRESQL_PORT=5432 +STORAGE_TYPE=postgresql +STORAGE_TYPE_POSTGRESQL_HOST=postgresql +STORAGE_TYPE_POSTGRESQL_USERNAME=owanalytics +STORAGE_TYPE_POSTGRESQL_PASSWORD=owanalytics +STORAGE_TYPE_POSTGRESQL_DATABASE=owanalytics +STORAGE_TYPE_POSTGRESQL_PORT=5432 #STORAGE_TYPE_MYSQL_HOST=localhost #STORAGE_TYPE_MYSQL_USERNAME=owanalytics #STORAGE_TYPE_MYSQL_PASSWORD=owanalytics #STORAGE_TYPE_MYSQL_DATABASE=owanalytics #STORAGE_TYPE_MYSQL_PORT=3306 +#STORAGE_TYPE=sqlite diff --git a/docker-compose/owfms.env b/docker-compose/owfms.env index b286475..48611ca 100644 --- a/docker-compose/owfms.env +++ b/docker-compose/owfms.env @@ -29,14 +29,15 @@ S3_KEY=AKIAUG47UZG7R6SRLD7F #S3_BUCKET_URI=ucentral-ap-firmware.s3.amazonaws.com #KAFKA_ENABLE=true KAFKA_BROKERLIST=kafka:9092 -#STORAGE_TYPE=sqlite -#STORAGE_TYPE_POSTGRESQL_HOST=localhost -#STORAGE_TYPE_POSTGRESQL_USERNAME=owfms -#STORAGE_TYPE_POSTGRESQL_PASSWORD=owfms -#STORAGE_TYPE_POSTGRESQL_DATABASE=owfms -#STORAGE_TYPE_POSTGRESQL_PORT=5432 +STORAGE_TYPE=postgresql +STORAGE_TYPE_POSTGRESQL_HOST=postgresql +STORAGE_TYPE_POSTGRESQL_USERNAME=owfms +STORAGE_TYPE_POSTGRESQL_PASSWORD=owfms +STORAGE_TYPE_POSTGRESQL_DATABASE=owfms +STORAGE_TYPE_POSTGRESQL_PORT=5432 #STORAGE_TYPE_MYSQL_HOST=localhost #STORAGE_TYPE_MYSQL_USERNAME=owfms #STORAGE_TYPE_MYSQL_PASSWORD=owfms #STORAGE_TYPE_MYSQL_DATABASE=owfms #STORAGE_TYPE_MYSQL_PORT=3306 +#STORAGE_TYPE=sqlite diff --git a/docker-compose/owgw.env b/docker-compose/owgw.env index 968bad8..5586a44 100644 --- a/docker-compose/owgw.env +++ b/docker-compose/owgw.env @@ -56,15 +56,17 @@ RADIUS_PROXY_ENABLE=true #RADIUS_PROXY_COA_PORT=3799 #KAFKA_ENABLE=true KAFKA_BROKERLIST=kafka:9092 -#STORAGE_TYPE=sqlite -#STORAGE_TYPE_POSTGRESQL_HOST=localhost -#STORAGE_TYPE_POSTGRESQL_USERNAME=owgw -#STORAGE_TYPE_POSTGRESQL_PASSWORD=owgw -#STORAGE_TYPE_POSTGRESQL_DATABASE=owgw -#STORAGE_TYPE_POSTGRESQL_PORT=5432 +STORAGE_TYPE=postgresql +STORAGE_TYPE_POSTGRESQL_HOST=postgresql +STORAGE_TYPE_POSTGRESQL_USERNAME=owgw +STORAGE_TYPE_POSTGRESQL_PASSWORD=owgw +STORAGE_TYPE_POSTGRESQL_DATABASE=owgw +STORAGE_TYPE_POSTGRESQL_PORT=5432 #STORAGE_TYPE_MYSQL_HOST=localhost #STORAGE_TYPE_MYSQL_USERNAME=owgw #STORAGE_TYPE_MYSQL_PASSWORD=owgw #STORAGE_TYPE_MYSQL_DATABASE=owgw #STORAGE_TYPE_MYSQL_PORT=3306 +#STORAGE_TYPE=sqlite + #CERTIFICATES_ALLOWMISMATCH=false diff --git a/docker-compose/owprov.env b/docker-compose/owprov.env index a895329..9ff13ba 100644 --- a/docker-compose/owprov.env +++ b/docker-compose/owprov.env @@ -26,14 +26,15 @@ SYSTEM_URI_UI=https://openwifi.wlan.local #SECURITY_RESTAPI_DISABLE=false #KAFKA_ENABLE=true KAFKA_BROKERLIST=kafka:9092 -#STORAGE_TYPE=sqlite -#STORAGE_TYPE_POSTGRESQL_HOST=localhost -#STORAGE_TYPE_POSTGRESQL_USERNAME=owprov -#STORAGE_TYPE_POSTGRESQL_PASSWORD=owprov -#STORAGE_TYPE_POSTGRESQL_DATABASE=owprov -#STORAGE_TYPE_POSTGRESQL_PORT=5432 +STORAGE_TYPE=postgresql +STORAGE_TYPE_POSTGRESQL_HOST=postgresql +STORAGE_TYPE_POSTGRESQL_USERNAME=owprov +STORAGE_TYPE_POSTGRESQL_PASSWORD=owprov +STORAGE_TYPE_POSTGRESQL_DATABASE=owprov +STORAGE_TYPE_POSTGRESQL_PORT=5432 #STORAGE_TYPE_MYSQL_HOST=localhost #STORAGE_TYPE_MYSQL_USERNAME=owprov #STORAGE_TYPE_MYSQL_PASSWORD=owprov #STORAGE_TYPE_MYSQL_DATABASE=owprov #STORAGE_TYPE_MYSQL_PORT=3306 +#STORAGE_TYPE=sqlite diff --git a/docker-compose/owsec.env b/docker-compose/owsec.env index bd4f68d..952637e 100644 --- a/docker-compose/owsec.env +++ b/docker-compose/owsec.env @@ -35,14 +35,15 @@ SYSTEM_URI_UI=https://openwifi.wlan.local KAFKA_BROKERLIST=kafka:9092 #DOCUMENT_POLICY_ACCESS=$OWSEC_ROOT/wwwassets/access_policy.html #DOCUMENT_POLICY_PASSWORD=$OWSEC_ROOT/wwwassets/password_policy.html -#STORAGE_TYPE=sqlite -#STORAGE_TYPE_POSTGRESQL_HOST=localhost -#STORAGE_TYPE_POSTGRESQL_USERNAME=owsec -#STORAGE_TYPE_POSTGRESQL_PASSWORD=owsec -#STORAGE_TYPE_POSTGRESQL_DATABASE=owsec -#STORAGE_TYPE_POSTGRESQL_PORT=5432 +STORAGE_TYPE=postgresql +STORAGE_TYPE_POSTGRESQL_HOST=postgresql +STORAGE_TYPE_POSTGRESQL_USERNAME=owsec +STORAGE_TYPE_POSTGRESQL_PASSWORD=owsec +STORAGE_TYPE_POSTGRESQL_DATABASE=owsec +STORAGE_TYPE_POSTGRESQL_PORT=5432 #STORAGE_TYPE_MYSQL_HOST=localhost #STORAGE_TYPE_MYSQL_USERNAME=owsec #STORAGE_TYPE_MYSQL_PASSWORD=owsec #STORAGE_TYPE_MYSQL_DATABASE=owsec #STORAGE_TYPE_MYSQL_PORT=3306 +#STORAGE_TYPE=sqlite diff --git a/docker-compose/owsub.env b/docker-compose/owsub.env index 6d42caf..d349a64 100644 --- a/docker-compose/owsub.env +++ b/docker-compose/owsub.env @@ -26,14 +26,15 @@ SYSTEM_URI_UI=https://openwifi.wlan.local #SECURITY_RESTAPI_DISABLE=false #KAFKA_ENABLE=true KAFKA_BROKERLIST=kafka:9092 -#STORAGE_TYPE=sqlite -#STORAGE_TYPE_POSTGRESQL_HOST=localhost -#STORAGE_TYPE_POSTGRESQL_USERNAME=owsub -#STORAGE_TYPE_POSTGRESQL_PASSWORD=owsub -#STORAGE_TYPE_POSTGRESQL_DATABASE=owsub -#STORAGE_TYPE_POSTGRESQL_PORT=5432 +STORAGE_TYPE=postgresql +STORAGE_TYPE_POSTGRESQL_HOST=postgresql +STORAGE_TYPE_POSTGRESQL_USERNAME=owsub +STORAGE_TYPE_POSTGRESQL_PASSWORD=owsub +STORAGE_TYPE_POSTGRESQL_DATABASE=owsub +STORAGE_TYPE_POSTGRESQL_PORT=5432 #STORAGE_TYPE_MYSQL_HOST=localhost #STORAGE_TYPE_MYSQL_USERNAME=owsub #STORAGE_TYPE_MYSQL_PASSWORD=owsub #STORAGE_TYPE_MYSQL_DATABASE=owsub #STORAGE_TYPE_MYSQL_PORT=3306 +#STORAGE_TYPE=sqlite diff --git a/docker-compose/postgresql/init-db.sh b/docker-compose/postgresql/init-db.sh index 8f868dc..3ece1ab 100755 --- a/docker-compose/postgresql/init-db.sh +++ b/docker-compose/postgresql/init-db.sh @@ -14,4 +14,6 @@ psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL CREATE DATABASE $OWANALYTICS_DB OWNER $OWANALYTICS_DB_USER; CREATE USER $OWSUB_DB_USER WITH ENCRYPTED PASSWORD '$OWSUB_DB_PASSWORD'; CREATE DATABASE $OWSUB_DB OWNER $OWSUB_DB_USER; + \c owsec + INSERT INTO users (id, name, description, avatar, email, validated, validationemail, validationdate, creationdate, validationuri, changepassword, lastlogin, currentloginuri, lastpasswordchange, lastemailcheck, waitingforemailcheck, locale, notes, location, owner, suspended, blacklisted, userrole, usertypeproprietaryinfo, securitypolicy, securitypolicychange, currentpassword, lastpasswords, oauthtype, oauthuserinfo, modified, signingup) VALUES ('11111111-0000-0000-6666-999999999999', 'Default User', 'Default user should be deleted.', '1701287135', 'tip@ucentral.com', true, '', 0, 1683468668, '', true, 1702156150, '', 1683468881, 0, false, '', '[]', '', '', false, false, 'root', '{"authenticatorSecret":"","mfa":{"enabled":false,"method":""},"mobiles":[]}', '', 0, '13268b7daa751240369d125e79c873bd8dd3bef7981bdfd38ea03dbb1fbe7dcf', '["13268b7daa751240369d125e79c873bd8dd3bef7981bdfd38ea03dbb1fbe7dcf","1683468881040646067|bcf145fa6354dbe1baddf1f66f6acc2466c49c2fbc22d2150a7f7a94fa1cfa27"]', '', '', '1683468881', '') ON CONFLICT (id) DO NOTHING; EOSQL From 1c43883094ed3842ec8e7386f86d099ae0e48ffd Mon Sep 17 00:00:00 2001 From: Carsten Schafer Date: Fri, 26 Jul 2024 11:08:59 -0400 Subject: [PATCH 2/3] move to postgres for the other LB based docker compose samples Signed-off-by: Carsten Schafer --- docker-compose/.env.letsencrypt | 9 ++++++--- docker-compose/.env.selfsigned | 5 ++++- docker-compose/README.md | 1 + docker-compose/docker-compose.lb.letsencrypt.yml | 2 ++ docker-compose/docker-compose.lb.selfsigned.yml | 2 -- docker-compose/owanalytics.env | 1 + 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/docker-compose/.env.letsencrypt b/docker-compose/.env.letsencrypt index 573bfa7..7a42300 100644 --- a/docker-compose/.env.letsencrypt +++ b/docker-compose/.env.letsencrypt @@ -1,5 +1,6 @@ -# Image tags COMPOSE_PROJECT_NAME=openwifi + +# Image tags OWGW_TAG=master OWGWUI_TAG=main OWSEC_TAG=main @@ -8,10 +9,12 @@ OWPROV_TAG=main OWPROVUI_TAG=main OWANALYTICS_TAG=main OWSUB_TAG=main + KAFKA_TAG=2.8.0-debian-10-r43 ZOOKEEPER_TAG=3.8 +POSTGRESQL_TAG=15.0 ACMESH_TAG=latest -TRAEFIK_TAG=latest +TRAEFIK_TAG=v3.1.0 # Microservice root/config directories OWGW_ROOT=/owgw-data @@ -37,4 +40,4 @@ INTERNAL_OWPROVUI_HOSTNAME=owprov-ui.wlan.local INTERNAL_OWANALYTICS_HOSTNAME=owanalytics.wlan.local INTERNAL_RTTYS_HOSTNAME=rttys.wlan.local INTERNAL_OWSUB_HOSTNAME=owsub.wlan.local -SDKHOSTNAME= +#SDKHOSTNAME=openwifi.example.com diff --git a/docker-compose/.env.selfsigned b/docker-compose/.env.selfsigned index c9b52c1..8e3aef1 100644 --- a/docker-compose/.env.selfsigned +++ b/docker-compose/.env.selfsigned @@ -1,5 +1,6 @@ -# Image tags COMPOSE_PROJECT_NAME=openwifi + +# Image tags OWGW_TAG=master OWGWUI_TAG=main OWSEC_TAG=main @@ -8,8 +9,10 @@ OWPROV_TAG=main OWPROVUI_TAG=main OWANALYTICS_TAG=main OWSUB_TAG=main + KAFKA_TAG=2.8.0-debian-10-r43 ZOOKEEPER_TAG=3.8 +POSTGRESQL_TAG=15.0 ACMESH_TAG=latest TRAEFIK_TAG=latest diff --git a/docker-compose/README.md b/docker-compose/README.md index 720ca1f..486ca96 100644 --- a/docker-compose/README.md +++ b/docker-compose/README.md @@ -13,6 +13,7 @@ The repository also contains a separate Docker Compose deployment to set up the ### Configuration Config files for the microservices are generated on every startup based on the environment variables in the microservice specific env files. For an overview of the supported configuration properties have a look into these files. For an explanation of the configuration properties please see the README in the respective microservice repository. Be aware that local changes to the config files will be overwritten on every startup if `TEMPLATE_CONFIG` is set to `true` in the microservice env files. If you want to bind mount your own config file or make local changes, please set this variable to `false`. + #### Required password changing on the first startup One important action that must be done before using the deployment is changing password for the default user in owsec as described in [owsec docs](https://github.com/Telecominfraproject/wlan-cloud-ucentralsec/tree/main#changing-default-password). Please use these docs to find the actions that must be done **after** the deployment in order to start using your deployment. diff --git a/docker-compose/docker-compose.lb.letsencrypt.yml b/docker-compose/docker-compose.lb.letsencrypt.yml index e34261b..247d214 100644 --- a/docker-compose/docker-compose.lb.letsencrypt.yml +++ b/docker-compose/docker-compose.lb.letsencrypt.yml @@ -17,6 +17,8 @@ volumes: driver: local kafka_data: driver: local + postgresql_data: + driver: local letsencrypt_certs: driver: local diff --git a/docker-compose/docker-compose.lb.selfsigned.yml b/docker-compose/docker-compose.lb.selfsigned.yml index 4b5acd4..d739b4e 100644 --- a/docker-compose/docker-compose.lb.selfsigned.yml +++ b/docker-compose/docker-compose.lb.selfsigned.yml @@ -50,8 +50,6 @@ services: owgw-ui: image: "tip-tip-wlan-cloud-ucentral.jfrog.io/owgw-ui:${OWGWUI_TAG}" - env_file: - - owgw-ui.env networks: openwifi: aliases: diff --git a/docker-compose/owanalytics.env b/docker-compose/owanalytics.env index 8c943dc..83ff047 100644 --- a/docker-compose/owanalytics.env +++ b/docker-compose/owanalytics.env @@ -23,6 +23,7 @@ SYSTEM_DATA=$OWANALYTICS_ROOT/persist SYSTEM_URI_PRIVATE=https://owanalytics.wlan.local:17009 SYSTEM_URI_PUBLIC=https://openwifi.wlan.local:16009 SYSTEM_URI_UI=https://openwifi.wlan.local + #SECURITY_RESTAPI_DISABLE=false #KAFKA_ENABLE=true KAFKA_BROKERLIST=kafka:9092 From dceb24d0bba36d337167b258d4ad71d9e9c7ecbc Mon Sep 17 00:00:00 2001 From: Carsten Schafer Date: Fri, 26 Jul 2024 16:42:33 -0400 Subject: [PATCH 3/3] SQL init script can't work, DB check to last one Signed-off-by: Carsten Schafer --- docker-compose/.env.letsencrypt | 1 + docker-compose/docker-compose.lb.letsencrypt.yml | 2 +- docker-compose/docker-compose.lb.selfsigned.yml | 2 +- docker-compose/docker-compose.yml | 2 +- docker-compose/postgresql/init-db.sh | 2 -- 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/docker-compose/.env.letsencrypt b/docker-compose/.env.letsencrypt index 7a42300..8596eb4 100644 --- a/docker-compose/.env.letsencrypt +++ b/docker-compose/.env.letsencrypt @@ -40,4 +40,5 @@ INTERNAL_OWPROVUI_HOSTNAME=owprov-ui.wlan.local INTERNAL_OWANALYTICS_HOSTNAME=owanalytics.wlan.local INTERNAL_RTTYS_HOSTNAME=rttys.wlan.local INTERNAL_OWSUB_HOSTNAME=owsub.wlan.local +SDKHOSTNAME= #SDKHOSTNAME=openwifi.example.com diff --git a/docker-compose/docker-compose.lb.letsencrypt.yml b/docker-compose/docker-compose.lb.letsencrypt.yml index 247d214..41cec41 100644 --- a/docker-compose/docker-compose.lb.letsencrypt.yml +++ b/docker-compose/docker-compose.lb.letsencrypt.yml @@ -285,7 +285,7 @@ services: - postgresql_data:/var/lib/postgresql/data - ./postgresql/init-db.sh:/docker-entrypoint-initdb.d/init-db.sh healthcheck: - test: ["CMD-SHELL", "pg_isready -U postgres -d owgw"] + test: ["CMD-SHELL", "pg_isready -U postgres -d owsub"] interval: 10s retries: 5 start_period: 30s diff --git a/docker-compose/docker-compose.lb.selfsigned.yml b/docker-compose/docker-compose.lb.selfsigned.yml index d739b4e..42a8f4d 100644 --- a/docker-compose/docker-compose.lb.selfsigned.yml +++ b/docker-compose/docker-compose.lb.selfsigned.yml @@ -277,7 +277,7 @@ services: - postgresql_data:/var/lib/postgresql/data - ./postgresql/init-db.sh:/docker-entrypoint-initdb.d/init-db.sh healthcheck: - test: ["CMD-SHELL", "pg_isready -U postgres -d owgw"] + test: ["CMD-SHELL", "pg_isready -U postgres -d owsub"] interval: 10s retries: 5 start_period: 30s diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml index 5f2bd3c..9a1f581 100644 --- a/docker-compose/docker-compose.yml +++ b/docker-compose/docker-compose.yml @@ -258,7 +258,7 @@ services: - postgresql_data:/var/lib/postgresql/data - ./postgresql/init-db.sh:/docker-entrypoint-initdb.d/init-db.sh healthcheck: - test: ["CMD-SHELL", "pg_isready -U postgres -d owgw"] + test: ["CMD-SHELL", "pg_isready -U postgres -d owsub"] interval: 10s retries: 5 start_period: 30s diff --git a/docker-compose/postgresql/init-db.sh b/docker-compose/postgresql/init-db.sh index 3ece1ab..8f868dc 100755 --- a/docker-compose/postgresql/init-db.sh +++ b/docker-compose/postgresql/init-db.sh @@ -14,6 +14,4 @@ psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL CREATE DATABASE $OWANALYTICS_DB OWNER $OWANALYTICS_DB_USER; CREATE USER $OWSUB_DB_USER WITH ENCRYPTED PASSWORD '$OWSUB_DB_PASSWORD'; CREATE DATABASE $OWSUB_DB OWNER $OWSUB_DB_USER; - \c owsec - INSERT INTO users (id, name, description, avatar, email, validated, validationemail, validationdate, creationdate, validationuri, changepassword, lastlogin, currentloginuri, lastpasswordchange, lastemailcheck, waitingforemailcheck, locale, notes, location, owner, suspended, blacklisted, userrole, usertypeproprietaryinfo, securitypolicy, securitypolicychange, currentpassword, lastpasswords, oauthtype, oauthuserinfo, modified, signingup) VALUES ('11111111-0000-0000-6666-999999999999', 'Default User', 'Default user should be deleted.', '1701287135', 'tip@ucentral.com', true, '', 0, 1683468668, '', true, 1702156150, '', 1683468881, 0, false, '', '[]', '', '', false, false, 'root', '{"authenticatorSecret":"","mfa":{"enabled":false,"method":""},"mobiles":[]}', '', 0, '13268b7daa751240369d125e79c873bd8dd3bef7981bdfd38ea03dbb1fbe7dcf', '["13268b7daa751240369d125e79c873bd8dd3bef7981bdfd38ea03dbb1fbe7dcf","1683468881040646067|bcf145fa6354dbe1baddf1f66f6acc2466c49c2fbc22d2150a7f7a94fa1cfa27"]', '', '', '1683468881', '') ON CONFLICT (id) DO NOTHING; EOSQL