commit 8149974354ae9804b5cf2df19b496b23e04973fe Author: Julian Foad Date: Fri Feb 2 14:17:44 2024 +0000 quant-ux: new role diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..6f34172 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,18 @@ +--- +qux_domain: ~ + +# addressing: fe=FrontEnd service, ws=WebSocket service +# port number to bind, or null (~) not to bind +qux_fe_host_bind_port: ~ # e.g. 8082 +qux_ws_host_bind_port: ~ # e.g. 8086 + +qux_jwt_password: ~ + +qux_home: /home/qux + +qux_docker_image_mongo: mongo:7.0.5 +#qux_docker_image_fe: bmcgonag/qux-fe:2.2.0 +#qux_docker_image_be: bmcgonag/qux-be:2.2.0 +qux_docker_image_fe: klausenschaefersinho/quant-ux +qux_docker_image_be: klausenschaefersinho/quant-ux-backend +qux_docker_image_ws: klausenschaefersinho/quant-ux-websocket diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..a290cf7 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,10 @@ +--- +- name: "home dir" + file: state=directory path="{{ qux_home }}" + +- name: "config file" + template: src="docker-compose.yml.j2" dest="{{ qux_home }}/docker-compose.yml" + +- name: "docker compose up" + command: + cmd: "docker compose --project-directory={{ qux_home }} up --remove-orphans -d" diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 new file mode 100644 index 0000000..17cfe25 --- /dev/null +++ b/templates/docker-compose.yml.j2 @@ -0,0 +1,71 @@ +version: '3' + +services: + mongo: + restart: always + container_name: quant-ux-mongo + image: "{{ qux_docker_image_mongo }}" + volumes: + - ./data:/data/db # pth for the data to be stored and kept on your host machine is on the left side of the ":" + qux-fe: + restart: always + container_name: quant-ux-frontend + image: "{{ qux_docker_image_fe }}" + environment: + - QUX_PROXY_URL=http://quant-ux-backend:8080 # this is the path the front end uses to talk tot he backend + - QUX_WS_URL=wss://ws.{{ qux_domain }} # change to where the websocket server is deployed for external access + links: + - mongo + - qux-be + ports: + - "{{ qux_fe_host_bind_port ~ ':8082' if qux_fe_host_bind_port else '8082' }}" + depends_on: + - qux-be + labels: + traefik.enable: "true" + traefik.http.routers.qux-fe.entryPoints: "web_https" + traefik.http.routers.qux-fe.rule: "Host(`{{ qux_domain }}`)" + qux-be: + restart: always + container_name: quant-ux-backend + image: "{{ qux_docker_image_be }}" + volumes: + - ./quant-ux-data:/app-data + environment: + - QUX_HTTP_HOST=http://quant-ux-frontend:8082 # this is the path the backend uses to talk to the front end + - QUX_HTTP_PORT=8080 # This is the port the backend will use + - QUX_MONGO_DB_NAME=quantux # the database / collection name in mongodb + - QUX_MONGO_TABLE_PREFIX=quantux # table / document prefix in mongodb + - QUX_MONGO_CONNECTION_STRING=mongodb://quant-ux-mongo:27017 # this assumes your mongodb container will be called "quant-ux-mongo" in the docker-compose file + - QUX_MAIL_USER=mail_admin@example.com # this should be your smtp email user + - QUX_MAIL_PASSWORD=sTr0ngPa55w0Rd # this should be your smtp email password + - QUX_MAIL_HOST=mail.example.com # this should be your smtp host address + - QUX_JWT_PASSWORD="{{ qux_jwt_password }}" + - QUX_IMAGE_FOLDER_USER=/app-data/qux-images # this folder should mapped in the volume + - QUX_IMAGE_FOLDER_APPS=/app-data/qux-image-apps # this folder should mapped in the volume + - QUX_DEBUG=true # valid values are true or false + - TZ={{ tz }} + depends_on: + - mongo + qux-ws: + restart: always + container_name: quant-ux-websocket-server + image: klausenschaefersinho/quant-ux-websocket + environment: + - QUX_SERVER=http://quant-ux-backend:8080/ + - QUX_SERVER_PORT=8086 + ports: + - "{{ qux_ws_host_bind_port ~ ':8086' if qux_ws_host_bind_port else '8086' }}" + links: + - qux-be + depends_on: + - qux-be + labels: + traefik.enable: "true" + traefik.http.routers.qux-ws.entryPoints: "web_https" + traefik.http.routers.qux-ws.rule: "Host(`ws.{{ qux_domain }}`)" + +networks: + default: + name: servicenet + external: true