Pauly D PHD
Pauly D PHD
AAdmincraft
Created by Pauly D PHD on 12/26/2024 in #questions
Curseforge API as a docker secret
Trying to do my first MC Docker project, and want to use Secrets instead of env variables (not planning on republishing, but wanting to learn how to use secrets w Docker Compose) Im using itzg/mc for server and backup snippet of the relevant portion of the dockerfile yaml:
secrets:
curse_forge_api_key:
file: curseForgeAPIKey.txt
services:
mc:
image: itzg/minecraft-server:latest
tty: "true"
stdin_open: "true"
ports:
- "25565:25565"
environment:
MEMORY: "7G"
EULA: "TRUE"
TYPE: AUTO_CURSEFORGE
CF_SLUG: cottage-witch-recast
CF_API_KEY: /run/secrets/curse_forge_api_key
VERSION: "1.19.2"
depends_on:
restore-backup:
condition: service_completed_successfully
secrets:
- curse_forge_api_key
volumes:
- ./mc-data:/data
secrets:
curse_forge_api_key:
file: curseForgeAPIKey.txt
services:
mc:
image: itzg/minecraft-server:latest
tty: "true"
stdin_open: "true"
ports:
- "25565:25565"
environment:
MEMORY: "7G"
EULA: "TRUE"
TYPE: AUTO_CURSEFORGE
CF_SLUG: cottage-witch-recast
CF_API_KEY: /run/secrets/curse_forge_api_key
VERSION: "1.19.2"
depends_on:
restore-backup:
condition: service_completed_successfully
secrets:
- curse_forge_api_key
volumes:
- ./mc-data:/data
Any thoughts on what im doing wrong here? In case its not obvious, trying to have a .txt in the same folder as the .yaml, which only contains the API key as an unencrypted string and nothing else. Then im wanting Compose to pick it up in the top level Secrets segment, so that i can be used by the Environment > CF_API_KEY, which as i understand, will end up in /run/secrets/ I've been following https://docs.docker.com/reference/compose-file/secrets/ and https://docs.docker.com/compose/how-tos/use-secrets/ as best as i can, but this is my first time. The actual error i get now is:
[mc-image-helper] 21:10:00.875 ERROR : Invalid parameter provided for 'install-curseforge' command: Access to https://api.curseforge.com is forbidden or rate-limit has been exceeded. Ensure CF_API_KEY is set to a valid API key from https://console.curseforge.com/ or allow rate-limit to reset.
[mc-image-helper] 21:10:00.875 ERROR : Invalid parameter provided for 'install-curseforge' command: Access to https://api.curseforge.com is forbidden or rate-limit has been exceeded. Ensure CF_API_KEY is set to a valid API key from https://console.curseforge.com/ or allow rate-limit to reset.
And i get success/diff errors if im passing CF_API_KEY as plain text Cheers!
7 replies