-
Create a Github account.
-
Fork the repository from the top right of this page. You will make edits to your personal fork, and then make a request for your changes to be accepted into the master copy.
Github Codespace is a cloud workspace where small amounts of code can be executed for free. Disclaimer: It is a billable service. You can monitor your usage and billing here. There will be a section to track your Codespace usage.
By default, the spending limit is $0 so you won't be charged. The monthly quota should be sufficient for light testing of this repository.
- Create a Codespace from your fork.
- Configure node in the codespace terminal. For consistency, this project uses
14.15.1
.
nvm install 14.15.1
nvm alias default 14.15.1
-
Download Visual Studio Code (VS Code).
-
Connect to this codespace using VS Code. You will be prompted to install a Github Codespace extension.
This repository runs mongo, redis and node services in the background. It can cause your codespace usage to rack up overnight. You can shutdown your instance after each development and testing session.
- Run the redis container.
docker run -d -p 6379:6379 --name redis --restart=always redis
- Run the mongo container.
docker run -d -p 27017:27017 -e MONGO_INITDB_ROOT_USERNAME=admin -e MONGO_INITDB_ROOT_PASSWORD=password -v local-mongo:/data/db --name mongo --restart=always mongo
- Enter the mongo shell.
docker exec -it mongo mongosh
- Authenticate as admin. The default password (configured in Step
3.2
) ispassword
.
test> use admin
switched to db admin
admin> db.auth('admin', passwordPrompt())
Enter password
********{ ok: 1 }
- Create a database.
admin> use ultimafia
switched to db ultimafia
- Exit the mongo shell.
ultimafia> exit
- Install pm2 globally.
npm i -g pm2
- Install backend node modules.
cd /workspaces/Ultimafia/
npm install
- Install frontend node modules.
cd react_main
npm install
- Create the backend
.env
.
cp docs/server_env /workspaces/Ultimafia/.env
- Create the frontend
.env
. Note that this file is under thereact_main
subdirectory.
cp docs/client_env /workspaces/Ultimafia/react_main/.env
- Follow this guide for retrieving your own test API keys for Firebase and reCAPTCHA. As you follow the guide, fill in the
.env
files.
- Start the backend server
cd /workspaces/Ultimafia
npm start
- Start the frontend React app
cd react_main
npm start
- Check that the forwarded ports are on localhost
127.0.0.1
.
- You can now view your test site and create your own test account. Find the port that is
3001
, and click the globe icon to "Open in Browser".
This account is not affiliated to ultimafia.com
. If your email domain is not accepted, look for the email section in both .env
files.
To play games with bots, we need to add the dev
property to your user. Make sure that you first create an account on your test site.
- Enter the mongo shell via
mongosh
.
docker exec -it mongo mongosh
- Authenticate as admin.
test> use admin
switched to db admin
admin> db.auth('admin', passwordPrompt())
Enter password
********{ ok: 1 }
admin>
- Enter the ultimafia collection.
admin> use ultimafia
switched to db ultimafia
- Add the dev property to your user.
ultimafia> db.users.updateOne(
{ name: '<username>' },
{ $set: {dev: 'true'} })
{
acknowledged: true,
modifiedCount: 1
}
- Check that your user has the dev property.
ultimafia> db.users.find({}, {name:1, dev:1})
[
{
_id: ObjectId('XXX'),
name: '<username>',
dev: 'true'
}
]
-
Create and host a setup.
-
A test tube icon appears in the top bar.
- Click the test tube icon and bot accounts will spawn in new windows. Remember to enable pop-up windows in your browser.
- Stash away your previous changes.
git stash
- Return to the master branch.
git checkout master
- Get the latest updates from
UltiMafia/Ultimafia
's master branch.
git pull upstream master
- Create a new branch (i.e. code workspace) for your role. To avoid dealing conflicts, use a new branch name each time.
git checkout -b add-mafioso-role
You can now make code changes as needed.
This step can be done using Github Desktop. A guide for that will come soon.
- Check the changes made. You should be on your role branch.
git status
You can also type this command to double check the changes made. It will show you which lines have been added or modified.
git diff
- Confirm your changes by committing.
git commit -am "added mafioso role"
The confirmatory message will be like this:
[add-example-icon abcde12] added example icon
2 files changed, 4 insertions(+)
- Upload your code to Github (also known as "remote"). The branch name is what you see beside
abcde12
in the previous confirmatory message. Note that your copy won't be exactlyabcde12
git push origin add-mafioso-role
The changes have been committed to your personal fork, e.g. DrSharky/Ultimafia
. The site is running on a shared master copy, UltiMafia/Ultimafia
.
-
Go to UltiMafia/Ultimafia.
-
You might see a message prompting you to create a pull request.
Click Compare & pull request
if you can, then you can skip Step 3.
- If you do not see that automated message, click
New Pull Request
. Select "compare across forks". Find your repository in the red box, and find your branch name in the blue box.
-
(Optional) Add any details in the description.
-
Set the Pull Request title to
feat: added mafioso role
-
Click
Create Pull Request
, ensuring that it does not say "draft". -
Your pull request (PR) will appear here, and it will soon be reviewed.