Skip to content

Repository files navigation

Deployd

deploy golang service as ubuntu systemd service

Installation

This guide describes how to manually install deployd as a systemd service.

Requirements

  • Linux x86_64 (amd64)
  • systemd
  • Root or sudo access

Directory Layout

Deployd is installed under:

/opt/deployd/current/

Environment files are stored in:

/etc/deployd/env/

The service definition is:

/etc/systemd/system/deployd.service

1. Download the Release

Download the latest release from GitHub.

wget https://github.com/desain-gratis/deployd/releases/latest/download/deployd-linux-amd64.tar.gz

2. Create Directories

sudo mkdir -p /opt/deployd
sudo mkdir -p /etc/deployd

3. Extract the Archive

Extract the release into the deployment directory.

sudo tar -xzf deployd-linux-amd64.tar.gz -C /opt/deployd

The resulting layout should look like:

/opt/deployd/
└── deployd

Make the executable runnable:

sudo chmod +x /opt/deployd/deployd

4. Create the Config & Environment File

sudo mkdir -p /etc/deployd

sudo tee /etc/deployd/overwrite.env >/dev/null <<'EOF'
CONFIG=/etc/deployd/config.yaml
SECRET=/etc/deployd/secret.yaml
DEPLOYD_RAFT=/etc/deployd/raft.yaml
EOF
sudo tee /etc/deployd/config.yaml >/dev/null <<'EOF'
host:
  name: <hostname>
  os: <os, eg. linux>
  architecture: <arch, eg. amd64>

# base raft configuration for deployed apps (dragonboat)
raft:
  replica_id: <replica id>
  base_node_host_dir: <raft host dir /data>
  base_wal_dir: <raft host wal dir /data>

http:
  public:
    address: <bind address eg. :9401>
    fqdn: <user accessible URL, eg. https://deployd.com>

ui:
  dir: "/var/www"

storage:
  s3:
    blob:
      endpoint: <s3 endpoint>
      key_id: <secret>
      key_secret: <secret>
      use_ssl: false
      bucket_name: <s3 bucket>
      base_public_url: <public accessible URL of the storage>
  clickhouse:
    replica:
      address: <clickhouse address>
      username: <secret>
      password: <secret>
      database: <secret>
      read_timeout: 2s
EOF

5. Create the Secret File

They have the same structure as env, and will overwrite the overwrite.env

sudo tee /etc/deployd/secret.yaml >/dev/null <<'EOF'

EOF

6. Create the systemd Service

sudo tee /etc/systemd/system/deployd.service >/dev/null <<'EOF'
[Unit]
Description=Deployd
After=network.target

[Service]
Type=simple
WorkingDirectory=/opt/deployd
ExecStart=/opt/deployd/deployd
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target
EOF

6. Enable the Service

Reload systemd:

sudo systemctl daemon-reload

Enable deployd to start automatically:

sudo systemctl enable deployd

Start it:

sudo systemctl start deployd

7. Verify Installation

Check service status:

sudo systemctl status deployd

Follow logs:

sudo journalctl -u deployd -f

About

deploy golang service as ubuntu systemd service

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages