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!
Docker Documentation
Secrets top-level elements
Explore all the attributes the secrets top-level element can have.
Docker Documentation
Secrets in Compose
How to use secrets in Compose and their benefits
4 Replies
Admincraft Meta
Thanks for asking your question!
Make sure to provide as much helpful information as possible such as logs/what you tried and what your exact issue is
Make sure to mark solved when issue is solved!!!
/close !close !solved !answered
Requested by paulydphd#0
Snow Kit
Snow Kit4w ago
I don't think itzg/minecraft-server supports reading the cf secret from a file (which is what you're attempting to tell it to do). With that being said, the curseforge api "secret" doesn't need to really be secret. (in fact, you're better off just doing a google search and using the api key embedded in the curseforge launcher) If you really want to learn docker secrets, then fork the itzg image and add support for it
Pauly D PHD
Pauly D PHDOP4w ago
okay fair enough - Ive realized the modpack my friends want to play is no longer being updated anyway, so ill take a static .zip instead of the auto installer anyway Thanks! !solved
Admincraft Meta
Closed post!
Your post has been marked as solved!
Requested by paulydphd#0

Did you find this page helpful?