Rsync over ssh - how to reference the repository directory

#1

Guys I need some help with deploying my build to a VM hosted on digitalocean. I’ve setup the server I want to deploy to, added the SSH key and everything, but now rsync is getting stuck with the following error:

#!/bin/bash -eo pipefail
rsync -avz -e “ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null” --progress svobodneSanje/public $SSH_USER@$SSH_HOST:/var/www/html/
Warning: Permanently added ‘165.227.235.98’ (ECDSA) to the list of known hosts.

sending incremental file list
rsync: change_dir “/home/circleci/project//svobodneSanje” failed: No such file or directory (2)

sent 20 bytes received 12 bytes 21.33 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1183) [sender=3.1.0]
Exited with code 23

My page is built in the /public directory inside the repo, and now I would like to rsync in to the server. The repository is called svobodneSanje on github (no idea if that is relevant).

This is my .yml file:

version: 2
jobs:
  build:
    docker:
      - image: circleci/node:7.10
    working_directory: ~/repo
    steps:
      - checkout
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "package.json" }}
          - v1-dependencies-
      - run: yarn install
      - save_cache:
          paths:
            - node_modules
          key: v1-dependencies-{{ checksum "package.json" }}
      - run: yarn build
  deploy:
    machine:
      enabled: true
    steps:
      - add_ssh_keys:
          fingerprints:
            - $SSH_FINGERPRINT
      - run:
          name: Deploy Over SSH
          command: |
            rsync -avz -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --progress svobodneSanje/public $SSH_USER@$SSH_HOST:/var/www/html/

workflows:
  version: 2
  build-and-deploy:
    jobs:
      - build
      - deploy:
          requires:
            - build
          filters:
            branches:
              only: master 

So the question is, where is my /public directory stored and how do I reference it in the deploy script? I tried using ~/repo/public and that failed as well

0 Likes

closed #2

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

0 Likes