Assimilate CivDocker

This commit is contained in:
AngrySoundTech
2024-04-16 11:27:27 -04:00
parent bcd22447e7
commit e2ddc32715
8 changed files with 76 additions and 300 deletions

View File

@@ -1,4 +1,4 @@
Copyright (c) 2012-2021 AngrySoundTech <angrysoundtech@gmail.com>
Copyright (c) 2023 CivMC
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@@ -11,15 +11,30 @@ A docker compose stack is provided to help test containers built from
this repo. To start the stack, run the following command:
`docker compose up --build`. Please note that this stack is NOT suitable for production use.
Container data (world, logs, etc.) are mounted at [./containers/data](./containers/data).
Optional services may be started by enabling the profile flag, e.g. `--profile <name>`
Current services and exposed ports are:
| Name | Ports | Description | Profile |
|----------|-------|---------------------|------------|
| pvp | | | |
| mariadb | 3306 | TCP, Database | |
| postgres | 5432 | TCP, Database | |
| rabbitmq | 5672 | TCP, AMQP | |
| | 15672 | HTTP, Management UI | |
| grafana | 3000 | HTTP, Grafana UI | monitoring |
| Name | Ports | Description | Profile |
|-----------|-------|---------------------|------------|
| waterfall | 25565 | TCP, Minecraft | |
| paper | | | |
| pvp | | | |
| mariadb | 3306 | TCP, Database | |
| postgres | 5432 | TCP, Database | |
| rabbitmq | 5672 | TCP, AMQP | |
| | 15672 | HTTP, Management UI | |
| grafana | 3000 | HTTP, Grafana UI | monitoring |
#### Using the console
For the minecraft servers and other interactive containers, you can attach to the console to run commands:
1. run `docker ps`
2. Note the name of the container. By default, randomly generated.
3. Run `docker attach <name>`, for example: `docker attach 81dcee85c1da`
## Licencing
This project and any subprojects not otherwise containing a licence file are licenced under the MIT licence.
Individual plugins may be subject to their own licences, please check the respective plugin directories for details.

View File

@@ -1,78 +0,0 @@
name: Build
on:
push:
branches:
- '*'
tags:
- 'v*.*.*'
pull_request:
branches:
- 'master'
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Waterfall - Docker meta
id: waterfall-meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/civmc/civdocker/waterfall
tags: |
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Paper - Docker meta
id: paper-meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/civmc/civdocker/paper
tags: |
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Login to Github Packages
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Waterfall Docker image
uses: docker/build-push-action@v5
with:
context: waterfall
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.waterfall-meta.outputs.tags }}
labels: ${{ steps.waterfall-meta.outputs.labels }}
- name: Build and push Paper Docker image
uses: docker/build-push-action@v5
with:
context: paper
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.paper-meta.outputs.tags }}
labels: ${{ steps.paper-meta.outputs.labels }}

View File

@@ -1,57 +0,0 @@
name: 'Update Plugin'
# This workflow is still very much WIP, and more of a POC than anything right now.
# Inputs and such may very well change depending on what the parent repo
# ends up providing, but I'm kind of working backwards here.
on:
workflow_dispatch:
inputs:
plugin:
description: The plugin from this organization to update
required: true
type: string
version:
description: The release version to update to
required: true
type: string
asset_pattern:
description: The asset to update to
required: true
type: string
env:
GH_TOKEN: ${{ github.token }}
jobs:
update_plugin:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set git user
run: git config user.email "41898282+github-actions[bot]@users.noreply.github.com" && git config user.name "github-actions[bot]"
- name: Extract branch name
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: List Releases
run: gh release list -R ${{ github.repository_owner }}/${{ inputs.plugin }}
- name: Create Branch
run: git checkout -b feature/update-${{ inputs.plugin }}-${{ inputs.version }}
- name: Remove old version
working-directory: paper/plugins
run: shopt -s nocaseglob && rm ${{ inputs.plugin }}*
- name: Download latest release
working-directory: paper/plugins
run: gh release download -R ${{ github.repository_owner }}/${{ inputs.plugin }} ${{ inputs.version }} -p ${{ inputs.asset_pattern}}
- name: Commit and push branch
run: git add . && git commit -m "${{ inputs.plugin }}-${{ inputs.version }}" && git push -u origin feature/update-${{ inputs.plugin }}-${{ inputs.version }}
- name: Create PR
run: gh pr create -B ${{ steps.extract_branch.outputs.branch }} -H feature/update-${{ inputs.plugin }}-${{ inputs.version }} -t "Update ${{ inputs.plugin }}-${{ inputs.version }}" -b "Update ${{ inputs.plugin }}-${{ inputs.version }}"

11
containers/.gitignore vendored
View File

@@ -1,11 +0,0 @@
# Project
local/
# Editors
## Jetbrains
.idea
*.iml
*.iws
## Vim
*.swp

View File

