2020-01-19
1356
#vue
Michael Okoh
12737
Jan 19, 2020 â‹… 4 min read

How to auto deploy a Vue application using GitLab CI/CD on Ubuntu 18.04

Michael Okoh I code, that's all.

Recent posts:

Web Components Adoption Guide: Overview, Examples, And Alternatives

Web Components adoption guide: Overview, examples, and alternatives

Evaluate Web Components, a set of standards that allow you to create custom HTML tags for more reusable, manageable code.

Elijah Asaolu
Apr 16, 2024 â‹… 11 min read
Using Aws Lambda And Aws Cloudfront To Optimize Image Handling

Using AWS Lambda and CloudFront to optimize image handling

Leverage services like AWS Lambda, CloudFront, and S3 to handle images more effectively, optimizing performance and providing a better UX.

Nitish Sharma
Apr 12, 2024 â‹… 12 min read
Building Web-Based Terminal Components With Termino.js

Building web-based terminal components with Termino.js

Explore Termino.js, an open source library for integrating web-based terminals into applications, in this introduction article.

Chibuike Nwachukwu
Apr 11, 2024 â‹… 6 min read
How To Build A Custom Gpt: Step By Step Tutorial

How to build a custom GPT: Step-by-step tutorial

Let’s see why and how to build custom GPTs — personalized versions of ChatGPT that act as custom chatbots to serve a specific purpose.

Peter Aideloje
Apr 10, 2024 â‹… 7 min read
View all posts

7 Replies to "How to auto deploy a Vue application using GitLab CI/CD on Ubuntu 18.04"

  1. Hi, thanks for this great article, I just would to ask, can I using shared runner for this deployment? thanks

  2. I think you must to install but I am not so sure becouse docker is supposed to run on your machine (Server)

  3. Right now I am working on it and I could you tell you the answer is NO.

    Shared Runners are running on some a machine/server that you cannot login. To make it possible for us to use any kinds of runner, here is my idea.

    First we need to figure it out how a runner, an executor and the server where we deploy our applications interact with each others.

    * A Runner is a program that executes your scripts(including before_script and after_script) in a gitlab job,
    * The executor of a runner could be “shel”l, “docker”, “docker+machine”, and so on. (refer to gitlab doc) Shared Runners use a stragety “docker+machine” as their executors, and the machine running the shared runners is beyond our control.
    * The deployment server is exactly where you deploy your service( could be in form of docker container). Usually we can have our own server from AWS, Google Cloud Service and Azure and so on. It is under our control and we can login with certain credentials.

    The reason why the article above works, is the runner is runnning on the deployment server. The runner start a docker container and the container maps its port to the server’s port and finally it is open to public. The cost is you have to manually set up gitlab runner on your deployment server, which demands some amount of hardware resources.

    Is there any way to separate gitlab runners and the deployment server?

    If yes, then we can use any runner to do the deployment. However, in this case, obviously, the runner has to be able to execute commands in the server which require login. We can set up environment variables to store credentials and feed it to ssh/sshpass command in the scirpt. As far as I know from the Internet, there are two methods to automate login. 1. Copy the private key of your server to the variables and write it to .ssh/known_hosts in your script. 2. create a new user with necessary permission and give username and password to the runner via environment variables.

    I don’t think at any time we should leak out the private key, so I am trying to make it in method 2. However, SSH doesn’t allow password provided from terminal so I use sshpass to wrap it, while sshpass results in a new problem that return error code 6 (If you are interested, you can dig it out later). Right now I am working on this problem. The reason is clear and I am working on it. Hopefully I can overcome any sequential problems…

  4. First of all thanks Michael, I could run all these process and test the image and container on local pc and get result
    But as server side, even though I could run pipeline and get ‘Job succeeded’ on gitlab area, couldnt get any result or change on server. How can I check created container or image on server? Both image and container work well on my pc but I have no output of them on server. I use Ubuntu server and even created and tested all these process on server manually and step by step and could load project as localhost in server but as I said the deploy with gitlab hasnt any result

  5. same issue.
    solution was create folder nginx in “vue-demo” repository –> “nginx/main.conf” and disable public in Settings -> CI/CD –> Runners, find your runner and disable Shared Runners parameter

  6. Thanks for the tutorial, its quite a long way. I needed to disable: gitlab-settings-ci/cd shared Runners to get it work

Leave a Reply