Skip to content

Commit

Permalink
Add dockerized service project idea
Browse files Browse the repository at this point in the history
  • Loading branch information
kamranahmedse committed Oct 9, 2024
1 parent ea7b55c commit 900b618
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 1 deletion.
64 changes: 64 additions & 0 deletions src/data/projects/dockerized-service-deployment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
title: 'Dockerized Service'
description: 'Use GitHub Actions to Deploy a Dockerized Node.js Service'
isNew: false
sort: 11
difficulty: 'intermediate'
nature: 'Docker'
skills:
- 'nodejs'
- 'docker'
- 'devops'
seo:
title: 'Dockerized Service Deployment'
description: 'Use GitHub Actions to Deploy a Dockerized Node.js Service to a remote server'
keywords:
- 'Docker'
- 'DigitalOcean'
- 'Node.js'
- 'GitHub Actions'
roadmapIds:
- 'devops'
---

The goal of this project is to dockerize a simple Node.js service and deploy it to a remote server using GitHub Actions. You will also practice secrets management.

## Requirements

There are 4 parts to this project:

- **Step 1** — Creating a Node.js service
- **Step 2** — Dockerizing the Node.js service
- **Step 3** — Setup a remote Linux Server
- **Step 4** — Deploying the Dockerized Node.js service to a remote server using GitHub Actions

### Part 1: Creating a Node.js service

You are required to create a simple Node.js service with two routes:

- `/` route - which simply returns `Hello, world!`
- `/secret` route - protected by Basic Auth

Project should have a `.env` file with the following variables:

- `SECRET_MESSAGE` - the secret message that the `/secret` route should return
- `USERNAME` - the username for the Basic Auth
- `PASSWORD` - the password for the Basic Auth

When user visits the `/secret` route, they should be prompted for the username and password. If the username and password are correct, they should be able to see the secret message. If the username and password are incorrect, they should see an error message.

### Part 2: Dockerizing the Node.js service

Create a Dockerfile for the Node.js service that will build a Docker image. You should be able to run the Docker image locally. Make sure that the `.env` file is not included in the Docker image.

### Part 3: Setup a remote Linux Server

Setup a remote Linux server on either [DigitalOcean](https://m.do.co/c/b29aa8845df8), AWS, or any other provider. You can either set it up manually by using SSH or use a mix of Ansible or Terraform from previous projects.

### Part 4: Deploy the Dockerized Node.js service

Create a workflow that will build a Docker image and push it to the container registry. The workflow should then deploy the Docker image to the remote server. Feel free to explore secrets management in GitHub Actions. I will leave the implementation details to you.

<hr />

Once you are done with the project, you will have practiced dockerizing applications, setting up remote servers, implementing CI/CD workflows and secrets management.
2 changes: 1 addition & 1 deletion src/data/projects/nodejs-service-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Use the `ansible-playbook` command to run the playbook and deploy the applicatio

#### Option #2: Use SSH to connect and deploy the application

Use SSH to connect and deploy the application. Look into [rsync](https://linux.die.net/man/1/rsync) and these GitHub Actions to accomplish this: [ssh-agent](https://github.com/webfactory/ssh-agent), [appleboy/ssh-action](https://github.com/appleboy/ssh-action).
Use SSH to connect and deploy the application. Look into [rsync](https://linux.die.net/man/1/rsync) and these GitHub Actions to accomplish this: [web-factory/ssh-agent](https://github.com/webfactory/ssh-agent), [appleboy/ssh-action](https://github.com/appleboy/ssh-action).

<hr />

Expand Down

0 comments on commit 900b618

Please sign in to comment.