Skip to content

๐Ÿฅ‹ A full-stack Karate Kid themed raffle application I made from scratch

Notifications You must be signed in to change notification settings

FrancescoCoding/DojoDraw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

16 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ–ฅ๏ธ Web Server Setup Guide

This guide provides instructions for setting up the web server on a fresh Ubuntu server. It covers the installation of Docker and Docker Compose. The installation of Node.js and other dependencies such as npm packages are handled by Docker, as specified in the Dockerfiles for both the frontend and backend. For example, both Dockerfiles use the node:16 image as a base, ensuring that Node.js is available without requiring a separate installation on the host system. Additionally, dependencies are installed within the containers using RUN npm install, eliminating the need for Node.js and npm on the Ubuntu server outside of Docker. This approach focuses on Docker as the primary requirement for running DojoDraw.

Note

Please note that this local setup utilises a connection URI for MongoDB Atlas, specified within the environment variables to enhance security. Due to the firewall settings on the Robert Gordon University (RGU) network, this local setup might not work as expected when connected to the RGU network. For convenience and to ensure accessibility, a live version of this application is hosted on the live link below. This ensures that you can evaluate and interact with the application without facing connectivity issues imposed by network restrictions.

๐ŸŒ DojoDraw Live link (hosted on Netlify & Google Cloud)

๐Ÿ“‹ Prerequisites

  • A fresh Ubuntu server
  • Root or sudo access

๐Ÿš€ Automatic Setup Instructions

You can automatically download and run the setup script using the following command. This command will download the setup.sh script, make it executable, and then run it, performing all necessary setup steps.

curl -o setup.sh https://raw.githubusercontent.com/FrancescoCoding/DojoDraw/main/setup.sh?token=<get-from-owner> && chmod +x setup.sh && sudo ./setup.sh

๐Ÿ”ง Post-Setup

After completing the setup steps, the web server should be running. You can verify its status by accessing the server's IP address on the configured ports.

With the current setup, ports so far are:

๐Ÿ› ๏ธ Manual Setup Instructions

If the automatic setup encounters problems, switching to the manual instructions allows for detailed troubleshooting of each step. This method helps pinpoint and resolve issues more effectively.

Step 1: Update the Server

Ensuring the package lists and installed packages are up to date by running the following commands in the Ubuntu terminal.

sudo apt-get update
sudo apt-get upgrade -y

Step 2: Install Docker

Install Docker to manage the containers.

sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce

Step 3: Install Docker Compose

Install Docker Compose to manage multi-container Docker applications.

sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

Step 4: Clone the DojoDraw Project

Clone the project repository from GitHub.

git clone https://github.com/FrancescoCoding/DojoDraw
cd coursework-FrancescoCoding

Step 5: Set Up Environment Variables

Rename the .env.example file to .env in thebackend directory. To maintain security, the .env file is not included in the repository. The only thing missing is the MONGO_URI , which is the connection URI for MongoDB Atlas. This will need to be obtained by the project owner and added to the .env file.

You can also create a different database and add the connection URI to the .env file. This will allow you to run the application with your own database, as all the necessary collections will be created automatically.

SERVER_PORT=8080
MONGO_URI=mongodb+srv://francesco:<PASSWORD>@cluster0.zcq46lg.mongodb.net/DojoDraw
NODE_ENV=development

Step 6: Start the Web Server

Use Docker Compose to build and start the web server.

docker-compose up -d

About

๐Ÿฅ‹ A full-stack Karate Kid themed raffle application I made from scratch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published