在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):stillinbeta/do-mastodon开源软件地址(OpenSource Url):https://github.com/stillinbeta/do-mastodon开源编程语言(OpenSource Language):SaltStack 70.8%开源软件介绍(OpenSource Introduction):Table of Contents Mastodon on Digital OceanA budget Mastodon installation that still strives to be productionised and fault-tolerant. PrerequisitiesTerraformYou'll need terraform installed. Get a Digital Ocean accountSign up for a Digital Ocean account. Create a personal access token Get an SMTP accountI used [Mailgun][mailgun], but any provider will work. You'll need the server, port, login, and password. A domainYou'll need a domain with DNS you control. SSH KeysThere needs to be a private key, unencrypted, at Deployment
terraform init terraform/
terraform plan -target digitalocean_floating_ip.ip -out tf.plan terraform/
terraform apply tf.plan
MaintenanceReplacing the droplet.Updating the salt files won't trigger a replacemet on its own. Instead, you can taint the droplet to trigger a replace:
Then plan and apply infrastructure changes as usual. Running with a Salt MasterThe script provinions the Droplet to work with masterless saltstack, but it can also use a local master.
ssh -R 4505:localhost:4505 -R 4506:localhost:4506 Eroot@<floating ip> the -R commands open remote ports to the local machine, so the droplet doesn't need to access
# Set the location of the salt master server. If the master server cannot be
# resolved, then the minion will fail to start.
master: localhost
systemctl restart salt-minion
pillar_roots:
base:
- /home/<user>/do_mastodon/salt/pillar
file_roots:
base:
- /home/<user>/do_mastodon/salt
salt mastodon state.apply You can do this as much as you want, to update the Mastodon instance without the downtime incurred by destroy-and-replace. Importing existing infrastructureIf you already have existing infrastructure you'd like to use with Terraform, you can import it. The most important resources to add are the static IP and the volume: terraform import -config=terraform digitalocean_volume.do_volume $(curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer <your api token>" "https://api.digitalocean.com/v2/volumes?region=nyc1" | jq -r '.volumes[0].id')
terraform import -config=terraform digitalocean_floating_ip.ip $(curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer <your api token>" "https://api.digitalocean.com/v2/floating_ips?region=nyc1" | jq -r '.floating_ips[0].ip') |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论