mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 12:11:33 -06:00
Docker: Add initial configuration for project (#4419)
* feat(docker): Add initial Docker configuration for project - Add .dockerignore file to ignore unnecessary files - Create Dockerfile with basic build and deployment configuration * feat(docker): Updated Docker configuration for improved security and build efficiency - Removed sensitive files from .dockerignore - Moved WORKDIR to /app in Dockerfile - Added gunicorn==23.0.0 dependency in RUN command - Created new docker-compose.yml file for service definition * feat(deployment): Implement containerized deployment configuration - Add additional environment variables for Python optimization - Update Dockerfile with new dependencies: eventlet, gevent, tornado - Create docker-compose.yml and configure services for web and nginx - Implement example configurations for web host settings and gunicorn - Establish nginx configuration for reverse proxy - Remove outdated docker-compose.yml from root directory * feat(deploy): Introduce Docker Compose configuration for multi-world deployment - Separate web service into two containers, one for main process and one for gunicorn - Update container configurations for improved security and maintainability - Remove unused volumes and network configurations * docs: Add new documentation for deploying Archipelago using containers - Document standalone image build and run process - Include example Docker Compose file for container orchestration - Provide information on services defined in the `docker-compose.yaml` file - Mention optional Enemizer feature and Git requirements * fixup! feat(docker): Updated Docker configuration for improved security and build efficiency - Removed sensitive files from .dockerignore - Moved WORKDIR to /app in Dockerfile - Added gunicorn==23.0.0 dependency in RUN command - Created new docker-compose.yml file for service definition * feat(deploy): Updated gunicorn configuration example - Adjusted worker and thread counts - Switched worker class from sync to gthread - Changed log level to info - Added example code snippet for customizing worker count * fix(deploy): Adjust concurrency settings for self-launch configuration - Reduce the number of world generators from 8 to 3 - Decrease the number of hosters from 5 to 4 * docs(deploy using containers): Improve readability, fix broken links - Update links to other documentation pages - Improve formatting for better readability - Remove unnecessary sections and files - Add note about building the image requiring a local copy of ArchipelagoMW source code * Update deploy/example_config.yaml Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com> * Update deploy/example_selflaunch.yaml Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com> * Update Dockerfile Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com> * Update deploy/example_selflaunch.yaml Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com> * fixup! Update Dockerfile * fix(Dockerfile): Update package installations to use latest versions - Remove specific version pins for git and libc6-dev - Ensure compatibility with newer package updates * feat(ci): Add GitHub Actions workflow for building and publishing Docker images - Create a new workflow for Docker image build and publish - Configure triggers for push and pull_request on main branch - Set up QEMU and Docker Buildx for multi-platform builds - Implement Docker login for GitHub Container Registry - Include Docker image metadata extraction and tagging * feat(healthcheck): Update Dockerfile and docker-compose for health checks - Add health check for the Webhost service in Dockerfile - Modify docker-compose to include a placeholder health check for multiworld service - Standardize comments and remove unnecessary lines * Revert "feat(ci): Add GitHub Actions workflow for building and publishing Docker images" This reverts commit 32a51b272627d99ca9796cbfda2e821bfdd95c70. * feat(docker): Enhance Dockerfile with Cython build stage - Add Cython builder stage for compiling speedups - Update package installation and organization for efficiency - Improve caching by copying requirements before installing - Add documentation for rootless Podman * fixup! feat(docker): Enhance Dockerfile with Cython build stage - Add Cython builder stage for compiling speedups - Update package installation and organization for efficiency - Improve caching by copying requirements before installing - Add documentation for rootless Podman --------- Co-authored-by: Adrian Priestley <apriestley@gmail.com> Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com> Co-authored-by: Adrian Priestley <apriestley@bob.localdomain>
This commit is contained in:
91
docs/deploy using containers.md
Normal file
91
docs/deploy using containers.md
Normal file
@@ -0,0 +1,91 @@
|
||||
# Deploy Using Containers
|
||||
|
||||
If you just want to play and there is a compiled version available on the [Archipelago releases page](https://github.com/ArchipelagoMW/Archipelago/releases), use that version.
|
||||
To build the full Archipelago software stack, refer to [Running From Source](running%20from%20source.md).
|
||||
Follow these steps to build and deploy a containerized instance of the web host software, optionally integrating [Gunicorn](https://gunicorn.org/) WSGI HTTP Server running behind the [nginx](https://nginx.org/) reverse proxy.
|
||||
|
||||
|
||||
## Building the Container Image
|
||||
|
||||
What you'll need:
|
||||
* A container runtime engine such as:
|
||||
* [Docker](https://www.docker.com/)
|
||||
* [Podman](https://podman.io/)
|
||||
* For running with rootless podman, you need to ensure all ports used are usable rootless, by default ports less than 1024 are root only. See [the official tutorial](https://github.com/containers/podman/blob/main/docs/tutorials/rootless_tutorial.md) for details.
|
||||
|
||||
Starting from the root repository directory, the standalone Archipelago image can be built and run with the command:
|
||||
`docker build -t archipelago .`
|
||||
Or:
|
||||
`podman build -t archipelago .`
|
||||
|
||||
It is recommended to tag the image using `-t` to more easily identify the image and run it.
|
||||
|
||||
|
||||
## Running the Container
|
||||
|
||||
Running the container can be performed using:
|
||||
`docker run --network host archipelago`
|
||||
Or:
|
||||
`podman run --network host archipelago`
|
||||
|
||||
The Archipelago web host requires access to multiple ports in order to host game servers simultaneously. To simplify configuration for this purpose, specify `--network host`.
|
||||
|
||||
Given the default configuration, the website will be accessible at the hostname/IP address (localhost if run locally) of the machine being deployed to, at port 80. It can be configured by creating a YAML file and mapping a volume to the container when running initially:
|
||||
`docker run archipelago --network host -v /path/to/config.yaml:/app/config.yaml`
|
||||
See `docs/webhost configuration sample.yaml` for example.
|
||||
|
||||
|
||||
## Using Docker Compose
|
||||
|
||||
An example [docker compose](../deploy/docker-compose.yml) file can be found in [deploy](../deploy), along with example configuration files used by the services it orchestrates. Using these files as-is will spin up two separate archipelago containers with special modifications to their runtime arguments, in addition to deploying an `nginx` reverse proxy container.
|
||||
|
||||
To deploy in this manner, from the ["deploy"](../deploy) directory, run:
|
||||
`docker compose up -d`
|
||||
|
||||
### Services
|
||||
|
||||
The `docker-compose.yaml` file defines three services:
|
||||
* multiworld:
|
||||
* Executes the main `WebHost` process, using the [example config](../deploy/example_config.yaml), and overriding with a secondary [selflaunch example config](../deploy/example_selflaunch.yaml). This is because we do not want to launch the website through this service.
|
||||
* web:
|
||||
* Executes `gunicorn` using its [example config](../deploy/example_gunicorn.conf.py), which will bind it to the `WebHost` application, in effect launching it.
|
||||
* We mount the main [config](../deploy/example_config.yaml) without an override to specify that we are launching the website through this service.
|
||||
* No ports are exposed through to the host.
|
||||
* nginx:
|
||||
* Serves as a reverse proxy with `web` as its upstream.
|
||||
* Directs all HTTP traffic from port 80 to the upstream service.
|
||||
* Exposed to the host on port 8080. This is where we can reach the website.
|
||||
|
||||
### Configuration
|
||||
|
||||
As these are examples, they can be copied and modified. For instance setting the value of `HOST_ADDRESS` in [example config](../deploy/example_config.yaml) to host machines local IP address, will expose the service to its local area network.
|
||||
|
||||
The configuration files may be modified to handle for machine-specific optimizations, such as:
|
||||
* Web pages responding too slowly
|
||||
* Edit [the gunicorn config](../deploy/example_gunicorn.conf.py) to increase thread and/or worker count.
|
||||
* Game generation stalls
|
||||
* Increase the generator count in [selflaunch config](../deploy/example_selflaunch.yaml)
|
||||
* Gameplay lags
|
||||
* Increase the hoster count in [selflaunch config](../deploy/example_selflaunch.yaml)
|
||||
|
||||
Changes made to `docker-compose.yaml` can be applied by running `docker compose up -d`, while those made to other files are applied by running `docker compose restart`.
|
||||
|
||||
|
||||
## Windows
|
||||
|
||||
It is possible to carry out these deployment steps on Windows under [Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/install).
|
||||
|
||||
|
||||
## Optional: A Link to the Past Enemizer
|
||||
|
||||
Only required to generate seeds that include A Link to the Past with certain options enabled. You will receive an
|
||||
error if it is required.
|
||||
Enemizer can be enabled on `x86_64` platform architecture, and is included in the image build process. Enemizer requires a version 1.0 Japanese "Zelda no Densetsu" `.sfc` rom file to be placed in the application directory:
|
||||
`docker run archipelago -v "/path/to/zelda.sfc:/app/Zelda no Densetsu - Kamigami no Triforce (Japan).sfc"`.
|
||||
Enemizer is not currently available for `aarch64`.
|
||||
|
||||
|
||||
## Optional: Git
|
||||
|
||||
Building the image requires a local copy of the ArchipelagoMW source code.
|
||||
Refer to [Running From Source](running%20from%20source.md#optional-git).
|
Reference in New Issue
Block a user