Deployment scripts for YNOProject
This section provides an overview of the YNOProject architecture and the scripts in this repository.
YNOProject consists primarily of the following components:
- ynoengine - fork of EasyRPG Player with multiplayer/YNO support. This is what powers the game itself, and is the version of EasyRPG running in the user's browser.
- forest-orb - the web client, or the UI wrapper around the engine that the player sees in their browser (providing things like the chatbox, etc.)
- ynoserver - the server for an individual game. Provides the backend API that the client communicates with, handling things like seeing other players, chat, badges, authentication, etc.
- ynorankings - one central server for updating the sitewide rankings data.
Other repositories that aid in these goals are:
- ynohome - the homepage of ynoproject.net with links to all the games. Also houses the service worker for notifications.
- ynobadges - badge images and unlock conditions.
- Repositories with game-specific data:
- ynotranslations - translations for all the games on YNO.
- ynolocations - mappings of map IDs to map names and wiki URLs.
- ynopreloads - lists of assets to preload for each room in each game
Files:
docker-compose.yml.example(copied todocker-compose.ymlby init script) - Docker Compose config that runs all the services, as well as the database (MariaDB), HTTP server (nginx) and PHP handler for forest-orb's index.php (php-fpm).nginx.conf.example(copied tonginx.confby init script) - nginx (HTTP server) configuration.schema.sql- the database schema used to create the database tables.key.binandkey.txt(generated byscripts/init.sh) - keys for server-engine communication (todo: elaborate)
Directories:
config- configuration files for ynorankings (rankings.yml) and ynoserver instances for each game (gamename.yml.example).docker- Dockerfiles for ynorankings and ynoserver, used to create the Docker containers (todo: these should probably be upstreamed)engine- Scripts for building ynoenginegames- Base directory for gamesrepos- Cloned source code repositories for all the components; initialized byscripts/init.shscripts- Miscelaneous automation scripts
Note
Commands to run as a regular user are prefixed with $;
commands to run as the root user are prefixed with #.
Prerequisites:
- Server running Linux
python3,git,dockeranddocker-composeinstalled
On Ubuntu/Debian, you can set this up using the following commands:
# apt update
# apt install python3 git docker docker-compose
# adduser $(whoami) docker # add current user to docker group to allow for
# running docker without sudo; needed by some
# of the build scripts
# systemctl start docker # start the docker service
# systemctl enable docker # (optional) always start the docker service at system startup- Clone the ynodeploy repository and open it:
$ git clone https://github.com/knuxify/ynodeploy; cd ynodeploy - Run
scripts/init.sh:This will download all repositories, generate configs and apply fixups needed to get the site up and running. After running this script, relevant repositories will be cloned under the$ ./scripts/init.shrepossubfolder. - For every game you want to run, run
scripts/add-game.sh:Replace$ ./scripts/add-game.sh gamename path/to/game/filesgamenamewith the game's short name andpath/to/game/fileswith the path to the extracted game (folder that contains RPG_RT.exe). - Compile ynoengine using the build script in the
enginefolder (the build script will automatically copy the built files torepos/forest-orb):$ engine/build.sh - Run the container with
docker compose up -d.- You may need to start the Docker service first.
- If you get errors about insufficient permissions, use
sudoor add your user to thedockergroup or equivalent for your distribution - consult your distro's docs.
To check the logs, run docker compose logs. To stop the container, run docker compose down.
By default, the site will be accessible through http://yno.local, with the API
exposed at http://connect.yno.local. You should add entries in your hosts file
(/etc/hosts on Linux) to resolve to yno.local:
127.0.0.1 yno.local
127.0.0.1 connect.yno.local
- Perform the above steps for the initial setup.
- Run
./scripts/change-domain.sh yno.local domain.tld httpsto set the target domain in all config files and code. - Set up a reverse proxy to connect to the port exposed by the container (todo instructions/config?)
Run ./scripts/update-repos.sh, which runs git pull in all subfolders of repos.
Then, shut down the containers with docker compose down, and restart with
docker compose up --build to get the containers to rebuild.
Extract the new game files to any directory, then run ./scripts/update-game.sh path/to/game/files gamename
(change the arguments as needed).