othrayte / docker-cc-amp

Dockerfile for a container that installs and starts the Application Management Panel from CubeCoders.com
The Unlicense
3 stars 6 forks source link

Unraid help. #1

Open bjonness406 opened 8 years ago

bjonness406 commented 8 years ago

If I don't add the license key, or incorrect license key, what would happend? Would it just start and deny access?

I am trying to make this work un unraid, but I can't get it done. Could you provide an example of how lisence key should be added to the docker run command?

othrayte commented 8 years ago

If the license key is not provided then it will output the message

A licence for AMP from cubecoders.com is required and must be specified as --licence_key xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

and then the container will stop.

I don't know anything about unraid so I might not be able to help much if the issue is specific to that.

The general command for amp is the following: docker run <docker-arguments> othrayte/amp <amp-module-name> <options> e.g. docker run -p 8080:8080 -p 25565:25565 othrayte/amp Minecraft --licence-key <your-licence-key-xxxx> +MinecraftModule.Minecraft.PortNumber 25565

Where options are the following: -n or --instance-name the name of the amp instance (default: "Instance") -l or --licence-key your amp license key (required) -p or --password initial password for the amp instance (default: "password") -u or --username initial username for the amp instance (default: "admin") -h or --host the network interfaces to listen on (default: "0.0.0.0", attaches to all interfaces) --port the network port to listen on (default: "8080")

or an amp module setting as: +<key-name> <value>, for example +MinecraftModule.Minecraft.PortNumber 25565

If any option is not recognised by the container it will display Unknown option and stop.

The order of the options shouldn't matter, though amp module options will probably be passed through in the same order.

bjonness406 commented 8 years ago

Thanks, I got it working on docker for windows, but I am trying to also get it working on unRAID. Would you mind working with me a bit to make it possible? I will do all the testing ofc.

This is the command unraid is running:

run -d --name="amp" --net="bridge" -e TZ="Europe/Berlin" -p 8100:8080/tcp -p 25570:25565/tcp -v "/mnt/cache/appdata/amp":"/ampdata":rw --licence-key xxxx-xxxxx-xxxxxx-xxxxx othrayte/amp

(I am using a real license key)

But I get a error saying: flag provided but not defined: --licence-key

You have any idea why this is happening? Would it be possible to pass through the license key with a Environment Variables instead?

Do you know if "+MinecraftModule.Minecraft.PortNumber 25565" is a parameter or Environment Variable?

Thanks for helping me out!

othrayte commented 8 years ago

The issue seems to be that the license options is being passed to docker rather than to the script that runs inside the container.

From my brief searching online I can't find any documentation or examples of how to use the [command] and [arg...] parts of the docker run command which come after the docker image name on the command line, rather than before it.

So it seems like the only option is to add support for environment variables to the container's script. Probably not too hard to do, I suppose I can look into that.

To answer the question about the "+Thing" option, it is just another argument to the containers script.

othrayte commented 8 years ago

Ok, I have made an attempt as supporting environment variables, you should take a look at the unraid branch. I have documented the variable names on that branch in the readme.

bjonness406 commented 8 years ago

Thank you very much for helping me out :)

When I add all the variables except MODULE, I get this:

Info: No direct arguments detected, expecting MODULE and LICENCE environment variables. Error: The module name must be specified in the MODULE enviroment variable

So then I add a MODULE Variable, with value as MODULE, it does start. What am I actually supposed to have here?

BUT then I start the docker, I get this message

[Error] 'tmux' isn't installed. Please install tmux to use the instance manager.

And then the docker will not start, just tried it with a "normal" docker (windows), and I get the same error message there.

othrayte commented 8 years ago

The modules are provided by CubeCoders, I haven't found documentation of them online but you can query it from the container, but this will only work on normal (not unRAID) docker.

docker run -it --rm othrayte/amp -- ./ampinstmgr ShowModuleList

For me that prints out

[Info] AMP Instance Manager v1.3.1.0
Available Modules:
 - McMyAdmin
 - Minecraft
 - Rust
 - srcds
 - StarBound
 - JC2MP
 - SpaceEngineers
 - ADS
 - Arma3

These names can be used in the MODULE variable to start that module.

You can determine what extra options are available for a module by running:

docker run -it --rm othrayte/amp -- ./ampinstmgr ShowProvisionReqs <module_name>

Where <module_name> is one of the names from the previous output.

For Minecraft this prints out

[Info] AMP Instance Manager v1.3.1.0
Provisioning Arguments for Minecraft

Node             ? MinecraftModule.Java.CustomOpts
Description      ? Custom java options (for -XX:MaxPermSize, etc)
Default          ?

Node             ? MinecraftModule.Minecraft.ServerIPBinding
Description      ? IP Binding
Default          ?

Node             ? MinecraftModule.Limits.MaxPlayers
Description      ? Maximum concurrent players
Default          ? 8

Node             ? MinecraftModule.Java.MaxHeapSizeMB
Description      ? Maximum Java heap size (Megabytes)
Default          ? 1024

Node             ? MinecraftModule.Minecraft.PortNumber
Description      ? Port Number
Default          ? 25565
othrayte commented 8 years ago

(The last one was a bit long so I decided to make this a separate comment)

The issue about needing tmux seems to be related to the new version of AMP, the release notes for 1.3.3.0 mention that tmux is now needed on linux.

I assume that the newer builds on the unraid branch built with this newer version of AMP.

It is a simple matter to fix that #2.

othrayte commented 8 years ago

There are new builds of the container that you can pull now that should fix the tmux issue.

bjonness406 commented 8 years ago

