How to migrate old uploads to S3?

I just switched my instance from local to S3 uploads and I could not for the life of me figure out how to get the S3 migrator to work. In the interest of anyone else who stops by this topic, I will summarize the required steps here.

  1. Enable S3 Uploads in the admin interface and set all of the required S3 keys and settings so new uploads are sent to S3
  2. Add the required DISCOURSE_S3_ env variables to the env section of app.yml
    Example:
  DISCOURSE_S3_BUCKET: your-bucket-name
  DISCOURSE_S3_REGION: your-s3-bucket-region
  DISCOURSE_S3_ACCESS_KEY_ID: your-s3-access-key-id
  DISCOURSE_S3_SECRET_ACCESS_KEY: your-s3-secret-access-key
  1. Rebuild your app with ./launcher rebuild app
  2. Enter the app with ./launcher enter app
  3. Run rails uploads:migrate_to_s3 from within the docker container.

I initially tried to run the command using ./launcher run app rails uploads:migrate_to_s3 but it couldn’t find the task.

4 Likes