This commit is contained in:
Zeev Diukman 2024-08-22 07:30:50 +03:00
parent 9a868bb5f8
commit c321fb8aab
6 changed files with 62 additions and 2 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
docker/keycloak/postgres

View file

View file

@ -15,14 +15,17 @@ func init() {
fmt.Println("ZPROX started") fmt.Println("ZPROX started")
} }
func handler1(w http.ResponseWriter, r *http.Request) { func handler1(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("HELLO ZPROX")) if r.Host == "test.diukman.com" {
w.Write([]byte("H1"))
} }
}
func main() { func main() {
router := http.NewServeMux() router := http.NewServeMux()
router.Handle("/", http.HandlerFunc(handler1)) router.Handle("/", http.HandlerFunc(handler1))
srv := &http.Server{ srv := &http.Server{
Addr: ":80", Addr: ":8080",
Handler: router, Handler: router,
} }

55
docker-compose.yml Normal file
View file

@ -0,0 +1,55 @@
services:
account:
build:
context: ./app
target: builder
image: account
expose:
- "8080"
environment:
- ENV=dev
volumes:
- ./app:/go/src/app
# have to use $$ (double-dollar) so docker doesn't try to substitute a variable
command: reflex -r "\.go$$" -s -- sh -c "go run ./"
postgres:
image: postgres:latest
restart: always
environment:
- POSTGRES_USER=keycloak
- POSTGRES_DB=keycloak
- POSTGRES_PASSWORD=keycloak
volumes:
- './docker/keycloak/postgres:/var/lib/postgresql/data'
networks:
postgres:
keycloak:
depends_on:
- postgres
image: quay.io/keycloak/keycloak:latest
restart: unless-stopped
command: start
ports:
- 4000:8080
networks:
postgres:
environment:
- KC_PROXY_ADDRESS_FORWARDING=true
- KC_HOSTNAME_STRICT=false
- KC_HOSTNAME=keycloak.diukman.com
# - KC_HOSTNAME_URL=10.0.0.2:4000
# - KC_HOSTNAME_ADMIN_URL=keycloak.diukman.com
# - KC_PROXY=edge
- KC_HTTP_ENABLED=true
- KC_DB=postgres
- KC_DB_USERNAME=keycloak
- KC_DB_PASSWORD=keycloak
- KC_DB_URL_HOST=postgres
- KC_DB_URL_PORT=5432
- KC_DB_URL_DATABASE=keycloak
- KEYCLOAK_ADMIN=admin
- KEYCLOAK_ADMIN_PASSWORD=admin
labels:
- "quarkus.transaction-manager.enable-recovery=true"
networks:
postgres:

View file

@ -0,0 +1 @@
keycloak docker