Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: migrate to graphile worker v0.16.6 #1097

Merged
merged 4 commits into from
May 10, 2024
Merged

perf: migrate to graphile worker v0.16.6 #1097

merged 4 commits into from
May 10, 2024

Conversation

nicktrn
Copy link
Collaborator

@nicktrn nicktrn commented May 10, 2024

Closes #396

Testing

Migration

  1. Create this docker-compose.yml
version: "3"

volumes:
  db-data:
  redis-data:

networks:
  app_network:
    external: false

x-env: &env
  LOGIN_ORIGIN: http://localhost:3030
  APP_ORIGIN: http://localhost:3030
  PORT: 3030
  REMIX_APP_PORT: 3030
  MAGIC_LINK_SECRET: secret
  SESSION_SECRET: secret
  ENCRYPTION_KEY: ae13021afef0819c3a307ad487071c06
  DATABASE_URL: &db-url postgresql://postgres:postgres@db:5432/postgres
  DIRECT_URL: *db-url
  GRACEFUL_SHUTDOWN_TIMEOUT: 5000
  NODE_ENV: production
  RUNTIME_PLATFORM: docker-compose
  TRIGGER_LOG_LEVEL: debug
  REDIS_HOST: redis
  REDIS_PORT: 6379
  REDIS_TLS_DISABLED: "true"
  V3_ENABLED: "true"

services:
  old-webapp:
    image: &old-webapp ghcr.io/triggerdotdev/trigger.dev:main@sha256:d384445f6b279bec498d78ee11626aee164eeba07975cbdee8b3120f7e2efb8d
    restart: "no"
    environment:
      <<: *env
      WORKER_ENABLED: "false"
      EXECUTION_WORKER_ENABLED: "false"
      TASK_OPERATION_WORKER_ENABLED: "false"
    ports:
      - 3065:3030
    depends_on:
      - db
    networks:
      - app_network

  old-workers:
    image: *old-webapp
    restart: "no"
    environment:
      <<: *env
      HTTP_SERVER_DISABLED: "true"
    depends_on:
      - db
    networks:
      - app_network

  new-webapp:
    image: &new-webapp ghcr.io/triggerdotdev/trigger.dev:graphile-upgrade-rc.1
    restart: always
    environment:
      <<: *env
      WORKER_ENABLED: "false"
      EXECUTION_WORKER_ENABLED: "false"
      TASK_OPERATION_WORKER_ENABLED: "false"
    ports:
      - 3030:3030
    depends_on:
      - db
    networks:
      - app_network

  new-workers:
    image: *new-webapp
    restart: always
    environment:
      <<: *env
      HTTP_SERVER_DISABLED: "true"
    depends_on:
      - db
    networks:
      - app_network

  db:
    image: postgres:14
    restart: always
    volumes:
      - db-data:/var/lib/postgresql/data/
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: postgres
    networks:
      - app_network
    ports:
      - 3085:5432

  redis:
    image: redis:7
    restart: always
    volumes:
      - redis-data:/data
    networks:
      - app_network
    ports:
      - 3086:6379
  1. Start up the DB
docker-compose up -d db redis
  1. Start up the old webapp and workers
docker-compose up old-webapp old-workers
  1. In another window, start up the new webapp and workers
docker-compose up new-webapp new-workers
  1. To delete the DB and start again, maybe after altering some env vars
docker-compose down -v

Changelog

  • Upgrade to v0.16.6
  • Detect migration errors
  • Add migration delay to allow graceful shutdown to complete (rolling deploy)

Screenshots

graphile-migration

馃挴

Copy link

changeset-bot bot commented May 10, 2024

鈿狅笍 No Changeset found

Latest commit: e0c463b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@matt-aitken matt-aitken merged commit 1642fd7 into main May 10, 2024
2 checks passed
@nicktrn nicktrn deleted the graphile-upgrade branch May 10, 2024 17:07
jacobparis pushed a commit to jacobparis/trigger.dev that referenced this pull request May 15, 2024
* migrate to graphile worker v0.16.6

* remove stale docs link

* fix jobs cleanup query
jacobparis pushed a commit to jacobparis/trigger.dev that referenced this pull request May 21, 2024
* migrate to graphile worker v0.16.6

* remove stale docs link

* fix jobs cleanup query
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TRI-1152] chore: upgrade webapp to use graphile-worker 0.14.0-rc.0
2 participants