@@ -1,17 +0,0 @@
# CivDocker
## Development
1. run `docker-compose up`
2. Connect to minecraft server at `localhost:25565`
Container data (world, logs, etc.) are mounted at [./local](./local).
The `data` directory therin is provided for local verification,
and should not be used in prod.
If changes are made to the docker build,
you need to use `docker-compose up --build` next time you run.
## Using the console
1. run `docker ps`
2. Note the name of the container. By default, randomly generated.
3. Run `docker attach <name>`, for example: `docker attach 81dcee85c1da`

View File

@@ -1,126 +0,0 @@
version: '3.9'
services:
waterfall:
build: waterfall
restart: unless-stopped
tty: true
stdin_open: true
depends_on:
mariadb:
condition: service_healthy
postgres:
condition: service_healthy
rabbitmq:
condition: service_healthy
environment:
CIV_POSTGRES_HOST: postgres
CIV_POSTGRES_USERNAME: postgres
CIV_POSTGRES_PASSWORD: postgres
ports:
- "25565:25577"
paper:
build: paper
restart: unless-stopped
tty: true
stdin_open: true
depends_on:
mariadb:
condition: service_healthy
postgres:
condition: service_healthy
ports:
- "8123:8123"
environment:
INIT_MEMORY: 1G
MAX_MEMORY: 5G
CIV_SERVER_NAME: local
CIV_WORLD_GENERATOR: Terra:DEFAULT
CIV_WORDBANK_SEED: wordbank
CIV_MYSQL_HOST: mariadb
CIV_MYSQL_USERNAME: mariadb
CIV_MYSQL_PASSWORD: mariadb
CIV_POSTGRES_HOST: postgres
CIV_POSTGRES_USERNAME: postgres
CIV_POSTGRES_PASSWORD: postgres
CIV_RABBITMQ_HOST: rabbitmq
CIV_RABBITMQ_USERNAME: rabbitmq
CIV_RABBITMQ_PASSWORD: rabbitmq
volumes:
- ./local/paper:/data
mariadb:
image: mariadb:10.7.1
restart: unless-stopped
command: --max-connections 500
healthcheck:
test: [ "CMD-SHELL", 'mysqladmin ping --user "$$MYSQL_USER" --password="$$MYSQL_PASSWORD"' ]
timeout: 20s
retries: 10
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: mariadb
MYSQL_USER: mariadb
MYSQL_PASSWORD: mariadb
MYSQL_DATABASE: mariadb
volumes:
- ./provisioning/mariadb/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
- ./local/mariadb:/var/lib/mysql
postgres:
image: timescale/timescaledb:latest-pg14
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", 'pg_isready -U "$$POSTGRES_USER"']
interval: 10s
timeout: 5s
retries: 5
ports:
- "5432:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
volumes:
- ./provisioning/postgres/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
- ./local/postgres:/var/lib/postgresql/data
rabbitmq:
image: rabbitmq:3.9.16-management
restart: unless-stopped
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "ping"]
interval: 60s
timeout: 10s
retries: 5
ports:
- "5672:5672"
environment:
RABBITMQ_DEFAULT_USER: rabbitmq
RABBITMQ_DEFAULT_PASS: rabbitmq
grafana:
image: grafana/grafana-oss:latest
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
profiles:
- extra
ports:
- "3000:3000"
environment:
CIV_INFLUX_HOST: http://influx:8086
CIV_INFLUX_ORG: CivMC
CIV_INFLUX_TOKEN: admintoken
volumes:
- ./grafana/provisioning:/etc/grafana/provisioning

View File

@@ -1,5 +1,3 @@
version: '3.9'
# Development stack for Civ. This stack can be used to develop and test the server and plugins locally.
# Please note that this stack is NOT suitable for production use, as it exposes all service ports, and uses default passwords.
@@ -9,6 +7,58 @@ services:
### Minecraft ###
#################
waterfall:
build: containers/waterfall
restart: unless-stopped
tty: true
stdin_open: true
depends_on:
mariadb:
condition: service_healthy
postgres:
condition: service_healthy
rabbitmq:
condition: service_healthy
environment:
CIV_POSTGRES_HOST: postgres
CIV_POSTGRES_USERNAME: postgres
CIV_POSTGRES_PASSWORD: postgres
ports:
- "25565:25577"
paper:
build: containers/paper
restart: unless-stopped
tty: true
stdin_open: true
depends_on:
mariadb:
condition: service_healthy
postgres:
condition: service_healthy
environment:
INIT_MEMORY: 1G
MAX_MEMORY: 5G
CIV_SERVER_NAME: local
CIV_WORLD_GENERATOR: Terra:DEFAULT
CIV_WORDBANK_SEED: wordbank
CIV_MYSQL_HOST: mariadb
CIV_MYSQL_USERNAME: mariadb
CIV_MYSQL_PASSWORD: mariadb
CIV_POSTGRES_HOST: postgres
CIV_POSTGRES_USERNAME: postgres
CIV_POSTGRES_PASSWORD: postgres
CIV_RABBITMQ_HOST: rabbitmq
CIV_RABBITMQ_USERNAME: rabbitmq
CIV_RABBITMQ_PASSWORD: rabbitmq
volumes:
- ./containers/data/paper:/data
pvp:
build: containers/pvp
restart: unless-stopped