Development Environment Setup - Monash-FIT3170/2025W1-Beastly-Brawl-Showdown GitHub Wiki

Overview

Development work was carried out on WSL (Windows Subsystem for Linux), utilizing the default virtual machine, Ubuntu. NVM (Node Version Manager) was employed to address Node.js installation issues. Additionally, VSCode was recommended as the preferred editor, although this choice is left to user preference.

Setup Instructions

Links are provided for extra reading

1.0: WSL

Note: skip if on a Linux/iOS system

1.1: Install WSL

Run the following in PowerShell, the default should be Ubuntu (https://learn.microsoft.com/en-us/windows/wsl/install)

wsl --install

1.2: Verify Install

Enter the VM now

wsl ~

Now you should be prompted to create your user details (https://learn.microsoft.com/en-us/windows/wsl/setup/environment)

Then exit the VM with:

exit

In a new PowerShell terminal check that WSL is running the right version and selecting the correct VM(https://learn.microsoft.com/en-us/windows/wsl/install#check-which-version-of-wsl-you-are-running):

wsl -l -v
  NAME      STATE           VERSION
* Ubuntu    Running         2

1.3: Update Ubuntu

Now enter the VM:

wsl ~
sudo apt update && sudo apt upgrade

2.0: JS Environment

NOTE: Ensure that you are within the VM and using the terminal from username@computername:~$

See: https://learn.microsoft.com/en-us/windows/dev-environment/javascript/nodejs-on-wsl#install-nvm-nodejs-and-npm

2.1: Install NVM (Node Version Manager)

When in WSL download (https://github.com/nvm-sh/nvm?tab=readme-ov-file#install--update-script)

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh | bash

Restart the VM

exit
wsl ~

Now check that it installed correctly (https://github.com/nvm-sh/nvm?tab=readme-ov-file#verify-installation)

command -v nvm

2.2: Install NPM

Get the stable LTS (22.14.0 as of 23/02/2025)

nvm install --lts

3.0 Meteor

Install Meteor

npx meteor

If the above doesn't work:

curl https://install.meteor.com/ | sh

4.0: MongoDB

4.1: Install Extension

Install the extension in your editor of choice

  • VSCode ID: mongodb.mongodb-vscode

4.2: Install DB Locally

Adapted from: https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/

Note: Local instance is not required for tutorial.

Update system packages to have Mongo

curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
   sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg \
   --dearmor
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list
sudo apt-get update

Install

sudo apt-get install -y mongodb-org

4.2 Verify that it works

sudo systemctl start mongod

4.3: Connect (Meteor Tutorial Only)

Your embedded MongoDB is running in port 3001.

Note: you may not be able to do this until the project is partially done.

  1. Open form (Advanced Connection Settings if using the VSCode extension)
  2. Replace with mongodb://localhost:3001

5.0: Git

5.1: Install Git

Update your system and install Git in your WSL environment:

sudo apt update && sudo apt upgrade
sudo apt install git

5.2: Clone Git Repository

Clone the existing remote repository to your local machine using HTTPS:

git clone https://github.com/Monash-FIT3170/2025W1-Beastly-Brawl-Showdown.git

Navigate into the project directory:

cd 2025W1-Beastly-Brawl-Showdown/

5.3: Configure Git

Set your local Git configuration for this repository, including your name and email, which will be associated with your commits.

git config --local user.name "Your Name"
git config --local user.email "[email protected]"

Configure Git to store credentials for HTTPS authentication:

git config --global credential.helper store

5.4: Create Personal Access Token

To authenticate with GitHub via HTTPS, you must use a Personal Access Token instead of your GitHub password.

  1. Log into your GitHub account.
  2. Open https://github.com/settings/tokens
  3. Click "Generate new token (classic)".
  4. Add a descriptive token name (e.g. "BeastlyBrawlToken")
  5. Set Expiration to "No expiration"
  6. Under Scopes, check the box for repo
  7. Click "Generate token".

Important: Copy and securely save your token immediately after generating it. You won't be able to view it again.

5.5 Test your push access

Perform a dry run of a git push command to verify that everything is working correctly:

git push --dry-run

When prompted:

  • Username: enter your Github username
  • Password: enter the Personal Access Token generated earlier If authentication succeeds, the dry run will simulate a push without transferring any data.

6.0: Docker

A simple docker tutorial that gets people comfortable with the absolute basics of Docker and its commands. Docker Images are a blueprint for making an application, whilst Docker Containers are a running instance of a Docker Image. Docker containers run the same way on any operating system and are more lightweight than a Virtual Machine, making them incredibly portable and sandboxed. Multiple Docker containers can be run simultaneously without impacting each other.

6.1 Installing Docker

First make sure that your WSL system is up to date, then install Docker.

This tutorial will be installing Docker without Docker desktop, as in initial testing it caused WSL to crash repeatedly

Launch WSL

wsl ~

Once inside Ubuntu run the following to make sure Ubuntu is up to date

# Update package info
sudo apt update
# Install Docker
sudo apt install docker.io -y

This may take a few minutes

6.2: Starting Docker

Once Docker is installed, start it

## Enable Docker to start as a service
sudo service docker start

Currently, sudo is required every time a Docker command is run The following commands can be run to bypass this

# Add your user to the docker group
sudo usermod -aG docker $USER

## Apply the new group without logging out
newgrp docker

6.3: Additional Docker setup (OPTIONAL)

The following commands allow for the Docker service to be started automatically when wsl is launched

nano ~/.bashrc

Insert the following code at the bottom of the file:

# Start Docker daemon if not running
if ! pgrep -x "dockerd" > /dev/null; then
  echo "Starting Docker..."
  sudo service docker start > /dev/null
fi

Ctrl + s to save Ctrl + x to exit

6.4: Verifying installation + useful commands

Time to test if your Docker installation works by running a test image

docker run hello-world

Mac instructions:

Install the following:

Installing Docker

Download Docker Desktop for Apple Silicon Make sure you are downloading the right version please, only M1-M4 chips are Apple Silicon

  1. Once downloaded, double-click the .dmg file.
  2. Drag the Docker icon into the Applications folder.
  3. Launch Docker Desktop from Spotlight (Cmd + Space, type Docker).
  4. When prompted, authorize Docker with your system password (it requires privileged access).

You may be prompted to install the Rosetta emulator. Accept if you're using any Intel-based tools, though Docker will run natively. Docker will show a “Docker is starting…” message. Wait until it says “Docker is running” in the menu bar whale icon.

Verify Docker works:

docker run --rm hello-world

Installing Homebrew

Run the following in terminal:

xcode-select --install

Install Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Add Homebrew to terminal

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

Checking Homebrew installed correctly:

brew --version

6.5: Dev Containers

Dev containers improve the usability of Docker as the entire environment required for coding is packaged together. This includes source code, packages and even extensions for editors like VSCode, providing a standardised development environment for every developer.

At the time of this tutorial, a Dev Container tutorial is in the works, but has so far been unsuccessful.

Docker tutorial is continued on Learning page

Quick Resources

SETUP FOR NEW RUNNING ENVIRONMENT:

Start Database

Note: This requires a local Mongo Instance

This only needs to be run on reboot.

cd ./code
sh start_db.sh

Start Game Server

Note: This requires Download typescript and ts-node if you haven't already

Open a new terminal for this.

cd ./code/game-server-v2
ts-node main.ts

Missing Packages?

npm install

Start Front End

Note: This requires Meteor

Open a new terminal for this.

cd to ./code/beastly-brawl-showdown
sh run.sh

Missing Packages?

meteor npm install

Help

IF YOU ARE GETTING THIS ERROR:

image

cd code/beastly-brawl-showdown

meteor npm install

IF YOU ARE STILL GETTING ERRORS

cd code/beastly-brawl (if not already)

npm install INSERT PACKAGE HERE (express, socket.io, whatever you are missing)

In one terminal, run: cd code sh start_db.sh and to start the server cd code/game-server-v2 ts-node main.ts

in another terminal cd to code/beastly-brawl-showdown sh run.sh to run the application