Codylon Studios Documentation
© 2022 - 2026 Codylon Studios
💡 You can search for different projects and install guides to see what Codylon Studios has done so far.
Github: https://github.com/Codylon-Studios
The documentation for TaskMinder on Notion is deprecated, see more: https://docs.taskminder.de
Big Game
last updated: 18th jan 2025
Github Codespaces
⚠️ Warning: FÜR CODESPACES (EXPLIZIT DAFÜR/NICHT FÜR ANDERE OS)
- Codespaces starten, Erweiterung git graph installieren
- In Kommandozeile ausführen: (Installiert alle dependencies)
sudo npm install
- (PostgreSQL (Datenbank-Management) installieren):
sudo apt-get update
sudo apt-get -y install postgresql
- (Start von postgresql server):
sudo service postgresql start
- (Einloggen in Terminal vom Server):
sudo su postgres
- (Anmelden als postgres user (Standard-user)):
psql postgres
- (Passwort ändern und merken!):
\password
- (Erstellt eine Datenbank namens accounts):
CREATE DATABASE accounts;
- (Listet alle Datenbanken auf):
\l
- (Verbindet sich mit Datenbank accounts):
\c accounts
- (Erstellt Tabelle accounts):
CREATE TABLE accounts (
id SERIAL PRIMARY KEY,
username VARCHAR(255) UNIQUE NOT NULL,
password VARCHAR(255) NOT NULL
);
- (erstellt Tabelle chessgames):
CREATE TABLE chessgames (
game_id SERIAL PRIMARY KEY,
player_white_id INT NOT NULL,
player_black_id INT NOT NULL,
start_time TIMESTAMP NOT NULL,
end_time TIMESTAMP,
status ENUM('ongoing', 'white_won', 'black_won', 'draw') NOT NULL,
moves TEXT,
is_rated BOOLEAN DEFAULT FALSE,
time_control VARCHAR(20),
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
FOREIGN KEY (player_white_id) REFERENCES accounts(id) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (player_black_id) REFERENCES accounts(id) ON DELETE CASCADE ON UPDATE CASCADE
);
- (Verlassen psql Terminal Oberfläche, danch Terminal schließen und neu öffnen):
\q
- (Für datenbankverbindung noch config_db.json anlegen!):
your_password beim password parameter soll dabei den Wert tragen, der in Schritt 7 festgelegt wurde.
db_config.json:
{
"host": "localhost",
"port": 5432,
"database": "accounts",
"user": "postgres",
"password": "your_password",
}
- Start von Server:
nodemon server.js
- Besuchen der Website:
localhost:3000
- Jetzt kann man programmieren! Veränderungen im Code werden automatisch erkannt und der Server wird daraufhin neu gestartet.
- Ausführen von Git-Befehlen (wenn nötig)
- Stoppen des Servers (windows, mac, linux)
control+c
- Stoppen der Postgres Datenbank:
sudo service postgresql stop
Bei allen weiteren Malen können die Schritte 1 bis inklusive 15 übersprungen werden, nur die Schritte 16-20 werden für den normalen workflow benötigt. Jedoch muss man vor den 16. Schritt noch
sudo service postgresql start
ausführen, denn dies startet den postgres server (datenbank).
Error/Troubleshooting
1️⃣:
Error: listen EADDREINUSE: address already in use :::3000
(zeigt alle offenen Anwendungen für port 3000 an):
sudo lsof -i :3000
Dies listet alle offenen Anwendungen für port 3000 an, jede enthält eine PID, nun kann man jede ungenutzte Anwendungen durch ihre PID beenden:
(beendet die PID):
kill -9 <PID>
2️⃣:
error: Error: Cannot find module 'bcrypt'
(Wenn bycrpt Fehler gibt):
npm uninstall bcrypt
npm i bcrypt
3: when running psql postgres
psql: error: connection to server on socket “/tmp/.s.PGSQL.5432” failed: No such file or directory Is the server running locally and accepting connections on that socket?
Auf mac: (gibt das Ende der log-file aus:)
tail -n 10 /opt/homebrew/var/log/postgres.log
bzw:
tail -n 10 /opt/homebrew/var/log/postgresql@{version}.log
If error =
data directory “/opt/homebrew/var/postgresql@14” has invalid permissions
Permissions should be u=rwx (0700) or u=rwx,g=rx (0750).
⇒
sudo chmod -R 0700 /opt/homebrew/var/postgresql@14
bzw.:
sudo chmod -R 0700 /opt/homebrew/var/postgres
Git
Under this section, some Git merging strategies will be introduced. Always ask other People before merging branches.
Rebase-Merge (Preferred)
Rewrites the feature branch history to make it appear as if it was developed on top of the current develop branch. This creates a linear history for the feature branch commits and a merge commit when the feature branch is finally merged.
git checkout develop
git pull
git checkout <branch>
git rebase develop
git push --force
git checkout develop
git merge --no-ff <branch>
git push
git branch -d <branch>
You can call
git config merge.ff falseto change config. Then you can callgit merge <branch>instead ofgit merge --no-ff <branch>for future uses.
Merge (Alternative)
Retains the original commit history and creates a merge commit. The history will show exactly where the branches diverged and merged.
git checkout develop
git pull
git merge <branch>
git push
programmierspiel2022
last updated: 18th jan 2025
Install Guide:
Download the project under: GitHub Project. Open the folder and double click on sourcecode.html to open game in browser.
TaskMinder
last updated: 19th march 2025
⚠️ Warning: Documentation deprecated, new docs here: TaskMinder Docs.
DEVELOPMENT
- Start an editor of you choice (preferrably VS Code), install extension “git graph”
- Open Terminal, execute
sudo npm install
to install all dependencies.
Installation of redis:
Follow the guide of your OS (see link below):
For GitHub Codespaces, follow the guide for Ubuntu (Linux).
start Redis:
individuell for OS
GitHub Codespaces:
sudo service redis-server start
For the next step, you need to install the database, PostgreSQL, which is individuell for every OS:
For GitHub Codespaces, execute the following commands to install PostgreSQL start and create the database:
sudo apt-get update
sudo apt-get -y install postgresql
sudo service postgresql start
sudo su postgres
psql postgres
\password
CREATE DATABASE haplaner;
For the other OS, please get into pqsl (SQL Shell) as user postgres and change the password using \password and lastly, create the database:
psql -U postgres
\password
CREATE DATABASE haplaner;
Create an .env file in the root folder, which holds all your enviroment variables:
For DB_PASSWORD, set the value to your password set for the postgres user ealier in this guide.
.env:
DB_USER=postgres
DB_PASSWORD=your_postgres_password
DB_NAME=haplaner
DB_HOST=localhost
NODE_ENV=DEVELOPMENT
REDIS_HOST=redis
REDIS_PORT=6379
SESSION_SECRET=your_session_secret
DSB_USER=your_dsb_user
DSB_PASSWORD=your_passcode
CLASSCODE=your_classcode
DB_CONTAINER=taskminder-postgres
BACKUP_DIR=/var/taskminder/backups
Before starting the server, you still need to create two tables:
node ./src/initTables/eventType.js
node ./src/initTables/team.js
Finally, you can start the server:
nodemon server.js
Visit http://localhost:3000 to view the website.
Stopping the server:
control+c
Stopping redis and postgresql:
See inidividual guides for redis and postgresql on thier offical websites:
GitHub Codespaces:
sudo service postgresql stop
sudo service redis-server stop
Old SQL cmds (not used anymore)
- (Listet alle Datenbanken auf):
\\l
- (Verbindet sich mit Datenbank haplaner):
\\c haplaner
- (Erstellt Tabelle users):
CREATE TABLE users (
id SERIAL PRIMARY KEY,
username VARCHAR(255) UNIQUE NOT NULL,
password VARCHAR(255) NOT NULL,
-- school VARCHAR(200) NOT NULL,
class VARCHAR(255) NOT NULL
);
- Erstellt Tabelle hausaufgaben10d: (wenn bereits erstellt wurde: → ALTER TABLE hausaufgaben10d(…….);)
CREATE TABLE homework10d (
homeworkId SERIAL PRIMARY KEY,
content TEXT NOT NULL,
subjectId INT NOT NULL,
assignmentDate BIGINT NOT NULL,
submissionDate BIGINT NOT NULL
-- lastChanged DATE NOT NULL,
-- author VARCHAR(50) NOT NULL,
-- FOREIGN KEY (author) REFERENCES users(username)
);
- Erstellt Tabelle ereignisse10d
(leer)
- Erstellt Tabelle user_ha10d (JOIN TABLE)
CREATE TABLE homework10dCheck (
checkId SERIAL PRIMARY KEY,
username VARCHAR(255) NOT NULL,
homeworkId INT NOT NULL,
checked BOOLEAN NOT NULL DEFAULT FALSE,
FOREIGN KEY (username) REFERENCES users(username) ON DELETE CASCADE,
FOREIGN KEY (homeworkId) REFERENCES homework10d(homeworkid) ON DELETE CASCADE,
CONSTRAINT unique_user_homework UNIQUE (username, homeworkId) -- ensure a user can only check each homework once
);
- Erstellt Tabelle anmerkungen10d
(leer)
- (Verlassen psql Terminal Oberfläche):
\\q
- Terminal (nur dieses) schließen und neu öffnen
PRODUCTION (Docker Compose)
1. Set Up Server Environment
Update and Upgrade Packages:
sudo apt update && sudo apt upgrade -y
- Ensure you have bought a domain name from a domain registrar (Squarespace, namecheap etc.)
- Ensure git is installed and you have a working terminal text editor (either nano or vi).
git --version
vi --version
nano --version
- Ensure you have changed the password for the root user for safety reasons.
- Find out public IP address of server.
- Update the DNS Configuration on the website of your domain registrar.
Configure Domain Name
DNS Settings: Log in to your domain registrar’s control panel and set an A record for www.codylon.de pointing to your Server’s public IP address.
Should look like this:
• Host/Name: www
• Type: A
• IP Address: The public IP of your server
• TTL: 3600 seconds (default or 1 hour is fine)
Dynamic DNS (If Applicable): If your IP address is dynamic, consider setting up a Dynamic DNS service to keep your domain pointing to the correct IP.
You can check the propagation of your DNS records using tools like DNS Checker. Search for your domain and verify that it resolves to your public IP.
2. Continue Setting Up the Environment
- install and activate the firewall (ufw), allow 80 and 443 (HTTP and HTTPS) to pass.
- Ensure docker, docker-cli and docker compose are installed:
- Clone GitHub repository
Navigate to the Desired Directory: Choose a directory where you want to store your project. (create one with mkdir)
cd /pathtodirectory
Clone the Repository: Use Git to clone the repository:
git clone https://github.com/Codylon-Studios/TaskMinder.git
Create Docker Secrets
In the root folder of your application, create a new folder named docker_secrets.
Inside, create 8 .txt files:
db_name.txt
db_password.txt
db_user.txt
redis_port.txt
session_secret.txt
class_code.txt
dsb_password.txt
dsb_user.txt
backup_dir.txt
db_container.txt
Set Up the Proxy (Nginx)
-
Install Nginx:
sudo apt install nginx -
Create a configuration file for your domain (replace codylon.de with your domain name) :
sudo nano /etc/nginx/sites-available/codylon.de -
Copy your configuration into that file (the one that is provided in the root folder of the cloned repo). Make sure to replace codylon.de with your domain name in the marked places in the Nginx configuration.
-
Set up SSL certificates using Let’s Encrypt, again replacing codylon.de with your domain name in the command.:
sudo apt install certbot python3-certbot-nginx sudo certbot --nginx -d codylon.deThis will automatically create the SSL certificates at the path specified in your config.
-
Create a symbolic link to enable the site:
(Replace codylon.de with your actual domain name)
sudo ln -s /etc/nginx/sites-available/codylon.de /etc/nginx/sites-enabled/
-
Test the configuration for syntax errors:
sudo nginx -t -
Restart Nginx to apply the changes:
sudo systemctl restart nginx -
Make sure your application is running on port 3000 (as specified in
proxy_pass http://localhost:3000).
Don’t forget to init the tables:
node ./src/initTable/eventType.js
node ./src/initTable/team.js
- Start the docker Compose
docker compose up -d --build
8. Test the Deployment
Access the Site: Navigate to https://www.codylon.de in your browser to verify that the site is live and the SSL certificate is functioning correctly.
Check for Errors: Monitor the Nginx logs for any issues.
sudo tail -f /var/log/nginx/error.log
TheHuntingGame (deprecated)
last updated: 19th march 2025
⚠️ Warning: Documentation deprecated!!!
Server-Setup
Important:
Change the DB_HOST value to postgres if you are switching from manual development to docker. DB_HOST value should be localhost for manual development.
Manual development (non Docker)
GitHub Codespaces
Install extension git graph
Install npm packages:
sudo npm install
(sudo npm i -g)
Install postgresql, log in, change password and create database thehuntinggame:
sudo apt-get update
sudo apt-get -y install postgresql
sudo service postgresql start
sudo su postgres
psql postgres
Change password:
\password
Create Database:
CREATE DATABASE thehuntinggame;
General Commands:
Start PostgreSQL Server:
sudo service postgresql start
Stop PostgreSQL Server:
sudo service postgresql stop
Start Redis Server:
sudo service redis-server start
Stop Redis Server:
sudo service redis-server stop
Start nodemon Server:
ctrl+c
MacOS
Install homebrew,
Open Code in VS Code
(install git graph extension)
Open Terminal (cmd+space, search for ‘Terminal’)
install postgresql, redis:
brew install postgresql@14
brew install redis
Start redis:
redis-server
Start Postgresql server (from now on it will auto start at login):
brew services start postgresql
go into postgres:
psql postgres
change password:
\password
If you changed the password to other than “postgres”, you have to update the .env and the docker-compose.yml file too:
DB_USER=postgres
DB_PASSWORD=postgres //Change this
DB_NAME=thehuntinggame
DB_HOST=localhost
JWT_SECRET=ekjbfjw
REFRESH_TOKEN_SECRET=melwmflw
NODE_ENV=DEVELOPMENT
REDIS_HOST=redis
REDIS_PORT=6379
EMAIL_USER=(google email)
CLIENT_ID=(google client id)
CLIENT_SECRET=(google client secret)
REFRESH_TOKEN=(google refresh token)
services:
app:
build: .
container_name: thehuntinggamebackend
ports:
- "3000:3000"
environment:
- PORT=3000
- DB_HOST=postgres
- DB_PORT=5432
- DB_USER=postgres
- DB_PASSWORD=postgres #CHANGE
- DB_NAME=thehuntinggame
- REDIS_HOST=redis
- REDIS_PORT=6379
depends_on:
- postgres
- redis
volumes:
- .:/app
- /app/node_modules
postgres:
image: postgres:14
container_name: postgres
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres #CHANGE
POSTGRES_DB: thehuntinggame
ports:
- "5432:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
redis:
image: redis:6
container_name: redis
ports:
- "6379:6379"
volumes:
- redis-data:/data
volumes:
postgres-data:
redis-data:
Continue creating the database:
CREATE DATABASE thehuntinggame;
Exit posgresql using:
\q
General Commands:
Start the Dev Server using:
nodemon server.js
Stop the Server using:
ctrl+c
stop redis:
ctrl+c
//or
redis-cli shutdown
start redis:
redis-server
Setup email verification sending
✅ Step 1: Make Sure OAuth Consent Screen is Set Up
- Go to Google Cloud Console.
- Navigate to APIs & Services → OAuth consent screen.
- If you haven’t set it up, set the User Type to “External” (required for non-Google Workspace accounts).
- Fill in required fields:
- App name (e.g., “TheHuntingGame”).
- User support email.
- Developer contact email.
- Scopes: Add
https://mail.google.com/(if missing). - Test Users: If in “Testing” mode, add your email as a test user.
- Click Save and Continue.
✅ Step 2: Enable Gmail API
- Go to Gmail API.
- If not enabled, click Enable.
✅ Step 3: Verify OAuth Client ID and Secret
-
Go to APIs & Services → Credentials.
-
Under OAuth 2.0 Client IDs, create a new ClientID, make sure that:
- Application Type is Web (as you are developing/deploying to a web server).
- Redirect URI:
https://developers.google.com/oauthplayground
- Client ID & Client Secret match your
.envfile.
✅ Step 4: Use OAuth Playground to Get Refresh Token
If you didn’t generate the refresh token correctly, redo these steps:
-
Open OAuth 2.0 Playground.
-
Click “OAuth 2.0 Configuration” (gear icon).
-
Check “Use your own OAuth credentials”, enter:
- Client ID (from Google Cloud).
- Client Secret (from Google Cloud).
-
In Step 1, add this scope:
<https://mail.google.com/> -
Click “Authorize APIs” → Sign in with your Gmail account.
-
In Step 2, click “Exchange authorization code for tokens”.
-
Copy the Refresh Token (not the access token) and update your
.envfile:REFRESH_TOKEN=your-refresh-token
- Add your email as USER_EMAIL to the .env file
Template .env:
DB_USER=postgres
DB_PASSWORD=postgres //Whatever your password is
DB_NAME=thehuntinggame
DB_HOST=localhost
JWT_SECRET=ekjbfjw
REFRESH_TOKEN_SECRET=melwmflw
NODE_ENV=DEVELOPMENT
REDIS_HOST=redis
REDIS_PORT=6379
EMAIL_USER=(google email)
CLIENT_ID=(google client id)
CLIENT_SECRET=(google client secret)
REFRESH_TOKEN=(google refresh token)