Appearance
Getting Started
Install
Build from source:
bash
go build -o managed .Set up credentials
Export your cloud provider API key and generate an SSH key pair that managed will use to connect to servers:
bash
export DIGITALOCEAN_TOKEN="your-token"
managed ssh generate-keyWrite your config
Create a managed.yaml in your project root:
yaml
providers:
digitalocean:
api_token: "${DIGITALOCEAN_TOKEN}"
region: nyc3
image: ubuntu-24-04-x64
size: s-2vcpu-4gb
defaults:
provider: digitalocean
repos:
- repo.managed.works
services:
production-database:
package: mysql
replicas: 1This defines a MySQL service with one primary and one replica. The repos entry points managed at the official package repository — that's where the mysql package (and the others in the catalog) come from; without a repository configured, managed apply can't resolve any package. That's it, managed handles the rest.
Deploy
bash
managed applyThis will:
- Create two servers on DigitalOcean (one primary, one replica)
- Install MySQL on both with the right configuration
- Set up primary-replica replication
- Configure firewall rules so only replicas can reach the primary's MySQL port
- Provision object storage for backups
- Install automated backups every 6 hours via cron
- Generate and store a root password
Check status
bash
managed statusOutput:
production-database (1 primary, 1 replica)
primary production-database-primary 10.132.0.2 (104.236.38.25) active 2h
replica production-database-replica-1 10.132.0.3 (159.89.176.5) active 2h
Credentials:
production-database.rootPassword = 774570c4f2ff1faf3ea69513Scale up
Change replicas: 1 to replicas: 2 in your managed.yaml, then run managed apply again. A third server appears, MySQL installs, replication connects to the primary. Existing servers are untouched.
Use your own server
Already have a server? Skip the cloud provider setup and point managed at it:
yaml
repos:
- repo.managed.works
servers:
my-server:
ip: 203.0.113.10
services:
production-database:
package: mysql
server: my-serverRun managed apply and managed will SSH in and install MySQL. You can also put multiple services on the same server, just set the same server: value on each.
Tear down
bash
managed destroyDestroys all servers and cleans up state. Use --service production-database to target a single service. External servers (ones you provided with ip) are removed from managed's state but the server itself is left alone.