Thank you very much for your help!

I have found out a way to use your original branch on unraid, it was just not obvious how to do it. The Extra Parameters setting in unraid was for docker itself, not the docker container. Here if you want to read: https://lime-technology.com/forum/index.php?topic=48999.15

A bit of topic, but do you know how you add more minecraft server? And how do I add other modules? I did not get that. Could it be the that I have not added "+MinecraftModule.Minecraft.PortNumber 25565" ? I get an error message then I add it with unraid, need to check it out more.

If you want to remove the unraid branch, feel free to, but if you could. You can make the master and unraid branch the same, except to set licence-key as an env. I don't need it, but it would look cleaner if other people want to use it (will post a template for you docker, all credit will ofc go to you). If it is a bit of job for you, don't do it!

othrayte commented 8 years ago

Good to hear that you got it working.

To be honest I haven't really explored running multiple servers. The simplest option is to simply run multiple independent containers and route them to different ports. Another option is to start an ADS instance in amp (ADS is an amp module) and use that to create more minecraft modules in the container whilst it is running (ADS gives you a web interface). Using ADS has some limitations at the moment, I think you have to start the minecraft modules manually each time the container starts up and you need to know in advance what ports you want to forward through docker as docker needs them to be setup when you create the container.

If you're asking about adding containers for other modules then that should be the same as running more minecraft modules just with different module names in the container command, or by creating them in ADS.

If you're asking about how to create new modules that are not currently in the list of ones available then you would need to refer to CubeCoders website for any information about that, I'm not sure if it is possible.

I'll probably merge the new functionality that is on the unraid branch into master so that other people can use the env vars. I might also change the documentation to suggest passing the license key via the environment as well as that seems like a good idea.

FYI, about the Minecraft.PortNumber setting I have been thing about making a minecraft specifc docker container that would setup a sensible default for the port number as everyone should set it to 25565 anyway (and map the port with docker if they want).

I'd definitely be interested to see the template and I'd like to link it in the readme if that's ok.

bjonness406 commented 8 years ago

Wow, that is an hero answer! Yeah, just link the template, will post it here when it is done. Could you update me then you have merged the unraid and master branch together? So I can use env instead for the licence key?

I got a small problem, when I change "Minecraft" to "ADS" in the docker run command, I still get to the minecraft control panel. Do you know what am I doing wrong? othrayte/amp ADS --licence-key your-licence-key-xxxx

othrayte commented 8 years ago

I have integrated the env changes into the develop branch, I just want to test it some more before I merge it into master, will reply when that is done.

I think I noticed somewhere that you are mapping the /ampdata volume (which is a good idea and is what I do for my own container) but when doing this each instance of a module created needs a unique name. The default name is just "Instance" so if you change the module but not the instance name the container will just run the existing instance from the volume. A solution to this is to set the --instance-name option or INSTANCE_NAME environment variable to something else, or you could also run it in a container with the volume mapped somewhere else.

If you aren't mapping the volume that way then I'll have to think about the issue some more.

bjonness406 commented 8 years ago

That fixed it, just had to map the volume somewhere elsewhere :)

Very close to get this working now, but I can't get the MODULE env to work.

Instead of having the Module (Minecraft or ADS) in the docker run command (like this "othrayte/amp ADS"). If I set it as an env instead, the run command becomes:

root@localhost:# /usr/local/emhttp/plugins/dynamix.docker.manager/scripts/docker run -d --name="Bjonness406-AMP" --net="bridge" -e LICENCE="licence-key-here-xxxx" -e MODULE="ADS" -e TZ="Europe/Berlin" -p 8100:8080/tcp -p 25570:25565/tcp -v "/mnt/cache/appdata/amp4/":"/ampdata":rw othrayte/amp:develop

Then I get an error message in the log saying:

Info: No direct arguments detected, expecting MODULE and LICENCE environment variables.
Starting instance: Instance
[19:05:55] [Core Info] ???????????: Starting AMP version 1.3.3.0
[19:05:55] [Core Info] ???????????: OS: Linux / x86_64
[19:05:55] [Core Info] ???????????: AMP Instance ID: xxxx-xxxx-x-xxxxxx-xxxxxx-xxxxx
[19:05:55] [Core Error] ??????????: No application module specified. Please specify one in your AMP configuration file, or re-run the instance manager.

If I only has the Licence-key as an env, then it works fine. Could you check this out if you have the time? :)

othrayte commented 8 years ago

That issue looks a little odd to me, and after much head scratching, the most probable cause I can think of is that there is a corrupt instance called "Instance" in that volume. One thing that leads me to think that is the Starting instance: Instance line and the lack of a line starting with Creating module instance: ./ampinstmgr CreateInstance ADS Instance.

I would suggest trying to run without the volume to see if it is just that; you could also clear out the mounted folder which should have the same effect. In my testing passing the module name as you have done was working and if it still isn't working without a volume mounted then I would suggest pulling the develop branch again just to make sure that there is no discrepancy there, in docker this is docker pull othrayte/amp:develop I don't know how that works with unraid though.

bjonness406 commented 8 years ago

Changing the volume fixed the issue :)

Everything working now :D

bjonness406 commented 8 years ago

Time to merge master and dev soon? :)

othrayte commented 8 years ago

Have just merged develop into master, should have a build soon.

Are you using a template file that I should be linking, or does everyone use Community Applications now?

bjonness406 commented 8 years ago

Thank you very much! Everyone use Community Applications now, but it still doesn't hurt to add it. https://github.com/bjonness406/Docker-templates

You can delete the unraid branch if you want.