GitHub Actions CI/CD Tutorial Series — Part 6

Habibi Coding | حبيبي كودنق
Nerd For Tech
Published in
3 min readMay 5, 2023
tutorial banner

In Part 5 of this tutorial series, we covered the following steps:

*) Added GitHub Secrets
*) Created the Docker Compose and .env file
*) Finished cicd.yml file
*) Changed something Backend code to trigger build pipeline

If you missed Part 5, you can find it here: Part 5

We stopped at the build process of the app

Build Project

As you can see the build was successful, now we can merge the branch backend-changes-v3 into master. In order to achieve that go again to “Pull requests” and click on “Merge pull request”:

Merge pull request

Then click on “Confirm merge”:

Confirm merge

Hop on the tab “Actions”:

click on Actions

There you should see a running workflow, you can also click on that workflow:

running workflow

Then you should see first running the build job and then the deploy job:

overview running jobs

The build job went successful but the deploy job failed, so so click on “Deploy Project”:

failed Deploy Project

You should see at the end an error message which says: “docker.errors.DockerException: Error while fetching server API version: (‘Connection aborted.’, PermissionError(13, ‘Permission denied’))
Error: Process completed with exit code 1.

error message

Seems that permission is missing so connect to your server with SSH again:

ssh {your-user}@{your-linode-ip} -p 1022
ssh

Enter this command (source: StackOverflow):

sudo chmod 666 /var/run/docker.sock
change permission

Next, make sure nothing runs on port 9090 :

sudo netstat -tunlp
node application runs on port 9090

Terminate the Node demo application by using the PID 1418:

sudo kill -9 1418
terminated application and check if it was successful

Now, you can log out from your server and jump back to GitHub Actions and there you can click on “Re-run all jobs”:

re-run all jobs

Now, both jobs should finish successfully:

build & deeply success

Lastly, check it in your web browser:

https://task-manager.{your-domain}/api/v1/tasks
API response

And that’s it for this tutorial series.

Congratulations | Mabrook | مبروك you have completed the ENTIRE TUTORIAL SERIES!!!

You should be proud of yourself! If you enjoyed this article, give it a clap.

You can also check out the article in video format on YouTube at: https://www.youtube.com/@habibicoding.

--

--