Use GitHub Actions to Deploy a Node.js Service to a remote server
The goal of this project is to practice setting up a CI/CD pipeline for a Node.js service using GitHub Actions. You will practice using GitHub Actions for deployment (including Secrets and environment variables), Terraform to provision a server, Ansible to configure the server, and SSH to deploy the application.
If you haven’t completed the previous projects for Configuration Management and IaC, you should do that first. You will be able to reuse the Ansible and Terraform code from those projects.
You are required to have the following setup:
npm
/
route which returns Hello, world!
Once you have the above setup, you are required to implement the following:
Setup a role in ansible called app
that will connect to the server, clone the repository, install the dependencies, build the application, and start the application.
You should be able to run the playbook using the following command and the application should be up and running on port 80
:
ansible-playbook node_service.yml --tags app
You should be able to access the application using the public IP address of the server.
Write a GitHub Action workflow that will deploy the application to the server using one of the following methods. You are welcome to try both options, but you are not required to do that. You are also welcome to use any other method to accomplish the same result.
Use the ansible-playbook
command to run the playbook and deploy the application
Use SSH to connect and deploy the application. Look into rsync and these GitHub Actions to accomplish this: web-factory/ssh-agent, appleboy/ssh-action.
Once you have the application deployed, you should have a good understanding of automating the process of setting up a server and deploying an application to it.
Actively Maintained
We are always improving our content, adding new resources and adding features to enhance your learning experience.
Join the Community
roadmap.sh is the 7th most starred project on GitHub and is visited by hundreds of thousands of developers every month.
Roadmaps Best Practices Guides Videos FAQs YouTube
roadmap.sh by @kamrify @kamrify
Community created roadmaps, best practices, projects, articles, resources and journeys to help you choose your path and grow in your career.
Login to your account
You must be logged in to perform this action.