An artifact registry for IT Project (COMP30022).
Fun With Friends is built using the MERN stack, consisting of a React frontend served by a NodeJS backend running Express and connected to a MongoDB database.
- New pull requests trigger TravisCI to deploy a new worker
- The worker pulls the repo, installs package dependencies, runs unit and integration tests and builds the React client
- On success, the worker then builds a Docker container of the React client and Express server and pushes it to DockerHub
- On the production server running Ubuntu, Watchtower receives a notification that there is a new latest container. It then fetches the new latest container and gracefully runs the new container while stopping the old container.
- Navigate to the server directory with
cd server
- Execute
npm run dev
to start both the React client and Express server in development mode allowing instant refreshes. The React client listens on port 3000 and the Express server listens on port 8080. Any changes in the code will be displayed after a page refresh.
- From the root directory, navigate to the React client's directory with
cd client
- Update the React client's packages with
npm install
- Build the React client with
npm run build
- From the root directory, navigate to the Express server's directory with
cd server
- Set the environment variable
NODE_ENV
toproduction
withexport NODE_ENV = production
- Start the express server with
npm start
. The Express server listens on port 8080 and serves the static React client content that was built.
- To build the docker container of the server, use
docker image build -t <name>:<tag> .
while in the root directory - To run the docker container, use
docker run -p 80:8080 -e NODE_ENV=production <name>:<tag>
after building