Hi @almereyda, looks interesting! Could you please comment a bit on how you see this in relation to the ofn-install project? Are you proposing it is a useful companion approach, a replacement, etc?
When we worked on it yesterday night, our intention was not to replace anything but to provide another way of deploying production environment (than the ansible solution), straight from a dockercompose file.
I can hear the critics on Docker, but we believe multiple solutions is key to enhancement, so why not a Docker recipe.
It still miss some documentation (especially on assets compilation aka assets:precompile:primary && assets:precompile:nondigest .
Kitematic is a good first place to start because it allows you to turn on
and off test docker machines. I agree it could help get more developers
involved
Cool. Thanks for your contribution. I agree that itās nice to have an alternative. But it will also increase the maintenance work.
A very successful project using Docker is Discourse. That is the only one I have worked with so far. And I did come across some difficulties with disk space. Itās also not ideal that some configuration changes require a rebuild of the container which involves downtime. I guess you could work around that, I just followed the official instructions.
Iām looking forward to having an alternative and hope that it will mean improvements of the Ansible scripts as well.
@almereyda Did you get memcached working? Linking a (standard image) container (in the same way like postgres) results in ādalliā gem not finding memcached expected at localhost:11211
It seems to work when adding the container/host name in config/environments/production.rb like this: config.cache_store = :dalli_store, āmemcacheā
What is the docker compose way to configure the memcached host?
I was asked what I think about Docker for OFN production servers. So Iām sharing my thoughts here.
I totally get the point of having a virtual environment for development. Even though the OFN works on Linux and OSX natively, it would enable Windows users, it would keep environments separate, it would be a good place to test staging and production environments locally and so on. It would actually be good to document a list of advantages and disadvantages somewhere as a reference.
And then there is a good point in saying: āIf we use Docker for dev and testing, why not use the same environment in production?ā
But I think:
We have one VPS per OFN instance at the moment. So you have your own environment already.
We have a well working provisioning with Ansible already. We even have a configuration management there so that everybody knows which servers there are and which settings they use.
We would still need a provisioning tool like Ansible for the Docker setup on the server.
Docker is an additional layer adding more complexity.
Software updates (e.g. nginx) are simple to install on a VPS. They affect all native apps installed and they are permanent. With Docker we would need to rebuild/replace all containers.
Itās a good practice to keep the OFN software flexible enough to work in multiple environments, not just the default OFN Docker image.
Summary: I donāt think that Docker is ideal for OFN production use. But it is great to emulate a production environment on another machine.
I was thinking of docker to be that VPS for me. Maybe thatās my misconception?
My server runs debian. The ansible scripts require some ubuntu dependencies (that I could not figure out how to install). Thatās why I used a docker ubuntu image which worked fine (almost).
There is a wordpress site and some nodejs apps already running on that server. Nginx is (virtual multi host) configured to distribute incoming http requests between them. I tried to install an OFN instance beside that. How would you do that? Simply renting another vps? possibly switching the hosting provider to find one that offers the fitting ubuntu version?
Do you think it would be a good idea to share the nginx and postgres db that is already running? Docker-compose seemed to āpromiseā that by modularizing the different os processes. This would also enable to upgrade, replace or reconfigure them separately without having to run that huge ansible thing again which contains everything.
Iām not a sysadmin. Just trying to figure out how to set up OFN.
Thank you for sharing the background. That helps me understand your situation.
I was thinking of docker to be that VPS for me.
Okay, cool. Itās a good solution to create a separate environment. It saves you renting another VPS and lowers your costs. Great. More environments just means that you have more systems to take care of and to keep up-to-date.
My server runs debian. The ansible scripts require some ubuntu dependencies
Debian is my favourite. Ideally, we would make the Ansible scripts general enough to work with Debian as well. That was the idea behind Ansible. And itās not that difficult. It just hasnāt been a priority, because people just chose Ubuntu.
In the meantime, itās a good idea to use Docker as a compatibility tool. Thatās a strength of Docker. But wouldnāt it be better if we didnāt need Docker? That was the point I tried to make.
There is a wordpress site and some nodejs apps already running on that server.
We do the same on openfoodnetwork.org.au (OFN) also running openfoodnetwork.org (Wordpress). The difference is that itās Ubuntu. We just have several configurations listening to different server names. The OFN config accesses the Unicorn processes (started by an unprivileged user) via FCGI. Thatās how the Ansible scripts set it up.
Do you think it would be a good idea to share the nginx and postgres db that is already running?
I donāt know if itās a good idea. We do it that way. I guess itās more efficient and thatās why database software supports multiple databases and multiple users with access management.
Another summary: I think that Docker is a great tool. And I think you made a good decision to use that tool to get the OFN working in your environment. But I also think we should make the OFN compatible with any setup people want to run. It should make the OFN cleaner, more flexible, faster and more powerful. But thatās just my opinion. We also have to be careful that the OFN doesnāt become full of workarounds to live in every possible environment. What are your thoughts, everyone?
wouldnāt it be better if we didnāt need Docker?
fully agree! Initially I just manually set up a rails environment on my laptop which worked fine (although this might be more difficult if youāre not used to rails). Then I tried the (awesome) ansible scripts on the server and documented the experience here Ansible deploy on debian / docker - #3 by orangeman The only reason to use docker had been the ubuntu dependencies.
make the OFN compatible with any setup people want to run
Thatās what docker - how I understood it - promised to do: make OFN run anywhere by just running a ready build image inside an isolated (movable) container. I was really inspired of how simple and quick(!) it was to setup wordpress in seconds: docker-compose up -d and done. The whole āsetupā is isolated and can easily be moved to another server. The ansible scripts have been rather slow and it took a lot of attempts until they finally ran through. Then I tried docker commit and thought this would save all the work⦠but it didnāt. After running the committed docker image on my local machine it was necessary to start nginx, postgres, unicorn, memcached services manually and I couldnāt get the background job runner to work (ā¦) Probably I was doing docker wrong
be careful that the OFN doesnāt become full of workarounds to live in every possible environment.
Very true! Keep it simple. Iām not excited about docker the tool. Iām excited about the promise to quickly spin up OFN instances and being able to easily stop/start an instance or move it to a different machine. Maybe docker container is not the right tool for this? @enricostn talked about plain linux containers LXC. Any thoughts about that?
I was talking about using LXC for development environments, not production.
Regarding your case, re-using an existent VPS with other distro than Ubuntu, maybe you could contribute on adding Debian compatibility to ofn-install repo. Sharing same nginx and DB can be an option, but outside of ofn-install IMHO.
If I had got ofn running on debian I would (happily) contribute it @enricostn . But I gave up after two days. IIRC there are just some language l10n packages that are missing on debian and I could not figure out how to install them. Probably only minor issues @Rulosanti but I went with an ubuntu docker container at the time (which I can not recommend [ā¦]). The easiest is imho to āsimplyā use an ubuntu 14.04 VPS