Community
OpenEnergyMonitor

Community

Emoncms Docker...run Emoncms on your machine in 4 commands!

docker
Tags: #<Tag:0x00007f880b260828>
(Glyn Hudson) #1

With the help of @davehun and @spikeheap from @northwalestech I have been working on an Emoncms Docker setup. Using Docker it’s possible to fire up Emoncms on a bare system (assuming Docker is installed) in a couple of minutes with all the LAMP config faff taken care of. This is great for development since you can play about with Emoncms running in a Docker container without fear of messing up your main Emoncms install.

In the future, Docker can even be used as a deployment tool for Emoncms. In theory, it should be possible to deploy the Docker container on any server within minutes :slight_smile:

Read Blog Post

Quick start

$ docker pull openenergymonitor/emoncms
$ git clone https://github.com/emoncms/emoncms-docker
$ cd emoncms-docker
$ docker-compose up

That’s it! Emoncms should now be runnning, browse to http://localhost:8080

The Docker files and build instructions are in the emoncms-docker repo:

https://github.com/emoncms/emoncms-docker

Please give it a try and let me know how you get on.

The next step will be to push an Emoncms Docker container to docker-hub to allow anyone interested in Emoncms to pull down the container and be up and running with Emoncms almost immediately.
Done: https://hub.docker.com/r/openenergymonitor/emoncms/

To do:

  • Allow docker container to startup with a large amount of test data & demo dashboards etc.
  • Create ability to simulate a large number of inputs
  • Simulate emoncms.org multi-server
  • Add MQTT
  • Backup module
  • Add Redis
  • EmonHub
  • Investigate running Docker on RaspberryPi

See To Do list on emoncms-docker repo issues

5 Likes
(Bill Thomson) #2

You may find this helpful:

1 Like
(Glyn Hudson) #3

Yup, looks like it’s possible. It could be amazing in the future to be able to build Raspberry Pi / emonPi images from a docker container. :slight_smile:

Out of interest, does anyone have experience with Docker?

1 Like
(bart.ellast) #4

My test emoncms install is running in a docker on an unraid system.
Has been working flawlessly for a while now.

It’s definately a great way to run it independent from the server.
With a supported official docker i might switch my vm install over…

(Glyn Hudson) #5

Hi Bart,

Great to hear, how did you setup your Docker enviroment? I have gone for using two containers; one for php-apache and the other for mysql and linking them via docker-compose. I am keen to try and standardise on a docker setup which is best practice for emoncms in both development and production.

(Glyn Hudson) #6

Just updated my first post with quick start guide and blog post link:

https://blog.openenergymonitor.org/2016/06/emoncms-docker/#read-more

It’s awesome how 4 commands gets Emoncms up and running from scratch!

$ docker pull openenergymonitor/emoncms
$ git clone https://github.com/emoncms/emoncms-docker
$ cd emoncms-docker
$ docker-compose up

That’s it! Emoncms should now be runnning, browse to http://localhost:8080

3 Likes
(Bill Thomson) #7

Pretty slick!

There’s only three commands in your list. Your blog post shows another command:
$ docker pull openenergymonitor/emoncms

Should that one be in the list too?
Or should the text read 3 commands, vice 4 commands?

(Glyn Hudson) #8

Well spotted, blog post is correct. 4 commands are needed, the docker pull command is important. I’ve amended my post above.

(Christian Buchner) #9

Very nice idea, because now I can let it run direct on my NAS :slight_smile:
What do you think, is it possible to integrate an energy monitor via modbus also on docker?

(Glyn Hudson) #10

Modbus integration is a separate topic to docker. Please start a new topic discussion. I have no experience of Modbus, there might be some Modbus discussion on the old forums. Maybe try and search https://openenergymonitor.org/emon/forum

1 Like
(SolarMill) #11

The more I learn about docker the more I’m blown away by its potential. I hope this is something y’all are still working on!

1 Like
(Antonio) #12
[email protected]:/# docker ps | grep emon
438c4a303cb2        emoncms/apr                             "apache2-foreground"     4 months ago        Up 3 weeks          0.0.0.0:80->80/tcp                                                           emoncms
82544e7154f8        redis:alpine                            "docker-entrypoint..."   4 months ago        Up 3 weeks          6379/tcp                                                                     emoncms_redis
ff511ce35222        mysql:5.6                               "docker-entrypoint..."   4 months ago        Up 3 weeks          3306/tcp                                                                     emoncms_sql
[email protected]:/#

I’ve been a very happy docker user for about a year. I managed to migrate from a basic emoncms install inside a VM to containers without losing anything.

I’ve learned a lot with @glyn.hudson post and as usual forgot to drop a simple thank you.

so… THANK YOU! :blush:

2 Likes
(Glyn Hudson) #13

I’m glad to hear your finding the docker installation useful. Docker is fantastic.

Let me know if you have any suggestions on how to improve the emoncms docker setup. Git PR’s are best

(Glyn Hudson) split this topic #14

2 posts were split to a new topic: Emoncms docker on DSM 6

(kevin) #15

The default web port port 8080 which clashes with OpenHAB can be changed by editing docker-compose.override.yml
(Answered my own question)

1 Like