Skip to main content

How to deploy a dist.zip VueJS project with SSL using a docker-compose.yml file

If you did the last post on success https://springboot-vuejs-reactjs.blogspot.com/2019/12/how-to-deploy-distzip-vuejs-project-on.html doing it using docker-compose using volumes is much easier so that if you are going to make changes on the nginx.conf, or if you're going to add new SSL certificates or if you're going to update the VueJS app, then you are not going to need to rebuild the image and run it again, the only thing is just changing the files on the host you need and restart the .yml file and that's it you're done.

if you don't have docker-compose installed on Centos 7, just run

yum update && yum install docker-compose

let's create a folder where you are going to have your files, in my case I did something like

|---/Data/nginx
|-------------ssl
|-------------conf
|-------------html

inside ssl there are  ( cert-chain.crt and server.key )
inside conf there is ( nginx.conf )
inside html there is the dist folder which has got the app ( dist )


and inside that folder let's create a file nginx.yml or whatever name you want to give it
and inside that file lest write this

webapp:

  image: nginx
  container_name: nginx-deployer
  ports:
      - '80:80'
      - '443:443'
  volumes:
      - /Data/nginx/ssl:/etc/ssl
      - /Data/nginx/conf/nginx.conf:/etc/nginx/nginx.conf
      - /Data/nginx/html/dist:/var/www/html/dist

now to run it, just do docker-compose -f nginx.yml up

-f means that a .yml file with a different name than docker-compose.yml is being used in this case the .yml file was called nginx.yml

and what up does is create and start the container, now to run in detached mode or background mode just run docker-compose -f nginx.yml up -d 
now if you run docker container ls

If you need now to get to the shell, run this

docker exec -it --user root nginx-deployer bash

you can stop the container in 2 ways:
with the .yml file docker-compose -f nginx.yml stop / docker-compose -f nginx.yml restart
with the docker name container docker container stop nginx-deployer / docker container restart nginx-deployer





Comments

Popular posts from this blog

How to deploy a VueJS App using Nginx on Ubuntu

There are thousands of blogs and websites out there explaining how to do a hello world and how to start with VueJS, but in this little post, I’m just going to be explaining how to do deploy a VueJs app after you have run the command through the CLI npm run build . So when you run the command npm run build a dist folder is created and that folder’s got the essential .js files to run our app, when we want to run our app on an Nginx server by default the vue-router is not going to work well so that Nginx does not come ready to work by default with a VueJs app This is basically for a Linux Ubuntu distribution if you’ve got any other Linux distribution just pay attention where is going to be set the www/html folder and the Nginx settings so that this is useful for any Linux distribution  Install and configure nginx sudo apt install nginx Double check to make sure the nginx service is running with command service nginx status, then open your browser and enter url

How to do pagination SpringBoot with Jbctemplate, MySQL

We are going to be working on a topic which is a basic need when doing any app, and it is Pagination. let's get started creating a product table at https://mockaroo.com/ create table products ( id INT, name VARCHAR(50), code VARCHAR(50) ); insert into products (id, name, code) values (1, 'Hettinger-Goyette', '42549-680'); insert into products (id, name, code) values (2, 'Konopelski-Klein', '49527-724'); insert into products (id, name, code) values (3, 'Smitham, Kuhlman and Balistreri', '53238-003'); insert into products (id, name, code) values (4, 'Hettinger, Weissnat and Goodwin', '0143-9916'); insert into products (id, name, code) values (5, 'Rowe Inc', '42291-898'); insert into products (id, name, code) values (6, 'Ernser-Hauck', '10544-617'); insert into products (id, name, code) values (7, 'Maggio and Sons', '68788-9087'); insert into products (id, name,

How to secure SpringBoot with SSL and Tomcat or Undertow

when we are going to take our applications to production mode, we must have an SSL certificate for the FrontEnd and   BackEnd too, in this case, our backend is a  SpringBoot which is using a tomcat embedded server. Terminology TLS vs SSL TLS is the successor to SSL. It is a protocol that ensures privacy between communicating applications. Unless otherwise stated, in this document consider TLS and SSL as interchangable. Certificate (cert) The public half of a public/private key pair with some additional metadata about who issued it etc. It may be freely given to anyone. Private Key A private key can verify that its corresponding certificate/public key was used to encrypt data. It is never given out publicly. Certificate Authority (CA) A company that issues digital certificates. For SSL/TLS certificates, there are a small number of providers (e.g. Symantec/Versign/Thawte, Comodo, GoDaddy, LetsEncrypt) whose certificates are included by most browsers and Operating System