Skip to content

Latest commit

 

History

History
107 lines (88 loc) · 3.54 KB

README.md

File metadata and controls

107 lines (88 loc) · 3.54 KB

flashcard-kt ::: deploy

The directory contains docker-composer files allowing to set up environment.

docker-compose-app.yml:

  • flashcards-db (postgres). it is requires by :db-pg
  • flashcards-keycloak. Authorization (demo:demo).
  • flashcards-nats (transport)
  • flashcards-redis (cache)
  • flashcards-tts-server
  • flashcards-cards-server
  • flashcards-dictionaries-server
  • flashcards-app

docker-compose-elk-stack.yml

URLs:

Build tts-server & cards-server & dictionaries-server & app images (see build-images script):

docker rm tutor-deploy-flashcards-tts-server-1
docker rm tutor-deploy-flashcards-cards-server-1
docker rm tutor-deploy-flashcards-dictionaries-server-1
docker rm tutor-deploy-flashcards-app-1

docker rmi sszuev/open-tutor-tts-server:2.0.0-snapshot
docker rmi sszuev/open-tutor-cards-server:2.0.0-snapshot
docker rmi sszuev/open-tutor-dictionaries-server:2.0.0-snapshot
docker rmi sszuev/open-tutor:2.0.0-snapshot

cd ..
gradle clean build -x test
cd ./app-tts
gradle dockerBuildImage
cd ../app-cards
gradle dockerBuildImage
cd ../app-dictionaries
gradle dockerBuildImage
cd ../app-ktor
gradle dockerBuildImage
cd ../tutor-deploy

Example commands to deploy environment:

docker-compose -f docker-compose-app.yml up flashcards-db flashcards-keycloak flashcards-nats 
docker-compose -f docker-compose-app.yml up flashcards-tts-server flashcards-dictionaries-serve flashcards-cards-server flashcards-app
docker-compose -f docker-compose-elk-stack.yml -p flashcards-elk-stack up

HTTPS, localhost

  1. generate self-signed certificates:
mkdir tutor-deploy/data/envoy/certs
cd tutor-deploy/data/envoy/certs
openssl genrsa -out server.key 2048
openssl req -new -x509 -key server.key -out server.crt -days 365 -subj "/CN=localhost"
chmod 644 server.crt server.key
  1. configure envoy.yml:
  • set port_value: 443
  • issuer: "https://localhost/realms/flashcards-realm"
  • under filters add following section:
        - filters
          ...
          transport_socket:
            name: envoy.transport_sockets.tls
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext
              common_tls_context:
                tls_certificates:
                  - certificate_chain:
                      filename: "/etc/envoy/certs/server.crt"
                    private_key:
                      filename: "/etc/envoy/certs/server.key"
  1. change docker-compose-app.yml:
  • for flashcards-keycloak: KC_HOSTNAME_URL: "https://localhost/" & KC_HOSTNAME_ADMIN_URL: "https://localhost/" & KC_HOSTNAME_PORT: "443"
  • for flashcards-envoy: ports: - "443:443" & uncomment - "${DATA_DIR}/envoy/certs:/etc/envoy/certs"
  • for flashcards-app KEYCLOAK_AUTHORIZE_ADDRESS: "https://localhost" & KEYCLOAK_REDIRECT_ADDRESS: "https://localhost"
  1. docker-compose -f docker-compose-app.yml up
  2. go to https://localhost/admin/master/console -> flashcards-realm -> flashcards-client
  3. set redirect url to https://localhost/*
  4. the application should be available via https://localhost/