Your Dockerfile CMD can now always look the same:įinally, by adding the following statement to the configuration you get an application to view the status of your container processes, set httpdĪfter starting the container, surf to port 2812 and you will get a beautiful page showing the state of your processes and the ability to stop and restart them.Published on November 15, 2017. But fortunately, you can prevent this with the following configuration. Normally when you start monit it will start as a daemon. Start program = "/sbin/service sshd start" Stop program = "/sbin/service httpd stop"Ĭheck process sshd with pidfile /var/run/sshd.pid Start program = "/sbin/service httpd start" Stop program = "/sbin/service zabbix-java-gateway stop"Ĭheck process httpd with pidfile /var/run/httpd/httpd.pid Start program = "/sbin/service zabbix-java-gateway start" Stop program = "/sbin/service zabbix-agent stop"Ĭheck process zabbix-java-gateway with pidfile /var/run/zabbix/zabbix_java.pid Start program = "/sbin/service zabbix-agent start" Stop program = "/sbin/service zabbix-server stop"Ĭheck process zabbix-agent with pidfile /var/run/zabbix/zabbix_agentd.pid Start program = "/sbin/service zabbix-server start" Stop program = "/sbin/service mysqld stop"Ĭheck process zabbix-server with pidfile /var/run/zabbix/zabbix_server.pid Start program = "/sbin/service mysqld start" In monit this looks as follows: check process mysqld with pidfile /var/run/mysqld/mysqld.pid In the case of the Zabbix server there were seven processes to start: the zabbix server, agent, java agent, apache, mysql and sshd. Reduce all your Docker starts to a single command!.Deliver you a clean and crisp monitoring application.Make sure that your processes will keep on running.Give you a beautiful,readable specification file stating which processes to start.Then, I remembered from my earlier explorations to the inner workings of Cloud Foundry, a tool that would be really suitable for the job: monit. But a voice in my head started nagging: "Why don’t you fix it and send a pull request?" (actually, it was the voice of my colleague Arjan Molenaar). As I knew little about simplevisor and could not solve the problem, I put in an issue and resorted to a plain installation. As you can read in this post that was not a pleasant experience either. A better solution is needed: With the zabbix docker container the problem was solved using simplevisor. Imaging the ugliness when you have to start multiple processes. My first attempt to circumvent this while starting a tomcat server in Docker looked something like this: /bin/bash -c "service tomcat7 start while service tomcat7 status do sleep 1 done This time, the time was right to write about it! Most of the middleware components I want to start in a docker container, have a habit to start the process, daemonize it and exit immediately, with the docker container on its tail. So it was not hot and new Clearly I had been lying under a UNIX rock for quite a while. I discovered that the first release dated from somewhere in 2002. My advise is to use monit to start all but the most simple Docker application containers! When I found monit while delving through the inner works Cloud Foundry, I was ecstatic about it! It was so elegant, small, fast, with a beautiful DSL that I thought it was the hottest thing since sliced bread! I was determined to blog it off the roof tops. Starting a single process is a pain, starting multiple processes becomes nasty. Most stuff I like to start in container are things like http servers, application servers and various other middleware components which tend to have start scripts that daemonize the program. If you have every tried to start a docker container and keep it running, you must have encountered the problem that this is no easy task.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |