CircleCi don`t connect with my vps

Hi.
I have a problem and I cant find error in my code. My circleci I don't want to make a connection with my vps.Its error message:

#!/bin/bash -eo pipefail

ssh -T root:51.91.252.150 < bin/deploy/pre_deploy.sh

ssh: Could not resolve hostname :*********: Name or service not known

Exited with code exit status 255

CircleCI received exit code 255

my code:

> version: 2
> jobs:
>   build:
>     working_directory: ~/micropost
>     docker:
>       - image: circleci/php:7.2.0-apache-stretch-node-browsers
>         environment:
>           APP_ENV: test
>           DATABASE_URL: mysql://root:root@127.0.0.1/micro-post
>           MAILER_FROM: micro@micropost.com
>           MAILER_URL: null://localhost
>       - image: circleci/mysql:5.7
>         environment:
>           MYSQL_ROOT_PASSWORD: 'root'
>           MYSQL_DATABASE: micro-post
>     steps:
>       - checkout
>       - run:
>           name: Install PHP MySQL
>           command: sudo docker-php-ext-install pdo_mysql
>       - run:
>           name: Wait for MySQL
>           command: dockerize -wait tcp://127.0.0.1:3306 -timeout 120s
>       - run:
>           name: Composer
>           command: sudo composer self-update
>       - run:
>           name: Composer install
>           command: composer install -n --prefer-dist
>       - run:
>           name: Run migrations
>           command: php bin/console doctrine:schema:update --force
>   deploy:
>     working_directory: ~/micropost
>     docker:
>       - image: circleci/php:7.2.0-apache-stretch-node-browsers
>     steps:
>       - add_ssh_keys:
>           fingerprints:
>             - "b6:76:a7:ac:1d:19:f6:e9:59:a4:5f:4d:ed:91:34:dd"
>       - checkout
>       - run:
>           name: Composer install
>           command: composer install -n --prefer-dist
>       - run:
>           name: Clear cache
>           command: php bin/console cache:clear --env=prod --no-interaction
>       - run:
>           name: Add droplet
>           command: ssh-keyscan -H 51.91.252.150 >> ~/.ssh/know_hosts
>       - run:
>           name: Pre-deploy
>           command: ssh -T root:51.91.252.150  < bin/deploy/pre_deploy.sh
>       - run:
>           name: Deploy code
>           command: rsync -vzcrSLhp --exclude '.env' --delete ~/micropost/ root@51.91.252.150:/var/www/micropost_current
>       - run:
>           name: Post deploy
>           command: ssh -T root:51.91.252.150  < bin/deploy/deploy.sh
> workflows:
>   version: 2
>   build-and-deploy:
>     jobs:
>       - build
>       - deploy:
>           requires:
>             - build
>           filters:
>             branches:
>               only: master

This looks very similar to this issue: Getting an error when trying to deploy using SCP

Please perform the troubleshooting steps discussed there, and double check your firewall rules.

Thank you for help.I read all article. But I have turn off my firewall.And I don`t know where I have problem.

One immedaite problem that I see is this:

This is not a valid syntax for SSH. It should be root@ not root:

I change my code to connect with vps form :

root:51.91.252.150

on

root@51.91.252.150

And I have new message error :

The authenticity of host '************* (*************)' can't be established.

ECDSA key fingerprint is SHA256:Vz0ar5G9YVgwWmG8FXCBAVoCSZAwKUoIcjkqi5oSNkk.

Are you sure you want to continue connecting (yes/no)?

Too long with no output (exceeded 10m0s): context deadline exceeded

Are you sure you want to continue connecting

This means that the remote host does not appear in known_hosts. To fix this, you can SSH into your CircleCI instance (see the docs), install the private key, do a manual SSH operation, say β€œyes” to the question, and get a connection to your remote host. Then disconnect immediately, and your known_hosts should have a new line.

Copy this line back to your dev machine, and then commit it to your repo. Then in your CircleCI config you can append it your known_hosts file, to prevent the question coming up again.

Update

There is an alternative approach, which appears to be what you have tried:

ssh-keyscan -H 51.91.252.150 >> ~/.ssh/know_hosts

You have a typo in your target file - this should be known_hosts. I personally prefer my approach, since I believe it guards against DNS poisoning, but it is going to be easier in your case to fix what you have.

1 Like