-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting up mysql not obvious. Docs not clear. #74
Comments
Hi @tombburnell Sorry about the lack of documentation. I'll try to detail that when I get time. The standard use case for the container is with the built in MySQL instance. We would need to tweak the setup script to allow other database names besides the standard rundeckdb. So try using the default, rundeckdb, for now. Also, make sure to set
These were added in the latest commit so your MySQL admin account can create and grant the necessary privileges to the rundeck user on rundeckdb. |
@jjethwa Can you confirm that a default local database configuration works? I am not passing any db related environment variables into the container and keep getting a fresh install failing with this error.
|
Hi @dougereed Can you provide the docker run line you're using? It looks like you're using the latest tag. I just pushed changes to switch from Debian Jessie to Stretch, but a fresh install was tested without the issue you're seeing. |
|
Hi @dougereed That looks basic enough 😕 , I'm not sure why it's throwing an error for you. I just tried using the same command and had no issues. Can you try pulling the latest container down again or better yet one of the tagged releases as they are more for Production use? What version of docker are you using and what platform? Have you tried it without the --rm option? The --rm option is meant for transient containers mostly. |
@jjethwa Falling back to 2.8.2 works well. I'll debug for awhile and let you know what I find. Appreciate the support. |
@jjethwa Ok. I've narrowed it down to mapping a host directory structure onto the container's data volumes. I left this out of the original docker run command line to just try to simplify. When I re-tested what I sent you it works fine with the latest image. Here is the complete docker run command. Falling back to 2.8.2 does work with with the external data volumes. I'm removing everything under /container_storage/rundeck, with a Docker is running on Ubuntu 16.04, and the version is:
Here is the full output of the run command.
This seems to be this line in /opt/run. |
Thanks so much, @dougereed I was able to reproduce the issue when using a volume for /var/lib/mysql (empty and with a populated DB already). It looks like there is a change with MariaDB and Debian. See: https://mariadb.atlassian.net/browse/MDEV-8375 I think I have a fix. Testing a bit more 😄 |
Hi @dougereed Seems to be working well in my tests. Can you pull latest again and let me know? 😃 |
@jjethwa - Thanks for the help. I pulled in your change and can also verify everything works. |
Not clear on the resolution here. I'm using the latest image and it still ignores the db I specify in the DATABASE_URL. Should I open a separate issue? |
Hi @doreplado If you're using an external MySQL/MariaDB instance, you need to set NO_LOCAL_MYSQL to true and set DATABASE_URL. Try that and let me know if it works 😄 |
I am trying to setup rundeck to use my mysql container, but it'll always exit with My version: '2'
services:
rundeck:
image: jordan/rundeck
volumes:
- ./volume/etc:/etc/rundeck
- ./volume/rundeck:/var/rundeck
- ./volume/ssh:/var/lib/rundeck/.ssh
- ./volume/logs:/var/log/rundeck
- ./volume/rundeck_gui_log:/var/lib/rundeck/logs
- ./volume/storage:/var/lib/rundeck/var/storage
- ./volume/plugins:/opt/rundeck-plugins
- ./volume/mysql:/var/lib/mysql
environment:
# reverse proxy
- VIRTUAL_HOST=rundeck.mydomain
- VIRTUAL_PORT=4440
- LETSENCRYPT_HOST=rundeck.mydomain
- LETSENCRYPT_EMAIL=sysadmin@mydomain
# rundeck
- EXTERNAL_SERVER_URL=https://rundeck.mydomain
#- RUNDECK_WITH_SSL=false
- DATABASE_URL=jdbc:mysql://mydomain:1337/rundeck?autoReconnect=true
- RUNDECK_PASSWORD=verysecurepasswordbecauseiamnotusingsecrets
- NO_LOCAL_MYSQL=true
- RUNDECK_ADMIN_PASSWORD=somepass
#- SKIP_DATABASE_SETUP=true
expose:
- 8814
#restart: always
#ports:
# - 4440:4440 Note that I use an nginx reverse proxy in another container. Is there a way to fix this or am I doing something wrong? |
Hi @jonguenther Are you able to connect to the remote database using the (MySQL/MariaDB) client inside the container? Try with the DNS name first and if that doesn't work, try the IP. |
Hi @jjethwa I've the same problem using a MySQL image, this is my docker-compose version: '3'
services:
rundeck:
image: jordan/rundeck
container_name: "rundeck"
environment:
DATABASE_URL: jdbc:mysql://rundeck-db/rundeckdb?autoReconnect=true
RUNDECK_PASSWORD: dbpassword
EXTERNAL_SERVER_URL: http://rundeck.docker:80
NO_LOCAL_MYSQL: "true"
GUI_BRAND_HTML: "Rundeck Test"
ports:
- "80"
links:
- mysql:rundeck-db
mysql:
image: "mysql:5.7"
container_name: "rundeck-db"
environment:
MYSQL_RANDOM_ROOT_PASSWORD: "true"
MYSQL_USER: rundeck
MYSQL_PASSWORD: dbpassword
MYSQL_DATABASE: rundeckdb I receiving I can login to the database from the inside of mysql container using: I'm doing something wrong? |
Hi @daaru00 I'm currently away from my laptop for another few days, but will look into the issue as soon as I'm back 😄 Can you login to the database from the Rundeck container using the CLI? |
yes, I can connect without problem |
Hi @daaru00
. Hope it is helpful |
I'm pretty sure an older version of this image let you use set the database name.. |
after hours of research, i've isolated the problem to the according to if [[ "${DATABASE_URL}" == *"mysql"* && "${SKIP_DATABASE_SETUP}" != "true" ]]; then
echo "=>Initializing remote MySQL setup"
(
echo "CREATE DATABASE IF NOT EXISTS rundeckdb;"
echo "GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE, CREATE VIEW, ALTER, INDEX, EXECUTE ON rundeckdb.* TO 'rundeck'@'%' IDENTIFIED BY '${RUNDECK_PASSWORD}';"
echo "quit"
) |
mysql --host=$(echo ${DATABASE_URL} | grep -oP "(?<=jdbc:mysql:\/\/)(.*)(?=\/)") --user=${DATABASE_ADMIN_USER} --password=${DATABASE_ADMIN_PASSWORD} since you are using the mysql:5.7 image (mariadb:10.3 in my case), the database is already setup. Since you didn't pass since the |
this issue in particular refers to the lack of documentation. considering commit 155db62, i believe we can close this issue. your commit looks clear! 👍 |
The following seems to be connected to the issue. This commit seems to be wrong. Because here: So, either:
In my case current code leads to:
here is my docker-compose file:
I suggest renaming variable I can try to make a PR with the suggested modifications if you wish. UPD:
|
Hi @dbolotin Thanks for looking into it! I don't think we want to revert the entire commit as it contains the Postgres setup. From the stacktrace you posted, it looks like the initial setup ( https://github.com/jjethwa/rundeck/blob/master/content/opt/run#L140-L144 ) fails due to restrictions for the root user. The default behaviour of MySQL/MariaDB restricts the root account to local access only for security reasons. I'm not 100% sure why setting the RUNDECK_PASSWORD variable to the db_root_password var works for you though 😕 |
I checked it, access was opened for Initial setup was executed successfully, setting While downstream, initialisation script sets |
Ah, I missed that @dbolotin https://github.com/jjethwa/rundeck/blob/master/content/opt/run#L182 definitely needs to be the rundeck user, not the admin user. I'll make the change now 😄 |
I figured out that to connect to a mysql instance you need to do the following:
mysql needs to be configured to listen on 0.0.0.0
you need to set your environment as
NO_LOCAL_MYSQL=true
DATABASE_URL=jdbc:mysql://myhost/?autoReconnect=true
Putting the db name in the URL seems to have no effect, it always tries to connect to rundeckdb.
DATABASE_URL=jdbc:mysql://myhost/rundeck?autoReconnect=true
grant ALL PRIVILEGES on rundeckdb.* to 'rundeck'@'%' identified by 'yourpassword';
grant ALL PRIVILEGES on mysql.* to 'rundeck'@'%' identified by 'yourpassword';
Why does it need access to mysql database?
The text was updated successfully, but these errors were encountered: