Skip to content

Run ubyssey.ca and thoth.ubyssey.ca as isolated apps on Docker Swarm VM #1

@Nishim12

Description

@Nishim12

This documents our setup for running both ubyssey.ca and thoth.ubyssey.ca as isolated apps on a single Docker Swarm VM:

  1. Separate Compose Files:
    • /opt/ubyssey.ca/docker-compose.yml for ubyssey
    • /opt/thoth/docker-compose.yml for thoth
  2. Separate Swarm Stacks:
    • Deploy with docker stack deploy -c /opt/ubyssey.ca/docker-compose.yml ubyssey
    • Deploy with docker stack deploy -c /opt/thoth/docker-compose.yml thoth
  3. Shared Overlay Network:
    • docker network create --driver=overlay proxy-shared
  4. Service Attachment:
    • Both compose files reference proxy-shared and attach services that need to communicate (e.g., nginx, thothbackend, thothfrontend)
  5. Single Public Entrypoint (Nginx):
    • Nginx runs in the ubyssey stack
    • Handles routing for ubyssey.ca and thoth.ubyssey.ca
    • Reverse proxies requests via the shared network to appropriate backend containers
  6. CI/CD Isolation:
    • Deployments for each app only update their own stack
    • No cross-deployment: ubyssey repo only deploys ubyssey stack, thoth repo only deploys thoth stack

This ensures clean separation, security, and control over deployments for each app.


Implementation To-Do:

  • Create a new branch in thoth-frontend for CI improvements
  • Integrate the following GitHub Actions steps to trigger deployment in thoth:
- name: Create a GitHub App token
  id: app-token
  uses: actions/create-github-app-token@v1
  with:
    app-id: ${{ secrets.GH_APP_ID }}
    private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
    owner: ubyssey
    repositories: thoth

- name: Trigger deploy-production workflow in thoth
  env:
    GH_TOKEN: ${{ steps.app-token.outputs.token }}
  run: |
    curl -X POST \
      -H "Authorization: Bearer $GH_TOKEN" \
      -H "Accept: application/vnd.github+json" \
      https://api.github.com/repos/ubyssey/thoth/actions/workflows/deploy-production.yml/dispatches \
      -d '{"ref":"1-run-ubysseyca-and-thothubysseyca-as-isolated-apps-on-docker-swarm-vm"}'
  • Commit and test the workflow integration.
  • Document the changes in the repository.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions