I'm trying to set up a LEMP stack in rkt (with Docker files), so I'm using Supervisord to get everything running in the same container. When I build and start the Mariadb container separately, it works fine. As soon as I try to run it via Supervisord instead, MariaDB exits right away. What am I doing wrong?
I want to use Supervisord for other things as well, so I'm sending this each time I run it:
RUN printf "\n[program:mysqld]\ncommand=sleep 5; mysqld_safe --skip-syslog\nstartretries=10\n" >> /etc/supervisor/conf.d/supervisord.conf
Sleep 5 and startretries I added for testing purposes.
The error log looks like this:
161130 9:32:25 [Note] InnoDB: Using mutexes to ref count buffer pool pages
161130 9:32:25 [Note] InnoDB: The InnoDB memory heap is disabled
161130 9:32:25 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
161130 9:32:25 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
161130 9:32:25 [Note] InnoDB: Compressed tables use zlib 1.2.8
161130 9:32:25 [Note] InnoDB: Using Linux native AIO
161130 9:32:25 [Note] InnoDB: Using CPU crc32 instructions
161130 9:32:25 [Note] InnoDB: Initializing buffer pool, size = 128.0M
161130 9:32:25 [Note] InnoDB: Completed initialization of buffer pool
161130 9:32:25 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
161130 9:32:25 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
161130 9:32:25 [Note] InnoDB: Database physically writes the file full: wait...
161130 9:32:25 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
161130 9:32:25 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
161130 9:32:26 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
161130 9:32:26 [Warning] InnoDB: New log files created, LSN=45781
161130 9:32:26 [Note] InnoDB: Doublewrite buffer not found: creating new
161130 9:32:26 [Note] InnoDB: Doublewrite buffer created
161130 9:32:26 [Note] InnoDB: 128 rollback segment(s) are active.
161130 9:32:26 [Warning] InnoDB: Creating foreign key constraint system tables.
161130 9:32:26 [Note] InnoDB: Foreign key constraint system tables created
161130 9:32:26 [Note] InnoDB: Creating tablespace and datafile system tables.
161130 9:32:26 [Note] InnoDB: Tablespace and datafile system tables created.
161130 9:32:26 [Note] InnoDB: Creating zip_dict and zip_dict_cols system tables.
161130 9:32:26 [Note] InnoDB: zip_dict and zip_dict_cols system tables created.
161130 9:32:26 [Note] InnoDB: Waiting for purge to start
161130 9:32:26 [Note] InnoDB: Percona XtraDB (link removed) 5.6.32-79.0 started; log sequence number 0
[lots of repetition in between here]
161130 9:32:44 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
161130 9:32:45 [Note] InnoDB: Shutdown completed; log sequence number 1623609
161130 9:32:45 [Note] InnoDB: Using mutexes to ref count buffer pool pages
161130 9:32:45 [Note] InnoDB: The InnoDB memory heap is disabled
161130 9:32:45 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
161130 9:32:45 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
161130 9:32:45 [Note] InnoDB: Compressed tables use zlib 1.2.8
161130 9:32:45 [Note] InnoDB: Using Linux native AIO
161130 9:32:45 [Note] InnoDB: Using CPU crc32 instructions
161130 9:32:45 [Note] InnoDB: Initializing buffer pool, size = 128.0M
161130 9:32:45 [Note] InnoDB: Completed initialization of buffer pool
161130 9:32:45 [Note] InnoDB: Highest supported file format is Barracuda.
161130 9:32:45 [Note] InnoDB: 128 rollback segment(s) are active.
161130 9:32:45 [Note] InnoDB: Waiting for purge to start
161130 9:32:46 [Note] InnoDB: Percona XtraDB (link removed) 5.6.32-79.0 started; log sequence number 1623609
161130 9:32:46 [Note] Plugin 'FEEDBACK' is disabled.
161130 9:32:46 [Note] InnoDB: FTS optimize thread exiting.
161130 9:32:46 [Note] InnoDB: Starting shutdown...
161130 9:32:47 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
161130 9:32:48 [Note] InnoDB: Shutdown completed; log sequence number 1623619
Not a single error, it just starts to shut down.
Ideas?
Ok, so EVENTUALLY I got this to run. What I added was two things I found here: https://github.com/Kloadut/dokku-md-dockerfiles/tree/469a32ed0696803808cd07413f13ee22c7b0e6e2
# prevent apt from starting mariadb right after the installation RUN printf '#!/bin/sh\nexit 101' > /usr/sbin/policy-rc.d; chmod +x /usr/sbin/policy-rc.d
paired with:
# allow autostart again RUN rm /usr/sbin/policy-rc.d
Then the other thing was that I'm running a script file doing some secure install database stuff, and it ends with:
tail -f /var/log/mysql.log /var/log/mysql.err /var/log/mysql/mariadb-slow.log
And that's it. Really not sure why not having these would cause MariaDB to stop since I've not seen them used anywhere else. The tail -f thing is especially weird since I though Supervisord would handle that.
Anyway, if anyone else get caught in this, look at the Dockerfile and script file from the link above. That was all it took for me.