What is the recommended way to set up Flyway on an Octopus Deploy worker?

I am unable to find documentation on setting up Flyway on an Octopus Deploy worker. We are unable to use an execution container at this time.

We have licenses for Flyway enterprise. 

What flyway product should be downloaded? Where should it be downloaded? What else should be done?

Best Answer

  • Options
    Jon_KirkwoodJon_Kirkwood Posts: 334 Silver 4

    Hi @john123456


    Thank you for reaching out on the Redgate forums regarding your Flyway & Octopus Deploy inquiry.

    I can certainly see that Octopus have published guides for running Flyway with Execution Containers 


    However, there doesn't appear to be much published for running it on a worker. 

    I don't have full knowledge of what the Octopus Deploy workers can function as, but this information below is a high level outline on how we would anticipate it to be setup  

    • Which Flyway Product to Download: For Flyway Enterprise, you'll want to download the Flyway Command-line Tool. The Enterprise version includes additional features over the Community version, like undo migrations and more.


    • Installation Steps:
    • Configuring Flyway:
      • Configuration File: Flyway can be configured via a flyway.toml file (link). Place your database connection settings, locations of your migration scripts, and any other Flyway configurations here.
      • Environment Variables: Alternatively, you can configure Flyway using environment variables, which might be easier to manage via Octopus Deploy variables for different environments.
    • Octopus Deploy Project Setup:
      • Create a new project for your database migrations or integrate into an existing project.
      • Add a deployment step that runs a script. This script will execute the Flyway command-line tool using PowerShell or Bash, depending on your worker's OS.
    • Script Example: Here’s a PowerShell snippet for running Flyway:
    $flywayPath = "C:\Tools\Flyway\flyway.cmd"
    $dbUrl = "yourDatabaseUrl"
    $dbUser = "yourDatabaseUser"
    $dbPassword = "yourDatabasePassword"
    & $flywayPath migrate -url=$dbUrl -user=$dbUser -password=$dbPassword

    Adjust the paths and variables to suit your setup. Make sure to use Octopus variables for sensitive information like passwords.

    • Testing: Before running this in production, test your setup in a development environment to ensure everything works as expected.
    • Version Control: Keep your Flyway configurations and SQL migration scripts in version control to manage changes over time efficiently.


    Some guides from our documentation for deployment into CI/CD pipelines can be found here: 




    Hope this assists with your inquiry

    Jon Kirkwood | Technical Support Engineer | Redgate Software


Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file