Skip to content

Repository files navigation

ynodeploy

Deployment scripts for YNOProject

Overview

This section provides an overview of the YNOProject architecture and the scripts in this repository.

YNOProject architecture

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:

ynodeploy layout

Files:

  • docker-compose.yml.example (copied to docker-compose.yml by 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 to nginx.conf by init script) - nginx (HTTP server) configuration.
  • schema.sql - the database schema used to create the database tables.
  • key.bin and key.txt (generated by scripts/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 ynoengine
  • games - Base directory for games
  • repos - Cloned source code repositories for all the components; initialized by scripts/init.sh
  • scripts - Miscelaneous automation scripts

Setup instructions

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, docker and docker-compose installed

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

Setup for development

  1. Clone the ynodeploy repository and open it:
    $ git clone https://github.com/knuxify/ynodeploy; cd ynodeploy
  2. Run scripts/init.sh:
    $ ./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 repos subfolder.
  3. For every game you want to run, run scripts/add-game.sh:
    $ ./scripts/add-game.sh gamename path/to/game/files
    Replace gamename with the game's short name and path/to/game/files with the path to the extracted game (folder that contains RPG_RT.exe).
  4. Compile ynoengine using the build script in the engine folder (the build script will automatically copy the built files to repos/forest-orb):
    $ engine/build.sh
  5. 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 sudo or add your user to the docker group 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

Setup for production

  1. Perform the above steps for the initial setup.
  2. Run ./scripts/change-domain.sh yno.local domain.tld https to set the target domain in all config files and code.
  3. Set up a reverse proxy to connect to the port exposed by the container (todo instructions/config?)

Maintenance

Updating YNO server components

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.

Updating games

Extract the new game files to any directory, then run ./scripts/update-game.sh path/to/game/files gamename (change the arguments as needed).

About

(wip) Docker deploy scripts for ynoproject

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages