Skip to content

Latest commit

 

History

History
143 lines (121 loc) · 4.37 KB

README.md

File metadata and controls

143 lines (121 loc) · 4.37 KB

Logog

UNGA - U Never Game Alone

Website Website Docker Image Size (latest by date)

This is a student project of the DHBW RV Campus FN. The purpose of this webapp is that gamers can find other gamers playing the same game. Gamers have to register and afterwards they can add existing games to their profille or create new games.

Getting started

Manually

Here you can see how to run the application manually.
Be sure you have Node.js v16.x: and npm installed! See README.md
You also need mariadb that is setup like initScript

Clone the repo:

Run:

# Clone the Repo
git clone https://github.com/DHBW-FN-TIT20/unevergamealone.git
cd unevergamealone

Dependencies:

Install the dependencies with npm:

# Update npm
npm install -g npm@latest

# Install only production dependencies
npm install

# Install also developer dependencies
npm install --include=dev

If you get an error from node-gyp be sure to have installed a compatible version of Python, one of: v3.7, v3.8, v3.9, or v3.10. See more at node-gyp
To set the python path do:

npm config set python /usr/bin/python3

Configuration

Default Port is set to 3000.
You also need to set the setting for the DB:

# Set it in the bash
export PORT=80                              # Default 3000
export DB_NAME=db                           # Hostname of the DB
export MARIADB_DATABASE=unga                # Default Database
export MARIADB_USER=unga                    # User with read / write permission
export MARIADB_PASSWORD=db_unga_password    # Password for the user

# OR set it in the .env
nano .env

In Production:
If the ENV "NODE_ENV" is set to production the .env-File will be ignored!
Set the ENV:

export JWT_TOKEN=MY_SECRETKEY!

Not in Production:
You can set the JWT_TOKEN in the bash or on the .env-File

# Set it in the bash
export JWT_TOKEN=MY_SECRETKEY!

# Set it in the .env
nano .env

Start UNGA

Run:

# Start it with npm
npm start

# OR

# Start it with node
node ./bin/www

Docker

You can run the application also in a Docker-Container

Build the Container

If you do not want to use buildkit remove DOCKER_BUILDKIT=1 from the command. The contaienr will get the name "unevergamealone"

# Direct from the Repo
DOCKER_BUILDKIT=1 docker build -t unevergamealone https://github.com/DHBW-FN-TIT20/unevergamealone.git#main

# Local
git clone https://github.com/DHBW-FN-TIT20/unevergamealone
cd unevergamealone
DOCKER_BUILDKIT=1 docker build -t unevergamealone .

# You also can use the Makefile
git clone https://github.com/DHBW-FN-TIT20/unevergamealone
cd unevergamealone
make build

Get it from DockerHub

docker pull floskinner/unga

Run the Container

docker run \
    --rm \
    -d \
    -e JWT_TOKEN=SECRET_KEY \
    -e DB_NAME=db \
    -e MARIADB_ROOT_PASSWORD=db_root_password \
    -e MARIADB_DATABASE=unga \
    -e MARIADB_USER=unga \
    -e MARIADB_PASSWORD=db_unga_password \
    -v uploads:/app/public/images/upload \
    -p 80:3000 \
    --name unga \
    floskinner/unga

Docker-Compose

You also can use Docker-Compose. Note that you need to set the ENVs. Also note that it will build the container from the source in the example docker-compose.yml

Start the service:

docker-compose up