Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Dockerize demo projects #377

Merged

Conversation

scissorsneedfoodtoo
Copy link
Contributor

@scissorsneedfoodtoo scissorsneedfoodtoo commented Feb 15, 2023

Checklist:

Sorry all, this is a big one.

This PR Dockerizes all the projects in this repo, and uses Docker Compose to make building and starting multiple projects locally a bit easier.

I tried to keep a light touch with the individual projects. Most updates to projects are to fix issues with Rollup that I ran into, or to fix a bug after recent package version bumps from Renovate.

If it's easier, I can create new PRs for those project fixes. I think there were just one or two, one being the update to server.js for the Build a Pinterest Clone project.

Another big change was tweaking the method to refresh the access token for the Twitch Proxy project and moving those scripts into that project's directory. That project's container will also need to be set up to restart when it fails so that it can fetch a new access token every month, but that will probably depend on how the project is deployed.

Finally, the tests were simplified, and there's a new test to check the status code for every project.

Edit: These commits are all over the place, and I'd be happy to squash them if that makes things easier :)

@socket-security

This comment was marked as resolved.

@scissorsneedfoodtoo scissorsneedfoodtoo force-pushed the feat/dockerize-demo-projects branch 16 times, most recently from 9feb536 to cd91c7a Compare February 21, 2023 09:58
@scissorsneedfoodtoo scissorsneedfoodtoo marked this pull request as ready for review February 21, 2023 10:16
@scissorsneedfoodtoo scissorsneedfoodtoo force-pushed the feat/dockerize-demo-projects branch 2 times, most recently from 33dabcc to ce5890f Compare March 15, 2023 10:50
@scissorsneedfoodtoo
Copy link
Contributor Author

Thanks for your patience @raisedadead. I went through the projects and replaced any short links I could find outside of the examples in the URL Shortener Microservice project. I also replaced updated a few other links to serve files from our CDN.

This should be ready for another round of reviews.

@scissorsneedfoodtoo scissorsneedfoodtoo force-pushed the feat/dockerize-demo-projects branch 2 times, most recently from 4bfc5a5 to adb0961 Compare March 22, 2023 07:32
@scissorsneedfoodtoo
Copy link
Contributor Author

Note: The last commit bumps the Node version for all containers to v18, and requires Node v18 and npm v9 in the main package.json file.

@raisedadead
Copy link
Member

raisedadead commented Apr 13, 2023

OK - I have added some changes to the Docker Compose based setup. I would like to have it tested, though.

In theory, you should be able to do this as a first-time contributor:

  1. Clone and Checkout this PR's branch.

  2. Run these commands:

    cp sample.env .env
    npm ci
    npm run start

Do note that your machine will need Docker (or Docker Desktop). Some apps need legit env keys, but that is OK. You can ignore those apps.

Finally, to confirm everything is working, visit any app, for example, like so:

https://weather-proxy.localhost

image

@raisedadead
Copy link
Member

Once you are done, do not forget to clean up with the following:

docker compose down
docker system prune --volumes --all --force

Copy link
Member

@ShaunSHamilton ShaunSHamilton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To confirm: I was able to get this up and running with the suggested instructions.

I only visited a few of the sites, but there were no errors from docker.

@raisedadead raisedadead merged commit cf992a5 into freeCodeCamp:main Apr 13, 2023
@scissorsneedfoodtoo scissorsneedfoodtoo deleted the feat/dockerize-demo-projects branch April 17, 2023 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants