1

.gitlab-ci.yml file

image: node:latest

services:
# This folder is cached between builds

stages:
  - deploy
cache:
  paths:
  - node_modules/
deploy_staging:
  stage: deploy
  script:
    - echo "Deploy to staging server"
    - npm install
    - npm install pm2 -g
    - pm2 start bin/www --name mms
    - ps -ef | grep mms
  environment:
    name: staging
    url: http://staging.example.com

I have deployed a nodeJS application on the server, how can I access the endpoints of the app using this URL?

Community
  • 1
  • 1
Atmesh Mishra
  • 527
  • 10
  • 26

2 Answers2

1

You seem to be confusing what the environment can and can not do. The url variable is just for your convenience:

This is an optional value that when set, it exposes buttons in various places in GitLab which when clicked take you to the defined URL.

Gitlab doesn't create an endpoint under the URL, you supply the URL under which the application is reachable after the deploy.

Community
  • 1
  • 1
Jakub Kania
  • 15,665
  • 2
  • 37
  • 47
  • understood. So where exactly is my application getting deployed? – Atmesh Mishra Jan 24 '17 at 09:30
  • 1
    @AtmeshMishra Well, you're trying to run it on one of your runners, you should check your configuration as to what runner you're using exactly but probably you don't want it deploying to a random machine. – Jakub Kania Jan 24 '17 at 09:34
  • I am using web version of gitlab. I want to make my docker container run the application. Can I get a public URL for the container somehow? – Atmesh Mishra Jan 24 '17 at 11:15
  • All Gitlab does is run the deploy commands, the same ones you could run yourself. If you don't know how to do it outside of gitlab you will have to read about container hosting services, domains etc. – Jakub Kania Jan 24 '17 at 11:27
0

Link to answer which solves all queries

This is most accurate answer to solve all gitlab CI queries

Community
  • 1
  • 1
Atmesh Mishra
  • 527
  • 10
  • 26