Robot Race
September 24, 2022 ยท View on GitHub
Based on a board game.
Forked from this commit of pig-card-game.
Development
npm installnpm start- This starts 4 docker containersrobot-race-server: handles http requestsrobot-race-worker: handles game logicrobot-race-front-end: rebuilds front-end during developmentredis: a Redis instance
Forking (on different GitHub account)
- Click the fork button
Forking (on same or different GitHub account)
- Create new empty repository on GitHub (or whatever)
git clone https://github.com/nick-ng/robot-race.git <new-repo> && cd <new-repo>- Change
robot-raceto whatever you want and change my name to your name or something. git add . && git commit -m "anything. this will get squashed in the next step"git reset $(git commit-tree HEAD^{tree} -m "forked https://github.com/nick-ng/robot-race")git remote remove origingit remote add origin <url-of-repo-you-made>git push --set-upstream origin main- Change branch permissions etc.
Deploying
./build.shordocker compose -f docker-compose.prod.yml build./serve.shorPORT=<desired-port> docker compose -f docker-compose.prod.yml up -d
Deploying to Heroku
- Change
.github\workflows\deploy-front-end.ymlso theAPI_ORIGINis your Heroku App's url e.g.API_ORIGIN=https://${{secrets.HEROKU_APP_NAME}}.herokuapp.com - Create an empty Heroku App. Note the app's name
- Get your Heroku API key from https://dashboard.heroku.com/account
- On GitHub repo for your fork, go to the Settings and click on Secrets > Actions
- Add 3 new repository secrets
HEROKU_API_KEY: API key from aboveHEROKU_APP_NAME: App name from aboveHEROKU_EMAIL: Email address of your Heroku account
- Push a commit to the
mainbranch - Manually run the "Deploy Back-end" GitHub action
If you deploy to Heroku often, you can un-comment the "push" trigger in .github\workflows\deploy-back-end.yml
Unit Tests
Create a /spec directory next to the files you want to test then create a file <name-of-file-to-test>.spec.cjs in that.
ToDos
Check this GitHub Project for details.