Deploy shiny App on Ubuntu 20.04.4 LTS

Hello,

I am new to gitlab CI/CD and I am trying to deploy my shiny application on my own server.
I use an aws ec2 Ubuntu 20.04.4 machine on which I installed srtudio-server and shiny-server (accessible via their url).

In gitlab-ci.yml I have:

deploy:
  image: alpine:latest
  stage: deploy
  when: manual
  only:
    - master
  environment:
    name: production
    url: http://12.##.##.##
  before_script:
    - apt-get update && apt-get install -y sshpass openssh-client
    - export SSHPASS=$DEPLOY_PWD
  script:
    - chmod og= $ID_RSA #sshpass -e ssh -o StrictHostKeyChecking=no $DEPLOY_USER@$DEPLOY_IP
    - apk update && apk add openssh-client #"docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY_IMAGE;
    - ssh -i $ID_RSA -o StrictHostKeyChecking=no $DEPLOY_USER@$DEPLOY_IP "docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY"  #docker pull $CI_REGISTRY_IMAGE:latest;
    - ssh -i $ID_RSA -o StrictHostKeyChecking=no $DEPLOY_USER@$DEPLOY_IP "docker pull $TAG_COMMIT"  #docker logout $CI_REGISTRY_IMAGE;"
    - ssh -i $ID_RSA -o StrictHostKeyChecking=no $DEPLOY_USER@$DEPLOY_IP "docker container rm -f my-app || true"
    - ssh -i $ID_RSA -o StrictHostKeyChecking=no $DEPLOY_USER@$DEPLOY_IP "docker run -d -p 90:80 --name my-app $TAG_COMMIT"

And I got this error :

I need your help please :slight_smile:

The host defined in the DEPLOY_IP variable is not reachable via SSH port 22, the connection times out. Maybe a firewall problem on the EC2 instance - ensure that firewall policies are in place, and allow port 22 inbound from your GitLab instance.

You can manually test reachability with ssh -vvv <DEPLOY_ID value>.

Hi @dnsmichi, thank you for your answer. Of course I have allowed port 22 inbound from my ec2 instance but I still have the same error.

Hi @sing0021

this is clearly network issue from the error provided. I would double check if it’s not blocked somewhere on your side.

1 Like

Hi @balonik, Is it because I use NGINX?
My rstudio server is on 8787 and my shiny server on 3838.

Do you have another method to propose to me than this one, I am really confused?

Thanks

Hi @sing0021

gitlab-runner cannot reach your EC2 server over SSH (TCP/22).
If you are using GitLab.com Shared Runners, verify your server has SSH (TCP/22) publicly available from internet.
If you are using your own runners, verify they can reach your server over SSH (TCP/22).

1 Like