deployd

module
v0.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2026 License: MIT

README

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
  • 3 hosts/PC in with private static internal IP

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/download/v0.0.5/deployd-linux-amd64.tar.gz

2. Extract the Archive

Extract the release into the deployment directory.

sudo mkdir -p /opt/deployd
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

3. 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
EOF

Next, create the config. Please adjust it according to your own host information. Explanation below the example.

sudo tee /etc/deployd/config.yaml >/dev/null <<'EOF'
host:
  id: 1
  name: host1
  os: linux
  architecture: amd64
  internal_address: 100.0.0.1

# base raft configuration for deployed apps
raft:
  replica_id: 1
  base_node_host_dir: "/data"
  base_wal_dir: "/data"
  etcd_config: "/etc/deployd/etcd-raft.yaml"

http:
  public:
    address: 100.0.0.1:9401
    fqdn: http://host1.com:9401

ui:
  dir: "/var/www"

storage:
  s3:
    blob:
      endpoint: <s3 endpoint>
      key_id: <s3 access key id>
      key_secret: <s3 key secret>
      use_ssl: false
      bucket_name: <s3 bucket name>
      base_public_url: <public accessible URL of the bucket>
  file:
    config-data: "/data/deployd/config.db"
    job-data: "/data/deployd/job.db"
    job-website-data: "/data/deployd/job-website-data.db"

EOF

http bind address is where the deployd API HTTP interface actually bind to.

http bind address = http://100.0.0.1:9401

fqdn is used to access the HTTP endpoint from external. Usually, I configure the load balancer with one single domain that will go to my 3 hosts. Or, you can just put one of the host.

fqdn = http://mycluster.com

or

fqdn = http://100.0.0.1:9401

Hosts:

  • hostname = host1, hostname_internal_ip = 100.0.0.1, host_id: 1
  • hostname = host2, hostname_internal_ip = 100.0.0.2, host_id: 2
  • hostname = host3, hostname_internal_ip = 100.0.0.3, host_id: 3

4. Create the Secret File

They can be used to overwrite config.yaml with secret. (but now it's not used)

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

EOF

5. Create the Etcd Raft File

Etcd raft is what makes this a distributed application.

sudo tee /etc/deployd/etcd-raft.yaml >/dev/null <<'EOF'
node_id: 1
base_wal_dir: "/wal/deployd"
base_data_dir: "/data/deployd"
replica:
  deployd:
    cluster:
      - http://host1:21521
      - http://host2:21522
      - http://host3:21523
    bind_address: 100.0.0.1:21521
    join: false
  job:
    cluster:
      - http://host1:21531
      - http://host2:21532
      - http://host3:21533
    bind_address: 100.0.0.1:21531
    join: false
  job-website:
    cluster:
      - http://host1:21541
      - http://host2:21542
      - http://host3:21543
    bind_address: 100.0.0.1:21541
    join: false

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
EnvironmentFile=-/etc/deployd/overwrite.env

[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

Since it is expected to be run on 3 host, it is OK to have error now. We can proceed with the next hosts. After all 3 has been configured, there should be no more error log.

We then can try the endpoint to validate.

curl -H "X-Namespace: *" "http://host1:9401/deployd/service"

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL