mederrata / ansible_docker_keycloak

0 stars 2 forks source link

Need to setup build keycloak #18

Open hungrymonkey opened 5 months ago

hungrymonkey commented 5 months ago
Environment=KC_DB_USERNAME=keycloak
Environment=KC_DB_PASSWORD=alsdfjklasdfjklwerpoqwj
Environment=KC_DB_URL=jdbc:postgresql://keycloak-postgres:5432/keycloakPostgres
Environment=KC_DB=postgres
ExecStartPre=-/usr/bin/docker kill keycloak
ExecStartPre=-/usr/bin/docker rm keycloak

ExecStart=/usr/bin/docker run --rm --name keycloak \
                        --log-driver=none \
                        -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=blah \
                        -p 8442:8080 \
                        -v /etc/letsencrypt/live/keycloak/cert.pem:/etc/x509/https/tls.crt:ro \
                        -v /etc/letsencrypt/live/keycloak/key.pem:/etc/x509/https/tls.key:ro \
                        --net keycloak-network \
                        quay.io/keycloak/keycloak:24.0.4 start-dev \
                        --hostname=keycloak.mederrata.com \
                        --https-certificate-file=/etc/x509/https/tls.crt \
                        --https-certificate-key-file=/etc/x509/https/tls.key \
                        --proxy-headers=forwarded \
                        --db=postgres --features=token-exchange
                        --health-enabled=true \
                        --metrics-enabled=true 

ExecStop=-/usr/bin/docker kill keycloak
ExecStop=-/usr/bin/docker rm keycloak
Restart=always
RestartSec=30
SyslogIdentifier=keycloak
Jun 09 15:07:05 ip-10-0-1-214 keycloak-postgres[7428]: Error: No such container: keycloak-postgres
Jun 09 15:07:05 ip-10-0-1-214 systemd[1]: keycloak-postgres.service: Deactivated successfully.
Jun 09 15:07:05 ip-10-0-1-214 systemd[1]: keycloak-postgres.service: Consumed 2.335s CPU time.
Jun 09 15:07:35 ip-10-0-1-214 systemd[1]: keycloak-postgres.service: Scheduled restart job, restart counter is at 4.
Jun 09 15:07:35 ip-10-0-1-214 systemd[1]: Stopped keycloak-postgres.service - Postgres server.
Jun 09 15:07:35 ip-10-0-1-214 systemd[1]: keycloak-postgres.service: Consumed 2.335s CPU time.
Jun 09 15:07:35 ip-10-0-1-214 systemd[1]: Starting keycloak-postgres.service - Postgres server...
Jun 09 15:07:41 ip-10-0-1-214 keycloak-postgres[7584]: keycloak-postgres
Jun 09 15:07:41 ip-10-0-1-214 keycloak-postgres[7642]: Error: No such container: keycloak-postgres
Jun 09 15:07:41 ip-10-0-1-214 systemd[1]: Started keycloak-postgres.service - Postgres server.
Jun 09 15:07:56 ip-10-0-1-214 keycloak-postgres[7654]: chmod: changing permissions of '/var/run/postgresql': Operation not permitted
Jun 09 15:07:56 ip-10-0-1-214 keycloak-postgres[7654]: PostgreSQL Database directory appears to contain a database; Skipping initialization
Jun 09 15:07:58 ip-10-0-1-214 keycloak-postgres[7654]: 2024-06-09 15:07:58.950 UTC [1] LOG:  starting PostgreSQL 16.3 (Debian 16.3-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
Jun 09 15:07:58 ip-10-0-1-214 keycloak-postgres[7654]: 2024-06-09 15:07:58.951 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
Jun 09 15:07:58 ip-10-0-1-214 keycloak-postgres[7654]: 2024-06-09 15:07:58.951 UTC [1] LOG:  listening on IPv6 address "::", port 5432
Jun 09 15:07:58 ip-10-0-1-214 keycloak-postgres[7654]: 2024-06-09 15:07:58.953 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
Jun 09 15:07:59 ip-10-0-1-214 keycloak-postgres[7654]: 2024-06-09 15:07:59.197 UTC [17] LOG:  database system was shut down at 2024-06-09 15:07:37 UTC
Jun 09 15:07:59 ip-10-0-1-214 keycloak-postgres[7654]: 2024-06-09 15:07:59.434 UTC [1] LOG:  database system is ready to accept connections
Jun 09 15:08:26 ip-10-0-1-214 keycloak-postgres[7654]: 2024-06-09 15:08:26.788 UTC [1] LOG:  received fast shutdown request
Jun 09 15:08:26 ip-10-0-1-214 keycloak-postgres[7654]: 2024-06-09 15:08:26.790 UTC [1] LOG:  aborting any active transactions
Jun 09 15:08:26 ip-10-0-1-214 keycloak-postgres[7654]: 2024-06-09 15:08:26.951 UTC [1] LOG:  background worker "logical replication launcher" (PID 20) exited with exit code 1
Jun 09 15:08:27 ip-10-0-1-214 keycloak-postgres[7654]: 2024-06-09 15:08:27.028 UTC [15] LOG:  shutting down
Jun 09 15:08:27 ip-10-0-1-214 keycloak-postgres[7654]: 2024-06-09 15:08:27.108 UTC [15] LOG:  checkpoint starting: shutdown immediate
Jun 09 15:08:27 ip-10-0-1-214 keycloak-postgres[7654]: 2024-06-09 15:08:27.279 UTC [15] LOG:  checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.075 s, sync=0.002 s, total=0.251 s; sync files=2, longest=0.001 s, average=0.001 s; distance=0 kB, estimate=0 kB; lsn>
Jun 09 15:08:27 ip-10-0-1-214 keycloak-postgres[7654]: 2024-06-09 15:08:27.588 UTC [1] LOG:  database system is shut down
Jun 09 15:08:32 ip-10-0-1-214 keycloak-postgres[7926]: Error response from daemon: No such container: keycloak-postgres
Jun 09 15:08:32 ip-10-0-1-214 keycloak-postgres[7940]: Error: No such container: keycloak-postgres
Jun 09 15:08:32 ip-10-0-1-214 systemd[1]: keycloak-postgres.service: Deactivated successfully.
Jun 09 15:08:32 ip-10-0-1-214 systemd[1]: keycloak-postgres.service: Consumed 1.721s CPU time.
hungrymonkey commented 5 months ago

Keycloak keeps sending restart posgres or kill commands after inital db.