10up / wp-local-docker-v2

ARCHIVED: A simple Docker based development environment for WordPress.
MIT License
484 stars 81 forks source link

How to go about deploying to live site? #277

Closed kevinmeasom closed 2 years ago

kevinmeasom commented 2 years ago

I realize that this is intended for local development which is working great! What is the recommended method of deploying to a live droplet on DigitalOcean. My challenge is to make that process as seamless as possible.

kevinmeasom commented 2 years ago

I ended up creating my own ansible playbooks to setup an existing droplet on Ubuntu. I used ansible-playbooks repo as a starting point and adapted for my own needs.

For SSL certs I used the following tasks in my ansible playbook (obviously you would need to create your own variables).

    - name: Certbot SSL
      command: certbot --nginx -n -d {{ http_host }} -m {{ letsencrypt_email }} --agree-tos
      when: (env == "production") and http_prot == "https"
      notify: Reload Nginx
      tags: [ ssl ]

    - name: Add letsencrypt cronjob for cert renewal
      cron:
        name: letsencrypt_renewal
        special_time: weekly
        job: certbot renew --post-hook "systemctl reload nginx"
      when: (env == "production") and http_prot == "https"
      notify: Reload Nginx
      tags: [ ssl ]

Hopefully that points someone else in the right direction.