GithubHelp home page GithubHelp logo

trellis-backup-role's Introduction

trellis-backup-role

This role is made to be used with Trellis. It allows to set up automated backup using duplicity.

Get Started

Add the role and its dependencies to the requirements.yml file of Trellis :

- name: trellis-backup
  src: guilro.trellis-backup
  version: 1.2.0

- name: Stouts.backup
  src: Stouts.backup
  version: 3.4.5

Run ansible-galaxy install -r requirements.yml to install the new role.

Then, add the roles to the server.yml :

roles:
  ... other Trellis roles ...
  - { role: trellis-backup, tags: [backup] }
  - { role: Stouts.backup, tags: [backup] }

Role Variables

The role will read from the wordpress_sites dict in Trellis.

Example :

wordpress_sites:
  example.com:
    site_hosts:
      - canonical: example.com
        redirects:
          - www.example.com
    local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root)
    repo: [email protected]:example/example.com.git # replace with your Git repo URL
    repo_subtree_path: site # relative path to your Bedrock/WP directory in your repo
    branch: master
    multisite:
      enabled: false
    ssl:
      enabled: false
      provider: letsencrypt
    cache:
      enabled: false
    backup:
      enabled: true
      auto: true
      target: scp://[email protected]/example.com_backups # any location supported by duplicity
      schedule: '0 4 * * *' # cron time of backups (change this value)
      purge: false # switch to true to enable automatic purging of old backups

You can set enabled: true and auto: false to install duply profiles but not actually scheduling backups. This way, you can for example restore your production database on staging. You will have the same duply profiles in staging and production, but only the production server actually creating the backups.

Read all duplicity URL formats (and potential targets).

vault.yml

Add credentials to vault.yml

vault_mysql_backup_password: "Generate a random string here"

example.com:
  env:
    backup_target_user: user
    backup_target_pass: password

Restore

Once the profile are installed,

sudo duply website_name_database restore
sudo duply website_name_uploads restore

S3 Support

There is a known issue when uploading to S3 buckets that only accept V4 signatures. In order to successfully upload, you'll need to add a little bit to your wordpress_sites.yml's backup: key:

wordpress_sites:
  example.com:
    <b>backup:</b>
      <b># ... </b>
      <b>params:</b>
        <b>- 'export S3_USE_SIGV4="True"'</b>

License

MIT

Author

(C) Guillaume Royer 2017.

trellis-backup-role's People

Contributors

jillro avatar mkaski avatar robyurkowski avatar

Watchers

Silumesii Maboshe avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.