# Simple SSH Deployment

**URL:** <https://discuss.circleci.com/t/simple-ssh-deployment/20449>\
**Category:** Deployments\
**Created:** [March 3, 2018, 12:09pm UTC](https://discuss.circleci.com/t/simple-ssh-deployment/20449 "2018-03-03T12:09:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![WazzaJB](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/wazzajb/32/17929_2.png) [@WazzaJB](https://discuss.circleci.com/u/WazzaJB)\
**Post date:** [March 3, 2018, 12:09pm UTC](https://discuss.circleci.com/t/simple-ssh-deployment/20449/1 "2018-03-03T12:09:28Z")

</div>

Hey,

Really enjoyed using CircleCI for my Mocha tests within my Node app. I’m now looking to get a straightforward deployment process using SSH into my dev server, however the docs don’t seem to be clear on this and jumping around StackOverflow and this forum has been a bit of a minefield with mixture of V1 & V2 configs (I think?).

This is what I have, but I think this may be a mix of V1 code in my V2 config? I’m essentially trying to run the following command on build success: ssh ubuntu@xxx.xxx.xxx.xxx ‘sudo git -C /home/app pull origin develop && sudo systemctl restart api.service’

Full config:

````auto
version: 2
jobs:
  build:
docker:
  # specify the version you desire here
  - image: circleci/node:8.4.0
    environment:
      NODE_ENV: development
      DEBUG: "*,-express*"
      HOST: "*"
      PORT: 8080
      BCRYPT_SALT_ROUNDS: 10
      TOKEN_SECRET: vkb6cgvlerc7ble78cb;r7b
      UPLOADS_DIR: uploads/

  # Specify service dependencies here if necessary
  # CircleCI maintains a library of pre-built images
  # documented at https://circleci.com/docs/2.0/circleci-images/
  - image: circleci/mongo:3.4.4

working_directory: ~/api

steps:
  - checkout

  # Download and cache dependencies
  - restore_cache:
      keys:
      - v1-dependencies-{{ checksum "app/package.json" }}
      # fallback to using the latest cache if no exact match is found
      - v1-dependencies-

  - run: cd app;npm install

  - save_cache:
      paths:
        - app/node_modules
      key: v1-dependencies-{{ checksum "app/package.json" }}

  # run tests!
  - run: cd app;npm run circleci-test

deployment:
  dev:
    branch: develop
    commands:
      - ssh ubuntu@xxx.xxx.xxx.xxx 'sudo git -C /home/app pull origin develop && sudo systemctl restart api.service'```
````

---

<div class="post-metadata">

**Author:** ![levlaz](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/levlaz/32/36978_2.png) [@levlaz](https://discuss.circleci.com/u/levlaz)\
**Post date:** [March 3, 2018, 1:56pm UTC](https://discuss.circleci.com/t/simple-ssh-deployment/20449/2 "2018-03-03T13:56:30Z")

</div>

This looks fine to me, are you running into an issue here?

This will work as long as an SSH key that you add to our UI is in the `.authorized_keys` file for the `ubuntu` user on server `xxx.xxx.xxx.xxx`.

---

<div class="post-metadata">

**Author:** ![WazzaJB](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/wazzajb/32/17929_2.png) [@WazzaJB](https://discuss.circleci.com/u/WazzaJB)\
**Post date:** [March 4, 2018, 5:26pm UTC](https://discuss.circleci.com/t/simple-ssh-deployment/20449/3 "2018-03-04T17:26:09Z")

</div>

Hey @levlaz,

Thanks for getting back to me. The key is definitely in there yes but still no progress. Could anything else be at play here?

Do you have any suggestions on how to debug this step? I can find anything related to it after a successful build.

Thanks,  
Warren

---

<div class="post-metadata">

**Author:** ![levlaz](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/levlaz/32/36978_2.png) [@levlaz](https://discuss.circleci.com/u/levlaz)\
**Post date:** [March 10, 2018, 3:49pm UTC](https://discuss.circleci.com/t/simple-ssh-deployment/20449/4 "2018-03-10T15:49:57Z")

</div>

Is the key encrypted?

i.e. when you ran `ssh-keygen` did you add a password?

---

<div class="post-metadata">

**Author:** ![WazzaJB](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/wazzajb/32/17929_2.png) [@WazzaJB](https://discuss.circleci.com/u/WazzaJB)\
**Post date:** [March 11, 2018, 1:22pm UTC](https://discuss.circleci.com/t/simple-ssh-deployment/20449/5 "2018-03-11T13:22:31Z")

</div>

Hey Levlaz,

Key is not encrypted no. Is there somewhere I can debug this within CircleCI?

---

<div class="post-metadata">

**Author:** ![levlaz](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/levlaz/32/36978_2.png) [@levlaz](https://discuss.circleci.com/u/levlaz)\
**Post date:** [March 11, 2018, 4:08pm UTC](https://discuss.circleci.com/t/simple-ssh-deployment/20449/6 "2018-03-11T16:08:26Z")

</div>

Hm, thats tough its supposed to just work™

Are you able to pair on this with me? Would love to see what you see.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [June 18, 2018, 11:41am UTC](https://discuss.circleci.com/t/simple-ssh-deployment/20449/7 "2018-06-18T11:41:28Z")

</div>

Closed on June 18, 2018, 11:41am UTC


