Running with Docker Compose

Requirements

Game On! requires docker-compose version 1.15.0 or greater. Installation instructions vary by platform.

Starting game services locally

  1. Obtain the source for the root project (gameontext/gameon)

    • HTTPS: git clone https://github.com/gameontext/gameon.git

    • SSH: git clone git@github.com:gameontext/gameon.git

  2. Change to the gameon directory

    cd gameon
  3. Setup your environment (one time).

    ./docker/go-setup.sh

    This will ensure that you have an env file suitable for use with docker-compose and pulls the initial images required for running the system.

    When using Vagrant, this step is done as part of provisioning the VM.

  4. Create aliases to make it easier to manage core game services with docker-compose (see below).

    eval $(./docker/go-run.sh env)
  5. Start the game!

    go-run up
  6. Wait for the system warm up

    go-run wait

    or, to watch the logs stream by, try:

    go-run logs
  7. Carry on with building your room!

  8. Clean up

    go-run down

Files supporting Docker Compose

The docker subdirectory of the root project contains the files required to make game services go:

  • docker-compose.yml declares core game and required backing services

  • docker-compose.override.yml.example can be copied to docker-compose.override.yml and modified to support overlays for local development

  • go-setup.sh is a script to help configure your local environment to work with Docker Compose

  • go-run.sh helps with starting, stopping, and cleaning up Game ON core services.

  • docker-functions is used by both go-setup.sh and go-run.sh to generate the keystore volume and generate environment-appropriate commands.

Note
About go-run.sh, go-run, and go-compose:
  • Use eval $(./docker/go-run.sh env) to add go-run and go-compose aliases to your shell:

    eval $(./docker/go-run.sh env)
    alias
  • Use go-run without arguments to get a list of available actions. Some examples based on the alias created above:

    go-run up
    go-run down
    go-run logs
    go-run rebuild
    go-run restart
    go-run wait
  • go-compose wraps the invocation of docker-compose with -f options for docker-compose.yml and docker-compose.override.yml (if present), and sudo (if required).

    go-compose ps
    go-compose logs

Additional notes when running with Docker Compose:

  • docker-compose still requires sudo on linux platforms, even though docker doesn’t.

  • The Vagrant VM allows all sudo operations with no password.

Rebuilding Core Game services with Docker Compose

The following instructions assume you’ve cloned the root repository, and are interested in editing the map service as an example:

  1. Change to the gameon directory

    cd gameon
  2. Obtain the source for the project that you want to change.

    git submodule init map
    git submodule update map
  3. Make your changes from within the child directory

    cd map
    git checkout -b newbranch

    Edit source or docker/image files using your favorite IDE.

    Tip
    If you plan to edit projects with Eclipse, run ./bin/eclipse.sh to generate eclipse project files.
  4. Compile the source and rebuild docker image

    • To rebuild and restart the map service:

      ./docker/go-run.sh rebuild map
    • To rebuild the image without recreating the container:

      ./docker/go-run.sh rebuild_only map
    • If the service argument is left off, it will attempt to rebuild all of the core services (auth, map, mediator, player, room, webapp). If those submodules haven’t been checked out, there is no harm. The image from dockerhub will be used instead.

      Note
      Top-down vs. incremental updates

      If you want to try using incremental publish, where your changes are live inside the container without requiring the container to be stopped, started, rebuilt or otherwise messed with, you’ll need to create and/or add some lines to ./docker/docker-compose.override.yml to create overlay volumes.

      ./docker/docker-compose.override.yml.example provides examples of how to map expected github subrepository paths to volumes. Copy snippets from that file for the services you’re interested in into docker-compose.override.yml.

      ./docker/go-run.sh will accommodate the creation of the docker-compose.override.yml file, but you may need to run eval $(./docker/go-run.sh env) to update your aliases.

  5. Push your changes to a new branch. From the map directory:

    git add -u
    git commit -s
    Note

    Git commits must be signed

    Once you make your commit, if you go back to the root directory, you will see a pending change for map. This indicates that the submodule is different than the version from the current branch of the root project. Do not check in this change. Sadly, these files can not be added to .gitignore.

    Care must be taken to avoid staging these files if you otherwise end up making changes to files in the root project itself.

results matching ""

    No results matching ""