dehaze

Docker

This guide helps you set up Space Cloud via Docker.

Prerequisites

Step 1: Run Space Cloud

Development mode

The following command runs space-cloud in a docker container and exposes the GraphQL and REST APIs on port 4122:

docker run -d -p 4122:4122 --name space-cloud -e DEV=true spaceuptech/space-cloud:latest

Check if the space-cloud container is up and running:

docker ps

Note: The only difference in dev mode is that the Mission Control (admin UI of Space Cloud) doesn’t require you to log in.

Production mode

The following command runs space-cloud in production mode and exposes the HTTPS endpoint (port - 4126) of Space Cloud:

docker run -d -p 4126:4126 --name space-cloud \
  -v /path/to/ssl-certs:/ssl
  -e ADMIN_USER=some-admin \
  -e ADMIN_PASS=some-pass \
  -e ADMIN_SECRET=some-secret \
  -e SSL_CERT=/ssl/some-ssl.crt \
  -e SSL_KEY=/ssl/some-ssl.key \
  spaceuptech/space-cloud:latest

Here, ADMIN_USER and ADMIN_PASS are the credentials to login into Mission Control (Admin UI), whereas ADMIN_SECRET is the JWT secret used to authenticate requests made via Mission Control.

Note: Check out this guide to run Space Cloud in distributed mode.

Changing ports

Space Cloud only has two ports - HTTP and HTTPs. The HTTP port is available by default on 4122, and you can change it by passing the environment variable of PORT.

Example:

docker run -d -p 8000:8000 -e PORT=8000 --name space-cloud spaceuptech/space-cloud:latest

Space Cloud calculates the HTTPs port by adding 4 to the HTTP port. Hence the default value of HTTPs port is 4126.

Providing existing config file

You can tell Space Cloud to take an existing config file that you may have rather than creating a new one. For that you need to attach a volume to the docker container of Space Cloud and pass the CONFIG environment variable. Here’s how you can do it:

docker run -d -p 4122:4122 --name space-cloud \
  -v /path/to/config.yaml:/config/config.yaml
  -e CONFIG=/config/config.yaml \
  spaceuptech/space-cloud:latest

Step 2: Configure Space Cloud

If you exec into docker container of Space Cloud, you can see a config.yaml file generated by Space Cloud in the home directory.

Space Cloud needs this config file to function. The config file is used to load information like the database to be used, its connection string, security rules, etc.

Space Cloud has it’s own Mission Control (admin UI) to configure all of this quickly.

Open Mission Control

Head over to http://localhost:4122/mission-control or https://localhost:4126/mission-control to open Mission Control depending on which port you have exposed.

Note: Replace localhost with the address of your Space Cloud if you are not running it locally.

Next Steps

Awesome! We just started Space Cloud using Docker. Next step would be to set up a project to use Space Cloud in your preferred language.

Feel free to check out various capabalities of space-cloud:

Have a technical question?

Improve the docs!