Ansible scripts to automate API setup, largely based on this guide.
PocketBase specific setup largely based on this guide.
Litestream specific setup largely based on this guide.
The below guide assumes you are using Digital Ocean but a lot of the code here should work with any cloud provider.
Create a new Droplet on Digital Ocean (Debian was used when creating this guide but Ubuntu should work as well).
Once you have created your Droplet you have the option of creating a volume to attach to the droplet 20GB should be sufficient.
NOTE: Ansible looks for the first available mounted volume, if you attach more than one volume you may need to tweak the playbook.
Additionally you can also make use of Digitial Ocean spaces (or any S3 compatiable storage) for handling file uploads and database backups.
We recommend two buckets one for direct use with PocketBase and one for use with Litestream.
Edit your /etc/ansible/hosts
on your local machine to include:
[servers]
cac_api ansible_host={{ droplet_ip }}
Add your Digital Ocean spaces credentials to vars/generic.yml
to configure Litestream backups.
If you don't want to use Litestream you can bypass the setup using the following command:
ansible-playbook main.yml --tags "pocketbase"
ansible-playbook main.yml
During intial deployment there were delays between deploying the site and the SSL certificates being correctly registered.
When deploying allowing up to 24 hours for certificates to be registered.
Why Ansible? It runs everywhere and is fairly simple to port over to other operating systems when required.
- Handle local setup additional to remote setup