micahyoung / cf-rsync

Rsync over cf ssh
0 stars 0 forks source link

rsync over cf ssh

Requirements

Usage

  1. Ensure you are logged into a running Cloud Foundry
  2. Ensure you have running app
  3. Run your rsync command, using either script as the rsh option running app's name as the remote host name:
    
    # list files in app directory
    rsync --rsh="<./cf-rsh-linux.sh or ./cf-rsh-windows.sh>" <your app name>:app/

alternative, use RSYNC_RSH environment variable

export RSYNC_RSH=<$PWD/cf-rsh-linux.sh or $PWD/cf-rsh-windows.sh> rsync :app/


## Examples

### Linux - modify existing app (ruby/nodejs/python)
1. Push functioning original app but override healthcheck
    ```sh
    cf push my-rsync-app -p my-original-app/ -u none
  1. Make changes to local my-original-app directory

  2. Use rsync to upload and overwrite app directory in CF instance

    rsync --rsh="./cf-rsh-linux.sh" --resursive --verbose  --delete my-original-app/ my-rsync-app:app
  3. Visit the app URL in browser and see the updated content

Windows - modify existing app (hwc)

  1. Push functioning original app

    cf push my-rsync-app -p my-original-app/ -s windows2016 -b hwc_buildpack
    • Can be any app that contains a Web.config and works with HWC
  2. Make changes to local my-original-app directory (or rebuild/republish from Visual Studio to app directory)

  3. Use rsync to copy app directory to CF instance

    rsync --rsh="./cf-rsh-windows.sh" --recursive --verbose --delete --exclude="hwc.exe" my-original-app/ my-rsync-app:app
    • Note be sure to use a / after the source directory path (my-original-app/) to copy just its contents
  4. Visit the app URL in browser and see the updated content

Notes