Initial commit
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
RCON_PASSWORD=""
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
name: Deploy to Production
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- v[0-9]+.[0-9]+.[0-9]+
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy-to-production:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: main
|
||||||
|
path: .
|
||||||
|
|
||||||
|
- name: Transfer files
|
||||||
|
uses: burnett01/rsync-deployments@7.0.1
|
||||||
|
with:
|
||||||
|
switches: -azvr --delete --exclude=".gitignore" --exclude=".git" --exclude=".gitea" --exclude="data" --exclude=".env"
|
||||||
|
path: .
|
||||||
|
remote_path: /home/${{ secrets.USERNAME }}/minecraft-server-example-folder
|
||||||
|
remote_host: ${{ secrets.HOST }}
|
||||||
|
remote_user: ${{ secrets.USERNAME }}
|
||||||
|
remote_key: ${{ secrets.KEY }}
|
||||||
|
|
||||||
|
- name: Stop container
|
||||||
|
uses: appleboy/ssh-action@v1.2.0
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.host }}
|
||||||
|
username: ${{ secrets.USERNAME }}
|
||||||
|
key: ${{ secrets.KEY }}
|
||||||
|
script: |
|
||||||
|
cd minecraft-server-example-folder
|
||||||
|
docker compose down
|
||||||
|
|
||||||
|
- name: Start container
|
||||||
|
uses: appleboy/ssh-action@v1.2.0
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.host }}
|
||||||
|
username: ${{ secrets.USERNAME }}
|
||||||
|
key: ${{ secrets.KEY }}
|
||||||
|
script: |
|
||||||
|
cd minecraft-server-example-folder
|
||||||
|
docker compose up -d
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
name: Restart Server
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 4 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
restart-server:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Restart container
|
||||||
|
uses: appleboy/ssh-action@v1.2.0
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.host }}
|
||||||
|
username: ${{ secrets.USERNAME }}
|
||||||
|
key: ${{ secrets.KEY }}
|
||||||
|
script: |
|
||||||
|
cd minecraft-server-example-folder
|
||||||
|
docker compose restart
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
data
|
||||||
|
.env
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
# Minecraft Server Template
|
||||||
|
This is the minecraft server template that you can use to create minecraft servers. It uses the itzg/minecraft-server docker image to create the server within a docker container for ease of deployment. Documentation for the itzg/minecraft-server image can be found [here](https://docker-minecraft-server.readthedocs.io/en/latest/).
|
||||||
|
|
||||||
|
## To run this server:
|
||||||
|
1. Use this repository as a template for a new repository.
|
||||||
|
2. Fill in the neccesary variables in the docker-compose file.
|
||||||
|
3. Copy the .env.example to a .env file and fill in the neccesary variables.
|
||||||
|
4. Run the server using `docker compose up -d`.
|
||||||
|
|
||||||
|
## Deployment:
|
||||||
|
This server can be deployed with the provided gitea pipeline. Add the following secrets to the repository under actions -> secrets:
|
||||||
|
- `HOST`: The IP of the server.
|
||||||
|
- `USERNAME`: The username of the user.
|
||||||
|
- `KEY`: The private key to connect to the server. ( Found in 1password )
|
||||||
|
|
||||||
|
A deployment is automatically run when a tag is created. The tag must be in the format `vX.X.X` where X is a number.
|
||||||
|
|
||||||
|
The pipeline `production.yml` will deploy the server when a tag is created.
|
||||||
|
|
||||||
|
Change the directory ( `minecraft-server-example-folder` ) to the directory where the server will be located in the server. This directory must be defined in both the `production.yml` and the `restart.yml`.
|
||||||
|
|
||||||
|
|
||||||
|
## Important Notes:
|
||||||
|
The data directory will be created and populated with the server files the first time the server is run. please do not add these files to the repository.
|
||||||
|
|
||||||
|
The current config is set to use Fabric, if you would like to use Forge or any other modloader, please refer to the documentation stated above.
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
services:
|
||||||
|
minecraft-server:
|
||||||
|
image: itzg/minecraft-server
|
||||||
|
stdin_open: true
|
||||||
|
tty: true
|
||||||
|
ports:
|
||||||
|
- "25565:25565"
|
||||||
|
- "25575:25575"
|
||||||
|
volumes:
|
||||||
|
- ./data:/data
|
||||||
|
- ./whitelist:/whitelist
|
||||||
|
environment:
|
||||||
|
EULA: "TRUE"
|
||||||
|
ENABLE_RCON: "TRUE"
|
||||||
|
RCON_PASSWORD: ${RCON_PASSWORD}
|
||||||
|
RCON_PORT: "25575"
|
||||||
|
MAX_PLAYERS: "69"
|
||||||
|
ICON: "https://example.com/icon.png"
|
||||||
|
TYPE: "PAPER"
|
||||||
|
VERSION: "1.21.4"
|
||||||
|
DIFFICULTY: "normal"
|
||||||
|
MEMORY: "2G"
|
||||||
|
INIT_MEMORY: "2G"
|
||||||
|
MAX_MEMORY: "4G"
|
||||||
|
SERVER_IP: ""
|
||||||
|
ENABLE_WHITELIST: "TRUE"
|
||||||
|
OVERRIDE_WHITELIST: "TRUE"
|
||||||
|
WHITELIST_FILE: /whitelist/whitelist.json
|
||||||
|
MOTD: "A Minecraft Server with docker"
|
||||||
|
restart: unless-stopped
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name":"zardzul",
|
||||||
|
"uuid":"9f0f315c-880d-48aa-a786-66ba83dcfb28"
|
||||||
|
}
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user