# How to Deploy Nakaflow * Install the Docker engine on the server. * Link for installation the docker engine ==> https://docs.docker.com/engine/install/ubuntu/ * First of all clone both the repository [frontend] (https://github.com/xenowits/moneyprinter.info) and [backend] (https://github.com/xenowits/nakomoto-coefficient-calculator) from the github using git clone command. * Set the TLS on the server using the commands: ``` sudo apt install certbot python3-certbot-nginx ``` ``` sudo certbot --nginx ``` * Check whether nginx is present on the server if not then run the commands to install the nginx. ``` sudo apt update ``` ``` sudo apt install nginx -y ``` * So now nginx is install on the server go to this path /var/www/ and create a directory go inside the directory which you created and using nano create a file name nginx.conf and write the content to point the port 3000 to 80 like given below. ``` server { listen 80; listen [::]:80; server_name domain_name; location / { proxy_pass http://localhost:3000/; } location /api/ { proxy_pass http://localhost:8080/; } ``` * Now go to this path /etc/nginx and open the nginx.conf using nano comment out this line #include /etc/nginx/sites-enabled/* * Add the path where your nginx.conf is present in to the nginx.conf file include /var/www/directory_name/*; * Go to the nakomoto-coefficient-calculator directory where you clone this repository. * For building the docker image from the docker file run the command. ``` DOCKER_BUILDKIT=1 docker build . --platform=linux/amd64 -t xenowits/nc-calc:v0.1.0 ``` * After executing the build command check the image is created or not for checking run the command. ``` docker images ``` * Docker images command shows list of images you have. * For creating a container from the image (xenowits/nc-calc) run the command. ``` docker run -d --rm -v "$(pwd):/opt/xenowits" -p 8080:8080 xenowits/nc-calc:v0.1.0 ``` * Now we have to run the container for frontend go inside the moneyprinter.info directory you cloned. * For building the image run the command. ``` DOCKER_BUILDKIT=1 docker build . --platform=linux/amd64 -t xenowits/nakamoto-coefficient-frontend:v0.1.0 ``` * For creating the container from the image(xenowits/nakamoto-coefficient-frontend) run the command. ``` docker run -d -p 3000:3000 xenowits/nakamoto-coefficient-frontend:v0.1.0 ``` * For checking our both container is running successfully type the command. ``` docker ps ``` * If both are running just go to the browser and query for frontend and backend you will see your website successfully deployed on the server.