Skip to content

Deployment

GitHub Actions

Deployments run via .github/workflows/deploy.yml when: - Pushing to main with "Deploy" in the commit message (case-insensitive) - Manual trigger: Actions → Deploy → Run workflow

Required GitHub secrets: - FLY_API_TOKEN — for deploying both apps, use flyctl auth token (user-level). Deploy tokens (flyctl tokens create deploy) are app-specific and will cause "unauthorized" for the second app. - AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_ENDPOINT_URL_S3, AWS_BUCKET — pushed to Fly.io at deploy time for both apps - GITHUB_DEPLOY_TOKEN (optional) — for build and runtime; falls back to GITHUB_TOKEN if unset

Manual deployment

The app can be deployed to fly.io manually using the following steps:

  1. Install the flyctl CLI tool from fly.io

  2. Log in to fly.io:

    flyctl auth login
    

  3. Source environment to get GITHUB_TOKEN

       source .Renviron
    

  4. Deploy the app:

    fly deploy -c flyApp.toml --build-arg GITHUB_TOKEN=$GITHUB_TOKEN
    fly deploy -c flyEngine.toml --build-arg GITHUB_TOKEN=$GITHUB_TOKEN --flycast
    

  5. Scale the app:

    fly scale count 10
    

  6. Set secrets (choose one):

From GitHub Secrets (when using the deploy workflow): add via GitHub CLI:

# From .Renviron (source first)
source .Renviron
gh secret set FLY_API_TOKEN --body "$(flyctl auth token)"
gh secret set AWS_ACCESS_KEY_ID --body "$AWS_ACCESS_KEY_ID"
gh secret set AWS_SECRET_ACCESS_KEY --body "$AWS_SECRET_ACCESS_KEY"
gh secret set AWS_ENDPOINT_URL_S3 --body "$AWS_ENDPOINT_URL_S3"
gh secret set AWS_BUCKET --body "$AWS_BUCKET"
gh secret set GITHUB_DEPLOY_TOKEN --body "$GITHUB_TOKEN"

# Or set individually (gh will prompt for each value)
gh secret set FLY_API_TOKEN
gh secret set AWS_ACCESS_KEY_ID
gh secret set AWS_SECRET_ACCESS_KEY
gh secret set AWS_ENDPOINT_URL_S3
gh secret set AWS_BUCKET
gh secret set GITHUB_DEPLOY_TOKEN

From GitHub Secrets (when using the deploy workflow): add AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_ENDPOINT_URL_S3, AWS_BUCKET to the repo’s Actions secrets. The workflow pushes them to Fly.io on each deploy.

From .Renviron (manual deploy):

source .Renviron
flyctl secrets set AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID -a fprs-app
flyctl secrets set AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY -a fprs-app
flyctl secrets set AWS_ENDPOINT_URL_S3=$AWS_ENDPOINT_URL_S3 -a fprs-app
flyctl secrets set AWS_BUCKET=$AWS_BUCKET -a fprs-app
flyctl secrets set GITHUB_TOKEN=$GITHUB_TOKEN -a fprs-app

flyctl secrets set AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID -a fprs-engine
flyctl secrets set AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY -a fprs-engine
flyctl secrets set AWS_ENDPOINT_URL_S3=$AWS_ENDPOINT_URL_S3 -a fprs-engine
flyctl secrets set AWS_BUCKET=$AWS_BUCKET -a fprs-engine
flyctl secrets set GITHUB_TOKEN=$GITHUB_TOKEN -a fprs-engine

The app will be available at https://research-strategy.fly.dev/

Local Docker Deployment

To run the app locally using Docker:

  1. Build the Docker image:
    docker build -f DockerfileApp -t fprsapp --build-arg GITHUB_TOKEN=$GITHUB_TOKEN .
    docker build -f DockerfileEngine -t fprsengine --build-arg GITHUB_TOKEN=$GITHUB_TOKEN .
    ``
    
    2. Run the container:
    ```bash
    docker run -p 3838:3838 research-prioritization
    

The app will be available at http://localhost:3838