Hi,
I am trying to figure out how to configure Trellis to separate the Application and Database for production.
Scenario:
- Application will be located on a DigitalOcean Droplet.
- Database will be located on either a different Droplet, Amazon or Google Cloud SQL.
Is this doable or just a bad idea?
It’s usually a good idea but only if the database is on the same network (so DO in this case). DO -> S3/Google likely isn’t great in terms of latency.
Trellis supports a remote db_host
which makes it easy to just use a remote DB instance. What’s not so easy right now to have Trellis manage your DB server.
You’d want to create another playbook and separate out server.yml
to only target your “DB” host vs the standard “web” hosts.
Here’s an example from the Ansible docs:
---
- hosts: webservers
remote_user: root
tasks:
- name: ensure apache is at the latest version
yum: name=httpd state=latest
- name: write the apache config file
template: src=/srv/httpd.j2 dest=/etc/httpd.conf
- hosts: databases
remote_user: root
tasks:
- name: ensure postgresql is at the latest version
yum: name=postgresql state=latest
- name: ensure that postgresql is started
service: name=postgresql state=started
1 Like
Great thanks, ill do a deep dive into Ansible and play around.