How do I get gitlab to access the ec2 instance?

Asked

Viewed 49 times

2

i created a script to deploy at an instance of ec2. The idea is to enter the instance terminal, run a git pull and restart pm2. But when I try to access ec2 the following error appears:

Pseudo-terminal will not be allocated because stdin is not a terminal. 
Host key verification failed.

My ci yml is like this:

make_deploy:
  stage: deploy
  script:
    - apk update
    - apk add bash
    - apk add git
    - apk add openssh
    - bash scripts/deploy.sh
    - echo "Deploy succeeded!"
  only:
    - master

and this is my script:

#!/bin/bash

user=gitlab+deploy-token-44444
pass=passwordpass
gitlab="https://"$user":"$pass"@gitlab.com/repo/project.git"

ssh-keygen -R 50-200-50-15

chmod 600 key.pem

ssh -tt -i key.pem [email protected] << 'ENDSSH'

pm2 delete .
rm -rf project
git clone $gitlab
cd /project
npm i 
npm start

ENDSSH

exit

It seems that he can not enter the terminal of ec2 to run these commands, because outside the access part of the instance terminal everything works perfectly.

Thank you!

  • have you solved friend? If not, I can try to help you...

  • No, I ended up leaving manual. Access the ec2 and there I give a pull and restart the pm2 :(

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.