Skip to main content

Empty

Overview#

If you define the sourceType property as empty you will be able to create a data image that is completely empty, with no content on it.

sourceType: empty
name: dev
engine: postgresql
version: 11.0

In this case we want to create a PostgreSQL data image whose source is empty and is named dev.

Tutorial#

In this tutorial we will create an empty data image and then use it to create a data container. We will then inspect the data container.

  1. Create a file development.yaml with your data image specifications.

    sourceType: empty
    name: dev
    engine: postgresql
    version: 11.0
  2. Run the following command to create a data image.

    $ spawnctl create data-image -f ./development.yaml
    Data image 'dev' (10001) created!
  3. You can verify your data image by running the following command.

    $ spawnctl get data-images
    NAME IMAGE ID ENGINE STATUS MESSAGE CREATED
    dev 10001 PostgreSQL 2 Created 2 minutes ago
  4. Create a data container from the newly created data image.

    $ spawnctl create data-container --image dev
    Data container 'dev-rambbomj' (10001) created!
    -> Host=instances.spawn.cc;Port=53223;User ID=<some_user_id>;Password=<some_password>;
  5. You can verify your data container was properly created by running the following command.

    $ spawnctl get data-containers
    NAME CONTAINER ID REVISION STATUS MESSAGE ENGINE CREATED
    dev-rambbomj 10001 rev.0 2 Running PostgreSQL 1 minute ago
  6. You should now be able to connect to your database and execute queries.

    In this example we connect to the PostgreSQL data container (database) using psql.

    $ psql -h instances.spawn.cc -p 53223 -U <some_user_id>
    Password for user <some_user_id>:
    psql (10.5, server 11.0 (Debian 11.0-1.pgdg90+2))
    SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
    Type "help" for help.
    <some_user_id>=# \dt
    Did not find any relations.

    Notice the created database/data container has no tables.