For developers

Setting up Hosty CLI

4min

System requirements

In order to use Hosty CLI, you need to have Docker and (optional, but recommended) Docker Compose installed on your local machine.

Set up Hosty CLI using Docker Compose config file

Hosty CLI is represented as a binary executable file inside the Docker image with all necessary dependencies already installed and configured.

In order to use it, you need to pull a Hosty CLI Docker image and execute hosty binary inside of it.

The easiest way to do this is to configure Docker Compose yaml file (compose.yml):

services: hosty_cli: # We highly encourage you to use a stable tag for Hosty CLI # instead of the "latest". List of tags can be found at # https://hub.docker.com/r/systemseed/hosty/tags image: systemseed/hosty:latest volumes: # The root folder of the project must be mapped to # the /src/project inside the Hosty container. # It is used to build images, track changes, etc. # Below is an example mapping assumed that compose.yml file # is in the project root (where .git folder is). - ./:/src/project # In order to run Docker commands inside of the Hosty # container we need to have access to the Docker socket of # the host machine. # The location of Docker socket can be different, depending on # your OS. - /var/run/docker.sock:/var/run/docker.sock # Mapping the folder with AWS credentials received from # the hosting administrators. Note that the folder does not # have to be relative to your home folder and can be located # in any other place, as long as it contains credentials file # with the correct AWS configuration for the hosty.user # profile. - ~/.aws:/src/.aws

Using Hosty CLI

To see a list of Hosty CLI commands, run the following in the root of your project:

docker compose run --rm hosty_cli hosty list

It should show you the list of commands to manage your project on the hosting. Follow the instructions or request more information about each command by adding --help flag at to the end:

docker compose run --rm hosty_cli hosty build --help

Improving Developer Experience

For better DX, it is recommended to create a small helper bash script in the project root. To do this, execute the following commands in the project root:

Shell


Add the following content to hosty.sh:

Shell


Now, you can access Hosty CLI from the project root like this: ./hosty.sh list