New! – Spin up instant copies of your dev databases in the cloud for free Learn more

Flyway Documentation

Poll

Getting started: Installation

Spawn makes it easy to create disposable copies of databases for your development environment, and to automate them within DevOps pipelines. It uses a command line interface to create and manage those copies, and to make scripting and automation simple.

This tutorial will walk you through installing Spawn, using a database copy and creating an image of your own data from which you can further copies.

Create a Spawn account

Login to the Spawn web app to create your account.

Login with GitHub

Installation

1. Download and run the install script

> curl -sL https://run.spawn.cc/install | sh

2. Add spawnctl to your path

> export PATH=$PATH:$HOME/.spawnctl/bin
Note: Spawn also supports Raspberry Pi (ARM-based Linux operating systems). Please follow the standard installation instructions for Linux above.

1. Download spawnctl.exe and save it to a folder of your choosing.

Note: spawnctl.exe is not an installer, it's a command line executable that can be run directly. We suggest creating the folder C:\Program Files\Spawn and saving it there.

2. Add the folder containing spawnctl.exe to your path.

Note: Search for View advanced system settings from the Windows start menu and click the Environment Variables button to edit the Path variable. You may need to restart your terminal after doing this.

Authenticate spawnctl with your Spawn account

Authenticate spawnctl to link your account

> spawnctl auth

Create a copy of a sample database

Spawn instantly creates copies of databases as cloud-hosted containers and passes the connection details back to you. These copies are called data containers. The data containers are created from data images -- prepared images of the database you want to copy, complete with all the data and configuration.

To make it easy to get started we've created some public data images based on familiar sample databases.

Create a copy of the PostgreSQL Pagila demo database by running

> spawnctl create data-container --image pagila:v11 --name spawn-tutorial --lifetime 1h
Note: The `--name` flag is optional. If you don't specify a name a random one will be generated for you based on the image name.

Spawn creates the database copy and returns the connection details:

Data container 'spawn-tutorial' (97477) created!
    -> Host=instances.spawn.cc;Port=32194;Username=<some_user_id>;Database=postgres;Password=<some_password>

Using pgAdmin (or your preferred client) you can connect to this database as normal. Copy in the server name and port, the username and password and click Connect.

This database copy is a full version of PostgreSQL running in a container. You can use it just like any other, querying and updating as normal.

List data containers to see the one that was just created:

> spawnctl get data-containers
ID    Name           Revision Status     Engine            CreatedAt
97477 spawn-tutorial rev.0    Completed  PostgreSQL:11.0   29 seconds ago

Create a copy of the MySQL Sakila demo database by running

> spawnctl create data-container --image sakila:v5.7 --name spawn-tutorial --lifetime 1h
Note: The `--name` flag is optional. If you don't specify a name a random one will be generated for you based on the image name.

Spawn creates the database copy and returns the connection details:

Data container 'spawn-tutorial' (97479) created!
-> Server=instances.spawn.cc;Port=30635;User Id=root;Database=mysql;Password=<some_password>

Using MySQL Workbench (or your preferred client) you can connect to this database as normal. Copy in the server name and port, the username and password and click Connect.

This database copy is a full version of MySQL running in a container. You can use it just like any other, querying and updating as normal.

List data containers to see the one that was just created:

> spawnctl get data-containers
ID    Name           Revision Status     Engine            CreatedAt
97479 spawn-tutorial rev.0    Completed  MySQL:5.7         34 seconds ago

Create a copy of the SQL Server Wide World Importers demo database by running

> spawnctl create data-container --image wide-world-importers:2017 --name spawn-tutorial --lifetime 1h
Note: The `--name` flag is optional. If you don't specify a name a random one will be generated for you based on the image name.

Spawn creates the database copy and returns the connection details:

Data container 'spawn-tutorial' (97484) created!
-> Data Source=instances.spawn.cc,32598;Initial Catalog=master;User ID=sa;Password=<some_password>

Using SSMS (or your preferred client) you can connect to this database as normal. Copy in the server name and port, the username and password and click Connect.

This database copy is a full version of SQL Server running in a container. You can use it just like any other, querying and updating as normal.

List data containers to see the one that was just created:

> spawnctl get data-containers
ID    Name           Revision Status     Engine            CreatedAt
97484 spawn-tutorial rev.0    Completed  MSSQL:2017       35 seconds ago

In the next section, we'll learn how to do more with your data container than just connect to it.

Getting started: Using data containers