jjethwa / rundeck

GNU General Public License v3.0
123 stars 137 forks source link

latest and 2.10.1 fails to update grails.serverURL when using SERVER_URL #95

Closed mbigras closed 6 years ago

mbigras commented 6 years ago

Hi Jordan,

Not too much experience with Rundeck here; however, I've been using your image to tinker around and am very grateful for your work.

Seems like this latest image fails to set the grails.serverURL option in /etc/rundeck/rundeck-config.properties.

When attempting to run an ad hoc command on a remote node the command will fail with the following error message:

root@aadef506a5cc:/# cat $(find /var -name "*rdlog")
^2017-11-21T22:10:31Z||ERROR|{node=42.42.42.42|user=admin}|Failed to start execution: java.lang.IllegalStateException: Attribute absolute='true' specified but no grails.serverURL set in Config^
^END^

Not sure if I should open a rundeck 2.10.1 issue or if this is a good spot.

Below is a terminal dump of my hacking sessions. In each case I'm daemonizing the jordan/rundeck container and then stepping in to poke around.

You can see in the first case there is an error and grails.serverURL is not set. In the second case there is no error and the job finished successfully.

docker run -d -p 4440:4440 -e SERVER_URL=http://$IP:4440 --name rundeck -t jordan/rundeck:2.10.1
docker exec -it rundeck bash
root@aadef506a5cc:/# find /var -name "*rdlog"
/var/lib/rundeck/logs/rundeck/greet_project/run/logs/1.rdlog
root@aadef506a5cc:/# cat $(find /var -name "*rdlog")
^2017-11-21T22:10:31Z||ERROR|{node=42.42.42.42|user=admin}|Failed to start execution: java.lang.IllegalStateException: Attribute absolute='true' specified but no grails.serverURL set in Config^
^END^
root@aadef506a5cc:/# echo $SERVER_URL
http://42.42.42.42:4440
root@aadef506a5cc:/# cat /etc/rundeck/rundeck-config.properties
#loglevel.default is the default log level for jobs: ERROR,WARN,INFO,VERBOSE,DEBUG
loglevel.default=INFO
rdeck.base=/var/lib/rundeck

#rss.enabled if set to true enables RSS feeds that are public (non-authenticated)
rss.enabled=false
# change hostname here
#grails.serverURL=

dataSource.url = jdbc:mysql://localhost/rundeckdb?autoReconnect=true
dataSource.username = rundeck
dataSource.password = gQKSeQJPY12oPdI
root@aadef506a5cc:/# exit

docker run -d -p 4440:4440 -e SERVER_URL=http://$IP:4440 --name rundeck -t jordan/rundeck:2.10.0
docker exec -it rundeck bash
root@723bd39d58a4:/# cat /etc/rundeck/rundeck-config.properties
#loglevel.default is the default log level for jobs: ERROR,WARN,INFO,VERBOSE,DEBUG
loglevel.default=INFO
rdeck.base=/var/lib/rundeck

#rss.enabled if set to true enables RSS feeds that are public (non-authenticated)
rss.enabled=false
# change hostname here
grails.serverURL=http://42.42.42.42:4440

dataSource.url = jdbc:mysql://localhost/rundeckdb?autoReconnect=true
dataSource.username = rundeck
dataSource.password = w3EpCfqTKsgnY0F
jjethwa commented 6 years ago

Hi @mbigras

Thanks for reporting the issue. I believe it's because of a change from https://github.com/jjethwa/rundeck/pull/93

I'll do some analysis and see if I can get that fixed ASAP 😄

mbigras commented 6 years ago

Hi @jjethwa,

Thank you for getting back to me so fast! I hadn't seen #93. I took a look at it, seems EXTERNAL_SERVER_URL was added and the behavior of SERVER_URL was changed.

Going through that PR helped solve my issue.

docker run -d -p 4440:4440 -e SERVER_URL=http://$IP:4440 -e EXTERNAL_SERVER_URL=http://$IP:4440 --name rundeck jordan/rundeck

Below is the lines from #93 that helped me.

After change

$ docker run -p 4440:4440 -e SERVER_URL=http://localhost:4440
$ docker exec -it ... cat /etc/rundeck/rundeck-config.properties
...
#grails.serverURL=
...

# With grails.serverURL commented out, rundeck will no longer forcibly redirect and fall back to relative pathing.
$ docker run -p 4440:4440 -e SERVER_URL=http://localhost:4440 -e EXTERNAL_SERVER_URL=http://test:4440
$ docker exec -it ... cat /etc/rundeck/rundeck-config.properties
...
grails.serverURL=http://test:4440
...

# We are able to provide EXTERNAL_SERVER_URL when applicable

Do you think the change is worth a bigger version bump than a patch?

jjethwa commented 6 years ago

(tagging @ddavison for visibility)

Hi @mbigras

Don't think we'll do a version bump for this so the container version stays consistent with the Rundeck release version 😃

I think it may be safe enough to have users move over to using the EXTERNAL_SERVER_URL var instead of SERVER_URL so I'll update the readme and tagged release for other users. Some of the logic that uses the old SERVER_URL variable might need to be updated or can be removed. I'll have to look into closer tomorrow.

ddavison commented 6 years ago

good catch. yep! i think it's a better idea to have the EXTERNAL_SERVER_URL and SERVER_URL vars divorced. having that specific variable being set explicitly seems safer. glad you were able to get it resolved :)