User Role: Administrator, Operator, Editor
Sometimes users need to secure where jobs are created and executed behind a firewall. Dispatching a job with a self-hosted runner allows you to create jobs locally on your internal file system, run it at a later time, and even run multiple jobs simultaneously in batches.
We recommend using Docker to manage your self-hosted runner because it implements the same container for all hosts, whether you are running on Linux, MacOS, or Windows. This method ensures that Liquibase delivers database changes seamlessly and that no conflicts with host configurations occur. It also shields the host from security issues, interacting only with the Docker container and not the host.
Users are only able to use the self-hosted runner via the downloadable CLI.
Generate a Personal Access Token with Operator, Editor, or Administrator privileges
Obtain the instance subdomain
Example: yourcompany from https://yourcompany.liquibase.io
Download Liquibase IO CLI
Download the Liquibase IO CLI.
Extract the executable to a path of your choice. It can run from inside a directory or the system path.
Locate the instance subdomain.
Example: yourcompany from https://yourcompany.liquibase.io
Obtain a Personal Access Token (PAT) with Editor, Operator, or Administrator privileges by following this guide.
The initial run of any CLI command will prompt you to enter the subdomain and PAT which will be saved to your configuration file, liquibase-io-config.yaml.
Note: These values can also be set as environment variables. The Liquibase IO CLI will prompt the user for these values as needed so ensure they are easily accessible.
environment variable syntax:
LBIO_API_URL
LBIO_ACCESS_TOKEN
Install the Liquibase IO Runner
The Liquibase IO Runner consists of a JRE and Liquibase jar files.
If you are using a Docker container, navigate to the CLI and run the command: lbio runner install --runtime docker
OR
If you are using a local file system, navigate to the CLI and run the command: lbio runner install
A status will appear that states: Runner installed
As a Docker desktop user that utilizes the local installation, you may encounter this error:
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
This is due to Docker Desktop machine installation changes that affect the install location.
To fix this, you can create a symbolic link from the original Docker installation location to point to the place it is actually installed.
Run this in the CLI to create the symbolic link:
sudo ln -s ~/Library/Containers/com.docker.docker/Data/docker.raw.sock /var/run/docker.sock
3. To ensure your installation is complete, run the command: lbio runner check
A status will appear that says: Runner installation is complete.
Note: To see a list of all available Liquibase IO CLI commands, run lbio --help
Local connections must initially be tested through the CLI. Once the connection is created in the Web GUI, the CLI can test it from the location where jobs will run.
Prerequisites
If a connection does not exist, see instructions to Create a Database Connection
Step-by-step
From the CLI, locate your database's connection ID by running the command: lbio connection ls
You will see a list of all databases you can connect to. Find the connection ID on the left; we will use 204 in this example.
Type the test command: lbio connection test 204
This message will appear in the CLI when the connection is successful:
Liquibase command 'connect' was executed successfully.
Run a Workflow locally
Navigate to the Projects page and select which project you want to run locally from the list. In this example, we will select Sample Project.
If you don't have an existing Project, learn how to here: Create a Project.
2. From the individual Project page, select the vertical three-dot icon and select Edit from the drop-down menu.
3. From the Edit Project page, locate the workflow number in the url. In the example below, the workflow number is 101.
4. Navigate back to the CLI and run lbio workflow run 101 --dispatch to run the job.
5. Optional: You can create jobs and then dispatch them at a later time. This allows you to create several separate jobs and then dispatch them all at once if some jobs are dependent of other jobs.
1. To create the job from the CLI, run lbio workflow run 101
The Job UUID will appear. Once at this stage, the Job will be Pending on the Jobs page until you dispatch or cancel this job. This is because the AWS runner will not pick up this job; it is waiting for the local Liquibase IO Runner to pick it up.
2. Run the lbio job dispatch <job-uuid> command to run an individual job.
Or run lbio job dispatch --all to dispatch all pending jobs.
The job is dispatched successfully.
You can dispatch one or several jobs at the same time.
Logs will generate in the CLI, and in the UI the job status is In Progress on the Jobs page and the Related Jobs tab of a project.