Sign inSign up

tombras/rsync

By tombras

Updated about 8 years ago

rsync deployments

Image
0

6.3K

tombras/rsync repository overview

#Docker image for Bitbucket Pipeline deployments via rsync.

WARNING

Deletes files not in repo unless it's been added to .gitignore or you've added it to bitbucket-pipelines-exclude.txt file

The example below passed the --delete flag, if you're not deploying to a webroot, such as, your project contains a webroot and is deployed in a folder with shared system files this option could blow things up.

If you're migrating over from fabdeploy you need to create a bitbucket-pipelines-exclude.txt file from the ignore_list found in fabfile.json.

using a root user and needing www-data as the user and groupd

Replace the flag -pthrvz with -pogthrvz if you need to change the user/group before deploying; add chown www-data:www-data ./ -R before the rsync step

Heads-up find . -type f -name "*.php" -exec chmod 700 {} \; maybe too strict if you've not changed the user.

Example bitbucket-pipeline.yml

image: tombras/rsync
pipelines:
  branches:
    master:
      - step:
          deployment: test
          script:
            - find . -type d -exec chmod 755 {} \;
            - find . -type f -exec chmod 644 {} \;
            # strict/secure permissions for php
            - find . -type f -name "*.php" -exec chmod 700 {} \;
            - sshpass -p $RSYNC_PASSWORD rsync -pthrvz --delete --exclude='.git/' --exclude-from='.gitignore' --exclude-from='bitbucket-pipelines-exclude.txt' ./ <USER>@<HOSTNAME>:<DIR_NAME>
      - step:
          deployment: staging
          trigger: manual
          script:
            - find . -type d -exec chmod 755 {} \;
            - find . -type f -exec chmod 644 {} \;
            # strict/secure permissions for php
            - find . -type f -name "*.php" -exec chmod 700 {} \;
            - sshpass -p $RSYNC_PASSWORD rsync -pthrvz --delete --exclude='.git/' --exclude-from='.gitignore' --exclude-from='bitbucket-pipelines-exclude.txt' ./ <USER>@<HOSTNAME>:<DIR_NAME>
      - step:
          deployment: production
          trigger: manual
          script:
            - find . -type d -exec chmod 755 {} \;
            - find . -type f -exec chmod 644 {} \;
            # strict/secure permissions for php
            - find . -type f -name "*.php" -exec chmod 700 {} \;
            - sshpass -p $RSYNC_PASSWORD rsync -pthrvz --delete --exclude='.git/' --exclude-from='.gitignore' --exclude-from='bitbucket-pipelines-exclude.txt' ./ <USER>@<HOSTNAME>:<DIR_NAME>

Tag summary

Content type

Image

Digest

Size

71.6 MB

Last updated

about 8 years ago

docker pull tombras/rsync