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:

Building a Full-Featured Laravel Admin Dashboard with Filament

Building a full-featured Laravel admin dashboard with Filament

Build scalable admin dashboards with Filament and Laravel using Form Builder, Notifications, and Actions for clean, interactive panels.

Kayode Adeniyi
Dec 20, 2024 â‹… 5 min read
Working With URLs In JavaScript

Working with URLs in JavaScript

Break down the parts of a URL and explore APIs for working with them in JavaScript, parsing them, building query strings, checking their validity, etc.

Joe Attardi
Dec 19, 2024 â‹… 6 min read
Lazy Loading Vs. Eager Loading

Lazy loading vs. Eager loading

In this guide, explore lazy loading and error loading as two techniques for fetching data in React apps.

Njong Emy
Dec 18, 2024 â‹… 5 min read
Deno logo over an orange background

How to migrate your Node.js app to Deno 2.0

Deno is a popular JavaScript runtime, and it recently launched version 2.0 with several new features, bug fixes, and improvements […]

Yashodhan Joshi
Dec 17, 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