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?

0

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

4 Comments

understood. So where exactly is my application getting deployed?
@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.
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?
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.
0

Link to answer which solves all queries

This is most accurate answer to solve all gitlab CI queries

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.