Skip to content

Commit

Permalink
Expose payments service (#385)
Browse files Browse the repository at this point in the history
* Expose payments service

* Expose payments service
  • Loading branch information
YuryHrytsuk authored Oct 5, 2023
1 parent 6ba8a70 commit caf33c3
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
23 changes: 20 additions & 3 deletions scripts/common.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ endif
export DEPLOYMENT_FQDNS_CAPTURE_TRAEFIK_RULE_CATCHALL=$(shell set -o allexport; \
source $(REPO_CONFIG_LOCATION); \
if [ -z "$${DEPLOYMENT_FQDNS}" ]; then \
DEPLOYMENT_FQDNS_CAPTURE_TRAEFIK_RULE_CATCHALL="(Host(\`$$MACHINE_FQDN\`) && PathPrefix(\`/\`)) || (Host(\`invitations.${MACHINE_FQDN}\`)) || (HostRegexp(\`services.$$MACHINE_FQDN\`,\`{subhost:[a-zA-Z0-9-]+}.services.$$MACHINE_FQDN\`) && PathPrefix(\`/\`)) || (HostRegexp(\`services.testing.$$MACHINE_FQDN\`,\`{subhost:[a-zA-Z0-9-]+}.services.testing.$$MACHINE_FQDN\`) && PathPrefix(\`/\`))"; \
DEPLOYMENT_FQDNS_CAPTURE_TRAEFIK_RULE_CATCHALL="(Host(\`$$MACHINE_FQDN\`) && PathPrefix(\`/\`)) || (Host(\`invitations.${MACHINE_FQDN}\`)) || (Host(\`payments.${MACHINE_FQDN}\`)) || (HostRegexp(\`services.$$MACHINE_FQDN\`,\`{subhost:[a-zA-Z0-9-]+}.services.$$MACHINE_FQDN\`) && PathPrefix(\`/\`)) || (HostRegexp(\`services.testing.$$MACHINE_FQDN\`,\`{subhost:[a-zA-Z0-9-]+}.services.testing.$$MACHINE_FQDN\`) && PathPrefix(\`/\`))"; \
else \
IFS=', ' read -r -a hosts <<< "$${DEPLOYMENT_FQDNS}"; \
DEPLOYMENT_FQDNS_CAPTURE_TRAEFIK_RULE_CATCHALL="(Host(\`$$MACHINE_FQDN\`) && PathPrefix(\`/\`)) || (Host(\`invitations.${MACHINE_FQDN}\`)) || (HostRegexp(\`services.$$MACHINE_FQDN\`,\`{subhost:[a-zA-Z0-9-]+}.services.$$MACHINE_FQDN\`) && PathPrefix(\`/\`)) || (HostRegexp(\`services.testing.$$MACHINE_FQDN\`,\`{subhost:[a-zA-Z0-9-]+}.services.testing.$$MACHINE_FQDN\`) && PathPrefix(\`/\`))"; \
DEPLOYMENT_FQDNS_CAPTURE_TRAEFIK_RULE_CATCHALL="(Host(\`$$MACHINE_FQDN\`) && PathPrefix(\`/\`)) || (Host(\`invitations.${MACHINE_FQDN}\`)) || (Host(\`payments.${MACHINE_FQDN}\`)) || (HostRegexp(\`services.$$MACHINE_FQDN\`,\`{subhost:[a-zA-Z0-9-]+}.services.$$MACHINE_FQDN\`) && PathPrefix(\`/\`)) || (HostRegexp(\`services.testing.$$MACHINE_FQDN\`,\`{subhost:[a-zA-Z0-9-]+}.services.testing.$$MACHINE_FQDN\`) && PathPrefix(\`/\`))"; \
for element in "$${hosts[@]}"; \
do \
DEPLOYMENT_FQDNS_CAPTURE_TRAEFIK_RULE_CATCHALL="$$DEPLOYMENT_FQDNS_CAPTURE_TRAEFIK_RULE_CATCHALL || (Host(\`$$element\`) && PathPrefix(\`/\`)) || (Host(\`invitations.$$element\`)) || (HostRegexp(\`services.$$element\`,\`{subhost:[a-zA-Z0-9-]+}.services.$$element\`) && PathPrefix(\`/\`)) || (HostRegexp(\`services.testing.$$element\`,\`{subhost:[a-zA-Z0-9-]+}.services.testing.$$element\`) && PathPrefix(\`/\`))";\
DEPLOYMENT_FQDNS_CAPTURE_TRAEFIK_RULE_CATCHALL="$$DEPLOYMENT_FQDNS_CAPTURE_TRAEFIK_RULE_CATCHALL || (Host(\`$$element\`) && PathPrefix(\`/\`)) || (Host(\`invitations.$$element\`)) || (Host(\`payments.$$element\`)) || (HostRegexp(\`services.$$element\`,\`{subhost:[a-zA-Z0-9-]+}.services.$$element\`) && PathPrefix(\`/\`)) || (HostRegexp(\`services.testing.$$element\`,\`{subhost:[a-zA-Z0-9-]+}.services.testing.$$element\`) && PathPrefix(\`/\`))";\
done; \
DEPLOYMENT_FQDNS_CAPTURE_TRAEFIK_RULE_CATCHALL="$$DEPLOYMENT_FQDNS_CAPTURE_TRAEFIK_RULE_CATCHALL"; \
fi; \
Expand All @@ -89,6 +89,22 @@ export DEPLOYMENT_FQDNS_CAPTURE_INVITATIONS=$(shell set -o allexport; \
echo $$DEPLOYMENT_FQDNS_CAPTURE_INVITATIONS; \
set +o allexport; )
export DEPLOYMENT_FQDNS_CAPTURE_PAYMENTS=$(shell set -o allexport; \
source $(REPO_CONFIG_LOCATION); \
if [ -z "$${DEPLOYMENT_FQDNS}" ]; then \
DEPLOYMENT_FQDNS_CAPTURE_PAYMENTS="(Host(\`payments.${MACHINE_FQDN}\`))"; \
else \
IFS=', ' read -r -a hosts <<< "$${DEPLOYMENT_FQDNS}"; \
DEPLOYMENT_FQDNS_CAPTURE_PAYMENTS="(Host(\`payments.${MACHINE_FQDN}\`))"; \
for element in "$${hosts[@]}"; \
do \
DEPLOYMENT_FQDNS_CAPTURE_PAYMENTS="$$DEPLOYMENT_FQDNS_CAPTURE_PAYMENTS || (Host(\`payments.$$element\`))";\
done; \
DEPLOYMENT_FQDNS_CAPTURE_PAYMENTS="$$DEPLOYMENT_FQDNS_CAPTURE_PAYMENTS"; \
fi; \
echo $$DEPLOYMENT_FQDNS_CAPTURE_PAYMENTS; \
set +o allexport; )
export DEPLOYMENT_FQDNS_CAPTURE_TRAEFIK_RULE_MAINTENANCE_PAGE=$(shell set -o allexport; \
source $(REPO_CONFIG_LOCATION); \
if [ -z "$${DEPLOYMENT_FQDNS}" ]; then \
Expand Down Expand Up @@ -199,6 +215,7 @@ clean-default: .check_clean ## Cleans all outputs
export DEPLOYMENT_FQDNS_TESTING_CAPTURE_TRAEFIK_RULE='${DEPLOYMENT_FQDNS_TESTING_CAPTURE_TRAEFIK_RULE}'; \
export DEPLOYMENT_API_DOMAIN_TESTING_CAPTURE_TRAEFIK_RULE='${DEPLOYMENT_API_DOMAIN_TESTING_CAPTURE_TRAEFIK_RULE}'; \
export DEPLOYMENT_FQDNS_CAPTURE_INVITATIONS='${DEPLOYMENT_FQDNS_CAPTURE_INVITATIONS}'; \
export DEPLOYMENT_FQDNS_CAPTURE_PAYMENTS='${DEPLOYMENT_FQDNS_CAPTURE_PAYMENTS}'; \
export DOLLAR='$$'; \
set +o allexport; \
envsubst < $< > .env
Expand Down
21 changes: 21 additions & 0 deletions services/simcore/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,27 @@ services:
placement:
constraints:
- node.labels.ops==true

payments:
deploy:
placement:
constraints:
- node.labels.simcore==true
labels:
- traefik.enable=true
- io.simcore.zone=${TRAEFIK_SIMCORE_ZONE}
- traefik.http.routers.${SWARM_STACK_NAME}_payments_api.service=${SWARM_STACK_NAME}_payments
- traefik.http.routers.${SWARM_STACK_NAME}_payments_api.rule=${DEPLOYMENT_FQDNS_CAPTURE_PAYMENTS} && PathPrefix(`/v1`)
- traefik.http.routers.${SWARM_STACK_NAME}_payments_api.entrypoints=http
- traefik.http.routers.${SWARM_STACK_NAME}_payments_api.priority=5
- traefik.http.services.${SWARM_STACK_NAME}_payments.loadbalancer.server.port=8000
- traefik.http.routers.${SWARM_STACK_NAME}_payments.service=${SWARM_STACK_NAME}_payments
- traefik.http.routers.${SWARM_STACK_NAME}_payments.rule=(${DEPLOYMENT_FQDNS_CAPTURE_PAYMENTS})
- traefik.http.routers.${SWARM_STACK_NAME}_payments.entrypoints=http
- traefik.http.routers.${SWARM_STACK_NAME}_payments.priority=50
- traefik.http.middlewares.${SWARM_STACK_NAME_NO_HYPHEN}_payments_auth.basicauth.users=${TRAEFIK_USER}:${TRAEFIK_PASSWORD}
- traefik.http.routers.${SWARM_STACK_NAME}_payments.middlewares=${SWARM_STACK_NAME_NO_HYPHEN}_payments_auth, ${SWARM_STACK_NAME_NO_HYPHEN}_sslheader

volumes:
rabbit_data:
name: ${SWARM_STACK_NAME}_rabbit_data
Expand Down
1 change: 1 addition & 0 deletions services/simcore/template.env
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ DEPLOYMENT_FQDNS_CAPTURE_TRAEFIK_RULE_CATCHALL='${DEPLOYMENT_FQDNS_CAPTURE_TRAEF
DEPLOYMENT_FQDNS_TESTING_CAPTURE_TRAEFIK_RULE='${DEPLOYMENT_FQDNS_TESTING_CAPTURE_TRAEFIK_RULE}'
DEPLOYMENT_API_DOMAIN_TESTING_CAPTURE_TRAEFIK_RULE='${DEPLOYMENT_API_DOMAIN_TESTING_CAPTURE_TRAEFIK_RULE}'
DEPLOYMENT_FQDNS_CAPTURE_INVITATIONS='${DEPLOYMENT_FQDNS_CAPTURE_INVITATIONS}'
DEPLOYMENT_FQDNS_CAPTURE_PAYMENTS='${DEPLOYMENT_FQDNS_CAPTURE_PAYMENTS}'

EC2_ACCESS_KEY_ID=${AUTOSCALING_EC2_ACCESS_KEY_ID}
EC2_SECRET_ACCESS_KEY=${AUTOSCALING_EC2_SECRET_ACCESS_KEY}
Expand Down

0 comments on commit caf33c3

Please sign in to comment.