diff --git a/.github/workflows/ansible_kira_restart.yml b/.github/workflows/ansible_kira_restart.yml index f1f3948ae8..d439a7dbcc 100644 --- a/.github/workflows/ansible_kira_restart.yml +++ b/.github/workflows/ansible_kira_restart.yml @@ -15,6 +15,19 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 + + - name: ☕ Setup Java + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + + - name: 🐘 Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: 🐘 Gradle Build + run: CI=true ./gradlew :ansible:build + - name: Inject secrets run: 'echo "$SECRETS_YML" > variables/secrets.yml' shell: bash diff --git a/.github/workflows/ansible_ping.yml b/.github/workflows/ansible_ping.yml index 2ed6be0be7..410353388f 100644 --- a/.github/workflows/ansible_ping.yml +++ b/.github/workflows/ansible_ping.yml @@ -15,6 +15,19 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 + + - name: ☕ Setup Java + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + + - name: 🐘 Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: 🐘 Gradle Build + run: CI=true ./gradlew :ansible:build + - name: Inject secrets run: 'echo "$SECRETS_YML" > variables/secrets.yml' shell: bash diff --git a/.github/workflows/ansible_setup_server.yml b/.github/workflows/ansible_setup_server.yml index a9a47ce20f..3c705d9678 100644 --- a/.github/workflows/ansible_setup_server.yml +++ b/.github/workflows/ansible_setup_server.yml @@ -15,6 +15,19 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 + + - name: ☕ Setup Java + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + + - name: 🐘 Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: 🐘 Gradle Build + run: CI=true ./gradlew :ansible:build + - name: Inject secrets run: 'echo "$SECRETS_YML" > variables/secrets.yml' shell: bash diff --git a/.github/workflows/ansible_start_server.yml b/.github/workflows/ansible_start_server.yml index 9fec351878..f03fec7d81 100644 --- a/.github/workflows/ansible_start_server.yml +++ b/.github/workflows/ansible_start_server.yml @@ -15,6 +15,19 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 + + - name: ☕ Setup Java + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + + - name: 🐘 Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: 🐘 Gradle Build + run: CI=true ./gradlew :ansible:build + - name: Inject secrets run: 'echo "$SECRETS_YML" > variables/secrets.yml' shell: bash diff --git a/.github/workflows/ansible_stop_server.yml b/.github/workflows/ansible_stop_server.yml index 5581f7372a..291ea9bb2d 100644 --- a/.github/workflows/ansible_stop_server.yml +++ b/.github/workflows/ansible_stop_server.yml @@ -15,6 +15,19 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 + + - name: ☕ Setup Java + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + + - name: 🐘 Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: 🐘 Gradle Build + run: CI=true ./gradlew :ansible:build + - name: Inject secrets run: 'echo "$SECRETS_YML" > variables/secrets.yml' shell: bash diff --git a/.github/workflows/ansible_update_server.yml b/.github/workflows/ansible_update_server.yml index 1be49e3041..25c4d4c122 100644 --- a/.github/workflows/ansible_update_server.yml +++ b/.github/workflows/ansible_update_server.yml @@ -15,6 +15,19 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 + + - name: ☕ Setup Java + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + + - name: 🐘 Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: 🐘 Gradle Build + run: CI=true ./gradlew :ansible:build + - name: Inject secrets run: 'echo "$SECRETS_YML" > variables/secrets.yml' shell: bash diff --git a/.github/workflows/build_gradle_project.yaml b/.github/workflows/build_gradle_project.yaml index 8e244a734c..d9bcebda0f 100644 --- a/.github/workflows/build_gradle_project.yaml +++ b/.github/workflows/build_gradle_project.yaml @@ -34,21 +34,17 @@ jobs: - name: 🚩 Checkout Repo uses: actions/checkout@v4 - - name: ❓ Ensure Wrapper Permissions - run: chmod +x ./gradlew - - name: ☕ Setup Java uses: actions/setup-java@v3 with: java-version: '17' distribution: 'temurin' + - name: 🐘 Setup Gradle + uses: gradle/actions/setup-gradle@v3 + - name: 🐘 Gradle Build - uses: gradle/gradle-build-action@v2 - env: - CI: true - with: - arguments: "${{inputs.category}}:${{inputs.project}}:build --scan" + run: CI=true ./gradlew ${{inputs.category}}:${{inputs.project}}:build --scan - name: 🗃️ Upload Build Artifact uses: actions/upload-artifact@v3 diff --git a/.github/workflows/check_gradle_all.yaml b/.github/workflows/check_gradle_all.yaml index c034fc2b0d..7c74b5916a 100644 --- a/.github/workflows/check_gradle_all.yaml +++ b/.github/workflows/check_gradle_all.yaml @@ -14,18 +14,14 @@ jobs: - name: 🚩 Checkout Repo uses: actions/checkout@v4 - - name: ❓ Ensure Wrapper Permissions - run: chmod +x ./gradlew - - name: ☕ Setup Java uses: actions/setup-java@v3 with: java-version: '17' distribution: 'temurin' + - name: 🐘 Setup Gradle + uses: gradle/actions/setup-gradle@v3 + - name: 🐘 Gradle Check - uses: gradle/gradle-build-action@v2 - env: - CI: true - with: - arguments: "check --scan" + run: CI=true ./gradlew check --scan diff --git a/.github/workflows/publish_gradle_project.yaml b/.github/workflows/publish_gradle_project.yaml index b7c0f86933..60b116d20f 100644 --- a/.github/workflows/publish_gradle_project.yaml +++ b/.github/workflows/publish_gradle_project.yaml @@ -48,23 +48,19 @@ jobs: - name: 🚩 Checkout Repo uses: actions/checkout@v4 - - name: ❓ Ensure Wrapper Permissions - run: chmod +x ./gradlew - - name: ☕ Setup Java uses: actions/setup-java@v3 with: java-version: '17' distribution: 'temurin' - # TODO: Bump version if not already done + - name: 🐘 Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + # TODO: Bump version if not already done - name: 🐘 Gradle Build - uses: gradle/gradle-build-action@v2 - env: - CI: true - with: - arguments: "${{needs.determine_values.outputs.category}}:${{needs.determine_values.outputs.project}}:build --scan" + run: CI=true ./gradlew ${{needs.determine_values.outputs.category}}:${{needs.determine_values.outputs.project}}:build --scan - name: 🗃️ Create/Update Release uses: softprops/action-gh-release@v1 @@ -73,9 +69,4 @@ jobs: files: '${{needs.determine_values.outputs.category}}/${{needs.determine_values.outputs.project}}/build/libs/*' - name: 🐘 Gradle Publish - uses: gradle/gradle-build-action@v2 - env: - CI: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - arguments: "${{needs.determine_values.outputs.category}}:${{needs.determine_values.outputs.project}}:publish --scan" + run: CI=true GITHUB_TOKEN=${{secrets.GITHUB_TOKEN}} ./gradlew ${{needs.determine_values.outputs.category}}:${{needs.determine_values.outputs.project}}:publish --scan diff --git a/README.md b/README.md index 7a3c30bc69..8d1eacb0ca 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,12 @@ This monorepo will eventually contain all civ projects and development ### Containers 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. +this repo. To start the stack, run the following commands: + +1. `gradle :ansible:build` +2. `docker compose up` + +Please note that this stack is NOT suitable for production use. Container data (world, logs, etc.) are mounted at [./containers/data](./containers/data). diff --git a/ansible/README.md b/ansible/README.md index 32e4037106..538b88f065 100644 --- a/ansible/README.md +++ b/ansible/README.md @@ -1,4 +1,8 @@ # CivAnsible +This project is a hybrid gradle/ansible project that is designed to provision and deploy services to a server. + +Vendored plugins are located in `src/` (gradle), since they are used to build the end plugin directory (`/build/`) +Configs are located in `files/`, since they are purely copied by ansible ## Prerequisites 1. Create a user on the server named `actions` with sudo privileges @@ -9,6 +13,10 @@ 3. Create a repo scoped secret with the contents of your secrets.yml called SECRETS_YML 4. Create an ansible inventory named after the environment +## Usage +1. Build dependencies with `gradle :ansible:build` +2. Use an ansible playbook with `ansible-playbook -i inventories/ playbooks/` + ## TODOs - Private Config - Mount backups location and configure params, setup diff --git a/ansible/build.gradle.kts b/ansible/build.gradle.kts new file mode 100644 index 0000000000..5debb4412a --- /dev/null +++ b/ansible/build.gradle.kts @@ -0,0 +1,48 @@ +val paperPlugin by configurations.creating +val proxyPlugin by configurations.creating + +dependencies { + paperPlugin(project(path = ":plugins:banstick-paper", configuration = "reobf")) + paperPlugin(project(path = ":plugins:bastion-paper", configuration = "reobf")) + paperPlugin(project(path = ":plugins:citadel-paper", configuration = "reobf")) + paperPlugin(project(path = ":plugins:civchat2-paper", configuration = "reobf")) + paperPlugin(project(path = ":plugins:civduties-paper", configuration = "reobf")) + paperPlugin(project(path = ":plugins:civmodcore-paper", configuration = "reobf")) + paperPlugin(project(path = ":plugins:combattagplus-paper", configuration = "reobf")) + paperPlugin(project(path = ":plugins:essenceglue-paper", configuration = "reobf")) + paperPlugin(project(path = ":plugins:exilepearl-paper", configuration = "reobf")) + paperPlugin(project(path = ":plugins:factorymod-paper", configuration = "reobf")) + paperPlugin(project(path = ":plugins:finale-paper", configuration = "reobf")) + paperPlugin(project(path = ":plugins:hiddenore-paper", configuration = "reobf")) + paperPlugin(project(path = ":plugins:itemexchange-paper", configuration = "reobf")) + paperPlugin(project(path = ":plugins:jukealert-paper", configuration = "reobf")) + paperPlugin(project(path = ":plugins:kirabukkitgateway-paper", configuration = "reobf")) + paperPlugin(project(path = ":plugins:namecolors-paper", configuration = "reobf")) + paperPlugin(project(path = ":plugins:namelayer-paper", configuration = "reobf")) + paperPlugin(project(path = ":plugins:railswitch-paper", configuration = "reobf")) + paperPlugin(project(path = ":plugins:randomspawn-paper", configuration = "reobf")) + paperPlugin(project(path = ":plugins:realisticbiomes-paper", configuration = "reobf")) + paperPlugin(project(path = ":plugins:simpleadminhacks-paper", configuration = "reobf")) +} + +val copyPaperPlugins = tasks.register("copyPaperPlugins") { + dependsOn(paperPlugin) + + from("$projectDir/src/paper-plugins") + from(paperPlugin.resolvedConfiguration.resolvedArtifacts.map { it.file }) + into("$buildDir/paper-plugins") +} + +val copyProxyPlugins = tasks.register("copyProxyPlugins") { + dependsOn(proxyPlugin) + + from("$projectDir/src/proxy-plugins") + from(proxyPlugin.resolvedConfiguration.resolvedArtifacts.map { it.file }) + into("$buildDir/proxy-plugins") +} + +// TODO: Is build the right name? +tasks.register("build") { + dependsOn(copyPaperPlugins) + dependsOn(copyProxyPlugins) +} diff --git a/ansible/files/paper-plugins/banstick-paper-2.0.1.jar b/ansible/files/paper-plugins/banstick-paper-2.0.1.jar deleted file mode 100644 index be8facac56..0000000000 Binary files a/ansible/files/paper-plugins/banstick-paper-2.0.1.jar and /dev/null differ diff --git a/ansible/files/paper-plugins/bastion-paper-3.0.1.jar b/ansible/files/paper-plugins/bastion-paper-3.0.1.jar deleted file mode 100644 index d6518f706d..0000000000 Binary files a/ansible/files/paper-plugins/bastion-paper-3.0.1.jar and /dev/null differ diff --git a/ansible/files/paper-plugins/citadel-paper-5.2.4.jar b/ansible/files/paper-plugins/citadel-paper-5.2.4.jar deleted file mode 100644 index 5e04292a09..0000000000 Binary files a/ansible/files/paper-plugins/citadel-paper-5.2.4.jar and /dev/null differ diff --git a/ansible/files/paper-plugins/civchat2-paper-2.2.2.jar b/ansible/files/paper-plugins/civchat2-paper-2.2.2.jar deleted file mode 100644 index fc3911376d..0000000000 Binary files a/ansible/files/paper-plugins/civchat2-paper-2.2.2.jar and /dev/null differ diff --git a/ansible/files/paper-plugins/civduties-paper-1.5.0-SNAPSHOT.jar b/ansible/files/paper-plugins/civduties-paper-1.5.0-SNAPSHOT.jar deleted file mode 100644 index f68b3d1cb1..0000000000 Binary files a/ansible/files/paper-plugins/civduties-paper-1.5.0-SNAPSHOT.jar and /dev/null differ diff --git a/ansible/files/paper-plugins/civmodcore-paper-3.0.6.jar b/ansible/files/paper-plugins/civmodcore-paper-3.0.6.jar deleted file mode 100644 index b89df10f31..0000000000 Binary files a/ansible/files/paper-plugins/civmodcore-paper-3.0.6.jar and /dev/null differ diff --git a/ansible/files/paper-plugins/combattagplus-paper-2.0.1.jar b/ansible/files/paper-plugins/combattagplus-paper-2.0.1.jar deleted file mode 100644 index 06cba9e83b..0000000000 Binary files a/ansible/files/paper-plugins/combattagplus-paper-2.0.1.jar and /dev/null differ diff --git a/ansible/files/paper-plugins/essenceglue-paper-2.0.0-SNAPSHOT.jar b/ansible/files/paper-plugins/essenceglue-paper-2.0.0-SNAPSHOT.jar deleted file mode 100644 index 862b0b647d..0000000000 Binary files a/ansible/files/paper-plugins/essenceglue-paper-2.0.0-SNAPSHOT.jar and /dev/null differ diff --git a/ansible/files/paper-plugins/exilepearl-paper-2.1.6.jar b/ansible/files/paper-plugins/exilepearl-paper-2.1.6.jar deleted file mode 100644 index 11a461b5a8..0000000000 Binary files a/ansible/files/paper-plugins/exilepearl-paper-2.1.6.jar and /dev/null differ diff --git a/ansible/files/paper-plugins/factorymod-paper-3.1.0.jar b/ansible/files/paper-plugins/factorymod-paper-3.1.0.jar deleted file mode 100644 index d534a25380..0000000000 Binary files a/ansible/files/paper-plugins/factorymod-paper-3.1.0.jar and /dev/null differ diff --git a/ansible/files/paper-plugins/finale-paper-2.1.0.jar b/ansible/files/paper-plugins/finale-paper-2.1.0.jar deleted file mode 100644 index 09941d7fa5..0000000000 Binary files a/ansible/files/paper-plugins/finale-paper-2.1.0.jar and /dev/null differ diff --git a/ansible/files/paper-plugins/hiddenore-paper-2.0.0-SNAPSHOT.jar b/ansible/files/paper-plugins/hiddenore-paper-2.0.0-SNAPSHOT.jar deleted file mode 100644 index 0d53608af3..0000000000 Binary files a/ansible/files/paper-plugins/hiddenore-paper-2.0.0-SNAPSHOT.jar and /dev/null differ diff --git a/ansible/files/paper-plugins/itemexchange-paper-2.0.2.jar b/ansible/files/paper-plugins/itemexchange-paper-2.0.2.jar deleted file mode 100644 index d539895ddb..0000000000 Binary files a/ansible/files/paper-plugins/itemexchange-paper-2.0.2.jar and /dev/null differ diff --git a/ansible/files/paper-plugins/jukealert-paper-3.0.8.jar b/ansible/files/paper-plugins/jukealert-paper-3.0.8.jar deleted file mode 100644 index 6cd941fc5e..0000000000 Binary files a/ansible/files/paper-plugins/jukealert-paper-3.0.8.jar and /dev/null differ diff --git a/ansible/files/paper-plugins/kirabukkitgateway-paper-2.0.3.jar b/ansible/files/paper-plugins/kirabukkitgateway-paper-2.0.3.jar deleted file mode 100644 index 31dcb01b14..0000000000 Binary files a/ansible/files/paper-plugins/kirabukkitgateway-paper-2.0.3.jar and /dev/null differ diff --git a/ansible/files/paper-plugins/namecolors-paper-2.0.0-SNAPSHOT.jar b/ansible/files/paper-plugins/namecolors-paper-2.0.0-SNAPSHOT.jar deleted file mode 100644 index f31bc723da..0000000000 Binary files a/ansible/files/paper-plugins/namecolors-paper-2.0.0-SNAPSHOT.jar and /dev/null differ diff --git a/ansible/files/paper-plugins/namelayer-paper-3.0.6.jar b/ansible/files/paper-plugins/namelayer-paper-3.0.6.jar deleted file mode 100644 index f2fcd1b263..0000000000 Binary files a/ansible/files/paper-plugins/namelayer-paper-3.0.6.jar and /dev/null differ diff --git a/ansible/files/paper-plugins/railswitch-paper-2.0.0-SNAPSHOT.jar b/ansible/files/paper-plugins/railswitch-paper-2.0.0-SNAPSHOT.jar deleted file mode 100644 index 3551b39cc4..0000000000 Binary files a/ansible/files/paper-plugins/railswitch-paper-2.0.0-SNAPSHOT.jar and /dev/null differ diff --git a/ansible/files/paper-plugins/randomspawn-paper-3.0.4.jar b/ansible/files/paper-plugins/randomspawn-paper-3.0.4.jar deleted file mode 100644 index ce56170cfb..0000000000 Binary files a/ansible/files/paper-plugins/randomspawn-paper-3.0.4.jar and /dev/null differ diff --git a/ansible/files/paper-plugins/realisticbiomes-paper-3.2.3.jar b/ansible/files/paper-plugins/realisticbiomes-paper-3.2.3.jar deleted file mode 100644 index 30f6c0cbff..0000000000 Binary files a/ansible/files/paper-plugins/realisticbiomes-paper-3.2.3.jar and /dev/null differ diff --git a/ansible/files/paper-plugins/simpleadminhacks-paper-2.3.2.jar b/ansible/files/paper-plugins/simpleadminhacks-paper-2.3.2.jar deleted file mode 100644 index 703a2908d6..0000000000 Binary files a/ansible/files/paper-plugins/simpleadminhacks-paper-2.3.2.jar and /dev/null differ diff --git a/ansible/playbooks/ping.yml b/ansible/playbooks/ping.yml index caff1a430f..c6e1b85bcd 100644 --- a/ansible/playbooks/ping.yml +++ b/ansible/playbooks/ping.yml @@ -2,6 +2,9 @@ hosts: all tasks: + - name: Ping | Include Preflight + include_tasks: ../tasks/preflight-checks.yml + - name: Configure | Expand setting include_tasks: ../tasks/expand-setting.yml diff --git a/ansible/playbooks/restart-kira.yml b/ansible/playbooks/restart-kira.yml index 6d97a04015..a695618382 100644 --- a/ansible/playbooks/restart-kira.yml +++ b/ansible/playbooks/restart-kira.yml @@ -3,6 +3,9 @@ become: true tasks: + - name: Restart Kira | Include Preflight + include_tasks: ../tasks/preflight-checks.yml + - name: Restart Kira | Expand setting include_tasks: ../tasks/expand-setting.yml diff --git a/ansible/playbooks/setup-server.yml b/ansible/playbooks/setup-server.yml index cc69d9b27f..4f720d708d 100644 --- a/ansible/playbooks/setup-server.yml +++ b/ansible/playbooks/setup-server.yml @@ -3,6 +3,9 @@ become: true tasks: + - name: Setup Server | Include Preflight + include_tasks: ../tasks/preflight-checks.yml + - name: Setup Server | Expand setting include_tasks: ../tasks/expand-setting.yml diff --git a/ansible/playbooks/start-server.yml b/ansible/playbooks/start-server.yml index 9075960a7e..04c4c438d4 100644 --- a/ansible/playbooks/start-server.yml +++ b/ansible/playbooks/start-server.yml @@ -3,6 +3,9 @@ become: true tasks: + - name: Start Server | Include Preflight + include_tasks: ../tasks/preflight-checks.yml + - name: Start Server | Expand setting include_tasks: ../tasks/expand-setting.yml diff --git a/ansible/playbooks/stop-server.yml b/ansible/playbooks/stop-server.yml index 29f652b951..dddedba7b5 100644 --- a/ansible/playbooks/stop-server.yml +++ b/ansible/playbooks/stop-server.yml @@ -3,6 +3,9 @@ become: true tasks: + - name: Stop Server| Include Preflight + include_tasks: ../tasks/preflight-checks.yml + - name: Stop Server | Expand setting include_tasks: ../tasks/expand-setting.yml diff --git a/ansible/playbooks/update-server.yml b/ansible/playbooks/update-server.yml index 4958b506af..7fe6677b48 100644 --- a/ansible/playbooks/update-server.yml +++ b/ansible/playbooks/update-server.yml @@ -3,6 +3,9 @@ become: true tasks: + - name: Update Serer | Include Preflight + include_tasks: ../tasks/preflight-checks.yml + - name: Update Server | Expand setting include_tasks: ../tasks/expand-setting.yml diff --git a/ansible/files/paper-plugins/Brewery-feddff9.jar b/ansible/src/paper-plugins/Brewery-feddff9.jar similarity index 100% rename from ansible/files/paper-plugins/Brewery-feddff9.jar rename to ansible/src/paper-plugins/Brewery-feddff9.jar diff --git a/ansible/files/paper-plugins/Chunky-1.3.136.jar b/ansible/src/paper-plugins/Chunky-1.3.136.jar similarity index 100% rename from ansible/files/paper-plugins/Chunky-1.3.136.jar rename to ansible/src/paper-plugins/Chunky-1.3.136.jar diff --git a/ansible/files/paper-plugins/ChunkyBorder-1.1.59.jar b/ansible/src/paper-plugins/ChunkyBorder-1.1.59.jar similarity index 100% rename from ansible/files/paper-plugins/ChunkyBorder-1.1.59.jar rename to ansible/src/paper-plugins/ChunkyBorder-1.1.59.jar diff --git a/ansible/files/paper-plugins/Clearlag-3.2.2.jar b/ansible/src/paper-plugins/Clearlag-3.2.2.jar similarity index 100% rename from ansible/files/paper-plugins/Clearlag-3.2.2.jar rename to ansible/src/paper-plugins/Clearlag-3.2.2.jar diff --git a/ansible/files/paper-plugins/CraftEnhance-2.4.3.jar b/ansible/src/paper-plugins/CraftEnhance-2.4.3.jar similarity index 100% rename from ansible/files/paper-plugins/CraftEnhance-2.4.3.jar rename to ansible/src/paper-plugins/CraftEnhance-2.4.3.jar diff --git a/ansible/files/paper-plugins/DiscordSRV-Build-1.27.0.jar b/ansible/src/paper-plugins/DiscordSRV-Build-1.27.0.jar similarity index 100% rename from ansible/files/paper-plugins/DiscordSRV-Build-1.27.0.jar rename to ansible/src/paper-plugins/DiscordSRV-Build-1.27.0.jar diff --git a/ansible/files/paper-plugins/Donum-paper-2.0.0-SNAPSHOT.jar b/ansible/src/paper-plugins/Donum-paper-2.0.0-SNAPSHOT.jar similarity index 100% rename from ansible/files/paper-plugins/Donum-paper-2.0.0-SNAPSHOT.jar rename to ansible/src/paper-plugins/Donum-paper-2.0.0-SNAPSHOT.jar diff --git a/ansible/files/paper-plugins/EntityDetection-1.2.0.jar b/ansible/src/paper-plugins/EntityDetection-1.2.0.jar similarity index 100% rename from ansible/files/paper-plugins/EntityDetection-1.2.0.jar rename to ansible/src/paper-plugins/EntityDetection-1.2.0.jar diff --git a/ansible/files/paper-plugins/GSit-1.8.0.jar b/ansible/src/paper-plugins/GSit-1.8.0.jar similarity index 100% rename from ansible/files/paper-plugins/GSit-1.8.0.jar rename to ansible/src/paper-plugins/GSit-1.8.0.jar diff --git a/ansible/files/paper-plugins/HolographicDisplays-3.0.4.jar b/ansible/src/paper-plugins/HolographicDisplays-3.0.4.jar similarity index 100% rename from ansible/files/paper-plugins/HolographicDisplays-3.0.4.jar rename to ansible/src/paper-plugins/HolographicDisplays-3.0.4.jar diff --git a/ansible/files/paper-plugins/Insights-6.17.2.jar b/ansible/src/paper-plugins/Insights-6.17.2.jar similarity index 100% rename from ansible/files/paper-plugins/Insights-6.17.2.jar rename to ansible/src/paper-plugins/Insights-6.17.2.jar diff --git a/ansible/files/paper-plugins/LuckPerms-5.4.0.jar b/ansible/src/paper-plugins/LuckPerms-5.4.0.jar similarity index 100% rename from ansible/files/paper-plugins/LuckPerms-5.4.0.jar rename to ansible/src/paper-plugins/LuckPerms-5.4.0.jar diff --git a/ansible/files/paper-plugins/MythicMobs-5.0.2.jar.disabled b/ansible/src/paper-plugins/MythicMobs-5.0.2.jar.disabled similarity index 100% rename from ansible/files/paper-plugins/MythicMobs-5.0.2.jar.disabled rename to ansible/src/paper-plugins/MythicMobs-5.0.2.jar.disabled diff --git a/ansible/files/paper-plugins/ProtocolLib.jar b/ansible/src/paper-plugins/ProtocolLib.jar similarity index 100% rename from ansible/files/paper-plugins/ProtocolLib.jar rename to ansible/src/paper-plugins/ProtocolLib.jar diff --git a/ansible/files/paper-plugins/SuperVanish-6.2.18.jar b/ansible/src/paper-plugins/SuperVanish-6.2.18.jar similarity index 100% rename from ansible/files/paper-plugins/SuperVanish-6.2.18.jar rename to ansible/src/paper-plugins/SuperVanish-6.2.18.jar diff --git a/ansible/files/paper-plugins/TAB v4.1.2.jar b/ansible/src/paper-plugins/TAB v4.1.2.jar similarity index 100% rename from ansible/files/paper-plugins/TAB v4.1.2.jar rename to ansible/src/paper-plugins/TAB v4.1.2.jar diff --git a/ansible/files/paper-plugins/Terra-bukkit-6.4.3-BETA+ab60f14ff-shaded.jar b/ansible/src/paper-plugins/Terra-bukkit-6.4.3-BETA+ab60f14ff-shaded.jar similarity index 100% rename from ansible/files/paper-plugins/Terra-bukkit-6.4.3-BETA+ab60f14ff-shaded.jar rename to ansible/src/paper-plugins/Terra-bukkit-6.4.3-BETA+ab60f14ff-shaded.jar diff --git a/ansible/files/paper-plugins/Vault.jar b/ansible/src/paper-plugins/Vault.jar similarity index 100% rename from ansible/files/paper-plugins/Vault.jar rename to ansible/src/paper-plugins/Vault.jar diff --git a/ansible/files/paper-plugins/ViaBackwards-4.10.1.jar b/ansible/src/paper-plugins/ViaBackwards-4.10.1.jar similarity index 100% rename from ansible/files/paper-plugins/ViaBackwards-4.10.1.jar rename to ansible/src/paper-plugins/ViaBackwards-4.10.1.jar diff --git a/ansible/files/paper-plugins/ViaVersion-4.10.1.jar b/ansible/src/paper-plugins/ViaVersion-4.10.1.jar similarity index 100% rename from ansible/files/paper-plugins/ViaVersion-4.10.1.jar rename to ansible/src/paper-plugins/ViaVersion-4.10.1.jar diff --git a/ansible/files/paper-plugins/Votifier-2.7.3.jar b/ansible/src/paper-plugins/Votifier-2.7.3.jar similarity index 100% rename from ansible/files/paper-plugins/Votifier-2.7.3.jar rename to ansible/src/paper-plugins/Votifier-2.7.3.jar diff --git a/ansible/files/paper-plugins/WorldEditSelectionVisualizer-2.1.5.jar b/ansible/src/paper-plugins/WorldEditSelectionVisualizer-2.1.5.jar similarity index 100% rename from ansible/files/paper-plugins/WorldEditSelectionVisualizer-2.1.5.jar rename to ansible/src/paper-plugins/WorldEditSelectionVisualizer-2.1.5.jar diff --git a/ansible/files/paper-plugins/aqua-1.1.1.jar b/ansible/src/paper-plugins/aqua-1.1.1.jar similarity index 100% rename from ansible/files/paper-plugins/aqua-1.1.1.jar rename to ansible/src/paper-plugins/aqua-1.1.1.jar diff --git a/ansible/files/paper-plugins/castlegates-paper-2.0.2.jar b/ansible/src/paper-plugins/castlegates-paper-2.0.2.jar similarity index 100% rename from ansible/files/paper-plugins/castlegates-paper-2.0.2.jar rename to ansible/src/paper-plugins/castlegates-paper-2.0.2.jar diff --git a/ansible/files/paper-plugins/even-more-fish-1.6.11.17.jar b/ansible/src/paper-plugins/even-more-fish-1.6.11.17.jar similarity index 100% rename from ansible/files/paper-plugins/even-more-fish-1.6.11.17.jar rename to ansible/src/paper-plugins/even-more-fish-1.6.11.17.jar diff --git a/ansible/files/paper-plugins/orebfuscator-plugin-5.4.3.jar b/ansible/src/paper-plugins/orebfuscator-plugin-5.4.3.jar similarity index 100% rename from ansible/files/paper-plugins/orebfuscator-plugin-5.4.3.jar rename to ansible/src/paper-plugins/orebfuscator-plugin-5.4.3.jar diff --git a/ansible/files/paper-plugins/spark-bukkit-1.8.14.jar b/ansible/src/paper-plugins/spark-bukkit-1.8.14.jar similarity index 100% rename from ansible/files/paper-plugins/spark-bukkit-1.8.14.jar rename to ansible/src/paper-plugins/spark-bukkit-1.8.14.jar diff --git a/ansible/files/paper-plugins/worldedit-bukkit-7.2.19.jar b/ansible/src/paper-plugins/worldedit-bukkit-7.2.19.jar similarity index 100% rename from ansible/files/paper-plugins/worldedit-bukkit-7.2.19.jar rename to ansible/src/paper-plugins/worldedit-bukkit-7.2.19.jar diff --git a/ansible/files/proxy-plugins/LuckPerms-Bungee-5.4.25.jar b/ansible/src/proxy-plugins/LuckPerms-Bungee-5.4.25.jar similarity index 100% rename from ansible/files/proxy-plugins/LuckPerms-Bungee-5.4.25.jar rename to ansible/src/proxy-plugins/LuckPerms-Bungee-5.4.25.jar diff --git a/ansible/tasks/deploy/stacks.yml b/ansible/tasks/deploy/stacks.yml index a9cfcbe098..eb616112d5 100644 --- a/ansible/tasks/deploy/stacks.yml +++ b/ansible/tasks/deploy/stacks.yml @@ -48,13 +48,13 @@ - "'swarm_manager' in group_names" - item.enabled copy: - src: '../../files/{{item.file}}' + src: '{{item.file}}' dest: '/opt/stacks/{{item.target}}' loop: - - { file: 'paper-config', target: 'minecraft', enabled: setting.minecraft.enabled } - - { file: 'paper-plugins', target: 'minecraft', enabled: setting.minecraft.enabled } - - { file: 'proxy-config', target: 'minecraft', enabled: setting.minecraft.enabled } - - { file: 'proxy-plugins', target: 'minecraft', enabled: setting.minecraft.enabled } + - { file: '../../files/paper-config', target: 'minecraft', enabled: setting.minecraft.enabled } + - { file: '../../files/proxy-config', target: 'minecraft', enabled: setting.minecraft.enabled } + - { file: '../../build/paper-plugins', target: 'minecraft', enabled: setting.minecraft.enabled } + - { file: '../../build/proxy-plugins', target: 'minecraft', enabled: setting.minecraft.enabled } - name: Deploy Stacks | Deploy Stacks when: diff --git a/ansible/tasks/preflight-checks.yml b/ansible/tasks/preflight-checks.yml new file mode 100644 index 0000000000..0f405b499f --- /dev/null +++ b/ansible/tasks/preflight-checks.yml @@ -0,0 +1,19 @@ +- name: Preflight Checks | Check for secrets.yml + connection: local + stat: path=../variables/secrets.yml + register: secrets_yml + +- name: Preflight Checks | Fail if secrets.yml is missing + fail: + msg: "secrets.yml is missing, please create it by copying variables/secrets.example.yml" + when: not secrets_yml.stat.exists + +- name: Preflight Checks | Check for build dir + connection: local + stat: path=../build/ + register: build_dir + +- name: Preflight Checks | Fail if build dir is missing + fail: + msg: "build/ is missing, please create it by running `gradle :ansible:build`" + when: not build_dir.stat.exists diff --git a/ansible/variables/settings.yml b/ansible/variables/settings.yml index 3f3823fb2b..af98f9a3c4 100644 --- a/ansible/variables/settings.yml +++ b/ansible/variables/settings.yml @@ -7,7 +7,6 @@ settings: enabled: true minecraft: &default_minecraft enabled: true - civdocker_version: latest whitelist: false resources: &default_minecraft_resources memory: 40G @@ -22,7 +21,6 @@ settings: environment: Production minecraft: <<: *default_minecraft - civdocker_version: '2.0.0' auth: enabled: false # TODO: MOVE @@ -31,7 +29,6 @@ settings: environment: Test minecraft: <<: *default_minecraft - civdocker_version: '2.0.0' whitelist: true resources: <<: *default_minecraft_resources diff --git a/build.gradle.kts b/build.gradle.kts index dc47579b9c..7fc926138f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,4 @@ import com.gradle.enterprise.gradleplugin.GradleEnterpriseExtension -import io.papermc.paperweight.tasks.RemapJar -import xyz.jpenilla.runpaper.task.RunServer plugins { id("io.papermc.paperweight.userdev") version "1.5.10" apply false @@ -19,13 +17,8 @@ project.extensions.configure { } allprojects { - group = "net.civmc" - // TODO: We probably don't want to apply these to every project - apply(plugin = "java-library") - apply(plugin = "maven-publish") - repositories { mavenCentral() maven("https://oss.sonatype.org/content/repositories/snapshots") @@ -38,100 +31,4 @@ allprojects { maven("https://jitpack.io") } - - pluginManager.withPlugin("java-library") { - configure { - toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) - } - withSourcesJar() - withJavadocJar() - } - - tasks.withType { - options.encoding = "UTF-8" - options.release = 17 - } - - tasks.withType { - filteringCharset = "UTF-8" - } - } - - - configure { - val githubActor = System.getenv("GITHUB_ACTOR") - val githubToken = System.getenv("GITHUB_TOKEN") - - repositories { - if (githubActor != null && githubToken != null) { - maven { - name = "GitHubPackages" - url = uri("https://maven.pkg.github.com/CivMC/Civ") - credentials { - username = githubActor - password = githubToken - } - } - } - } - - publications { - create("maven") { - from(components["java"]) - pluginManager.withPlugin("io.papermc.paperweight.userdev") { - artifact(project.tasks.withType().getByName("reobfJar").outputJar) - } - } - pluginManager.withPlugin("com.github.johnrengelman.shadow") { - create("shadow") { - from(components["java"]) - pluginManager.withPlugin("io.papermc.paperweight.userdev") { - artifact(project.tasks.withType().getByName("reobfJar").outputJar) - } - } - } - } - } - - tasks.withType { - minecraftVersion("1.20.4") - } - - pluginManager.withPlugin("io.papermc.paperweight.userdev") { - - if (project.name.endsWith("paper") && project.name != "civspy-paper") { - // Copy the built jar into the paper container, removing any jars from previous versions - tasks.register("copyPaper", Copy::class) { - doFirst { - delete(fileTree("../../ansible/files/paper-plugins") { - include(project.name + "-*.jar") - }) - } - dependsOn("build") - from(tasks.findByPath("reobfJar")!!.outputs.files) - into("../../ansible/files/paper-plugins") - } - } - - tasks.withType { - filesMatching("plugin.yml") { - expand(project.properties) - } - } - - tasks { - named("build") { - dependsOn("reobfJar") - } - } - } - - pluginManager.withPlugin("com.github.johnrengelman.shadow") { - tasks { - named("build") { - dependsOn("shadowJar") - } - } - } } diff --git a/docker-compose.yml b/docker-compose.yml index c4a046a96a..ddb3d2f479 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,7 +34,7 @@ services: volumes: - ./containers/data/proxy:/data - ./ansible/files/proxy-config:/config - - ./ansible/files/proxy-plugins:/plugins + - ./ansible/build/proxy-plugins:/plugins paper: image: itzg/minecraft-server@sha256:491e37fa63ffef22c9ac1f6ec2fb4cc793735799cd91bafa1e5790aa39e9b313 @@ -81,7 +81,7 @@ services: volumes: - ./containers/data/paper:/data - ./ansible/files/paper-config:/config - - ./ansible/files/paper-plugins:/plugins + - ./ansible/build/paper-plugins:/plugins ################# ### Databases ### diff --git a/plugins/build.gradle.kts b/plugins/build.gradle.kts new file mode 100644 index 0000000000..ba56cb1c9d --- /dev/null +++ b/plugins/build.gradle.kts @@ -0,0 +1,85 @@ +import io.papermc.paperweight.tasks.RemapJar +import xyz.jpenilla.runpaper.task.RunServer + +subprojects { + apply(plugin = "java-library") + apply(plugin = "maven-publish") + + configure { + toolchain { + languageVersion.set(JavaLanguageVersion.of(17)) + } + withSourcesJar() + withJavadocJar() + } + + tasks.withType { + options.encoding = "UTF-8" + options.release = 17 + } + + tasks.withType { + filteringCharset = "UTF-8" + } + + configure { + val githubActor = System.getenv("GITHUB_ACTOR") + val githubToken = System.getenv("GITHUB_TOKEN") + + repositories { + if (githubActor != null && githubToken != null) { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/CivMC/Civ") + credentials { + username = githubActor + password = githubToken + } + } + } + } + + publications { + create("maven") { + from(components["java"]) + pluginManager.withPlugin("io.papermc.paperweight.userdev") { + artifact(project.tasks.withType().getByName("reobfJar").outputJar) + } + } + pluginManager.withPlugin("com.github.johnrengelman.shadow") { + create("shadow") { + from(components["java"]) + pluginManager.withPlugin("io.papermc.paperweight.userdev") { + artifact(project.tasks.withType().getByName("reobfJar").outputJar) + } + } + } + } + } + + tasks.withType { + minecraftVersion("1.18") + } + + pluginManager.withPlugin("io.papermc.paperweight.userdev") { + tasks.withType { + filesMatching("plugin.yml") { + expand(project.properties) + } + } + + tasks { + named("build") { + dependsOn("reobfJar") + } + } + } + + pluginManager.withPlugin("com.github.johnrengelman.shadow") { + tasks { + named("build") { + dependsOn("shadowJar") + } + } + } +} diff --git a/settings.gradle.kts b/settings.gradle.kts index 0869e043a8..64a523324f 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -4,6 +4,8 @@ plugins { id("com.gradle.enterprise") version "3.16.2" } +include(":ansible") + include(":plugins:banstick-paper") include(":plugins:bastion-paper") include(":plugins:citadel-paper")