AnimeHub Deployment

The most interesting part here! In this section, you are going to deploy AnimeHub to the AWS infrastructure provisoned with Terraform Cloud.

1. Go to your GitHub profile github.com/<your-github-username>. Mine is github.com/tulna07, for example.

2. Click the dropdown and select New repository.

0001

3. Name the repository workshop-1-tf-web-app.

0002

4. Leave the other settings as default. Scroll down to the bottom of the page. Click Create repository.

0003

5. You next set up the secrets required for the GitHub Actions to work. Click Settings in your newly created empty repository.

0004

6. In the left sidebar, Click the Secrets and variables dropdown and then select Actions.

0005

7. Click New repository secret.

0006

8. Name the secrect AWS_REGION and the value is us-east-1. Click Add secrect.

0007

9. Do the same for other secrects listed below:

Secrect NameValue
ECR_REPOSITORYworkshop-1
ECS_CLUSTER_NAMEdev-workshop-1
ECS_SERVICE_NAMEapp
S3_BUCKET_NAMEdev-workshop-1
GHA_ROLE_FOR_DEPLOYING_BACKENDEnter the value you got from step 20 in the 5.6 App Module section
GHA_ROLE_FOR_DEPLOYING_FRONTENDEnter the value you got from step 17 in the 5.7 Web Module section

10. After completing the previous step, you got the following secrects.

0008

11. Clone this repository.

git clone https://github.com/Definitely-not-AWS-Workshops/workshop-1-web-app.git

12. Move inside the local repository you have just cloned.

cd workshop-1-web-app

13. Remove the current .git folder.

rm -rf .git

14. Initialize the local repository and link to the remote repository. Replace <your-github-username> with your GitHub username.

git init && \
git remote add origin https://github.com/<your-github-username>/workshop-1-web-app.git

15. Push the first commit to the remote repository.

git add . && \
git commit -m "first commit" && \
git push --set-upstream origin main

16. Create a git tag with the provided version and message.

git tag -a "v1.0.0" -m "release v1.0.0"

17. Push the tag to the GitHub repository.

git push --follow-tags

18. Click Actions tab on your GitHub repository.

0009

19. You will see GitHub Actions trigger two workflows that deploy AnimeHub’s frontend and backend. Check out deploy-frontend.yml and deploy-backend.yml files in .github/workflows folder to discover more how AnimeHub deployment workflows work.

00010

20. Wait for the workflows to complete.

00011

21. Go to AWS ECR console.

22. In the left sidebar, click Repositories under the Private registry dropdown. Click the workshop-1 image repository.

00012

23. Click Images, you then see your newly pushed image with v1.0.0 tag.

00013

24. Go to AWS ECS console.

25. In the left sidebar, click Task definitions and then the app task definition.

00013

26. Choose the most recent app, app:2 in this case.

00014

27. Scroll down to the Containers section, click container-1.

00015

28. Your task definition now use the new image you just pushed.

00016

29. Check out AnimeHub at at your domain name. Mine is https://animehub.tulna07.site, for example. Yes! you are successfully access AnimeHub with https and your own domain name.

00017

30. Let us try to share something with other Anime fans worldwide. Click Share.

00018

31. Fill out the Anime Name field as Naruto Shippuden - Chapter 391, the Link field as https://www.youtube.com/watch?v=Pf5JDzTT8xE, and the Description field as The Returns of Uchiha Madara. Otherwise, post your favorite anime instead. Click Submit.

00019

32. Hurray! Your anime goes out to anime enthusiasts worldwide. You can share the link to your friends. Click Watch to enjoy now.

00020

00021