Skip to content

Instantly share code, notes, and snippets.

@zallarak
Last active October 29, 2017 17:06
Show Gist options
  • Save zallarak/431e2c1976f86897153e599c9103130f to your computer and use it in GitHub Desktop.
Save zallarak/431e2c1976f86897153e599c9103130f to your computer and use it in GitHub Desktop.
Stellar: horizon/stellar-core deployment

Horizon Deployment

Install Docker

sudo apt-get update

sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Verify fingerprint: 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88, via sudo apt-key fingerprint 0EBFCD88.

sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

sudo apt-get update

sudo apt-get install docker-ce

Verify docker is running: sudo docker run hello-world

Run persistent mode interactively

docker run --rm -it -p "8000:8000" -v "/stellar:/opt/stellar" --name stellar stellar/quickstart --pubnet

Add custom domain

Follow your domain name server and web server provider's instructions on setting up a custom domain.

Generate TSL keys

Get certbot

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install certbot 

Get certificate

sudo certbot certonly

After generating fullchain.pem and privkey.pem, add them to your /stellar folder and specify their paths in horizon/etc/horizon.env in the new variables TLS_KEY and TLS_CERT, respectively.

Run persistent mode for an already initialized host directory

docker run -d \
    -v "/stellar:/opt/stellar" \
    -p "443:8000" \
    --name stellar \
    stellar/quickstart --pubnet

Create a new db and reap it

docker exec -it stellar /bin/bash

supervisorctl stop horizon

It may be helpful to temprorarily change horizon's log level to "debug" in horizon/etc/horizon.env to ensure the following steps run properly.

/usr/local/bin/stellar-core --conf "/opt/stellar/core/etc/stellar-core.cfg" -newdb
./horizon/bin/horizon db reap

Wait for a few minutes, then run:

supervisorctl restart horizon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment