Dockerfile with Phalcon2 + Nginx

Hi guys,

the phalcon framework looks really nice and I was searching for a Dockerfile with phalcon v2 and an nginx installation to give it a try.

It would be nice if someone could share his Dockerfile.

Thanks alot,

Jan



44.7k

Well my project is rather complex for just a basic starter kit but here is my Dockerfile. Its not complete with Docker in the sense that not all services start but it is a really good way to test out the provisioning scripts (but oh god that part is boring to work on).

Thank you for you fast reply. That looks perfect. Are there additional tutorials about your project. It looks really interesting. Would like to dive a bit deeper in it.



44.7k

Clone it and feel free to ask questions. I'm at the end of my day now but I'm setup to answer any questions in the morning.

Check out setup. I'm particularly proud of my bash provision system. Its setup to have global functions and distro specific bash functions. There are simple list files for system, npm and pecl packages. It uses a init.d style runtime order so you just prefix the scripts with NN- to order it. This part is probably acceptible for any project but if you are not heavily planning to use webpack then you might want to scrap the rest of the project.



44.7k

I'll add the idea behind the provision script is that it can be called manually with ./setup/... or the Dockerfile can get it going. I went with bash because WOW, there are a ton of dependencies in a complicated PHP + webpack build and adding stuff like Puppet into it with its own dependencies just seemed crazy. I mean dependencies for the provision script that installs the dependencies is a bit too much for me.

edited Dec '15

Wow, I am really impressed. First impression: Its a perfect starting point. I give it a try and feedback later.

edited Dec '15

I am running the latest Docker Toolbox v1.9 on Windows 7 x64 and try to build your Dockerfile.

I solved a permission problem by adding chmod

ADD . /opt/webird

RUN chmod -R 755 /opt/webird/

Now I stuck on this error message while building the Dockerfile

Step 8 : RUN /opt/webird/setup/provision-system.sh ubuntu1404 ---> Running in 571a409f1fbf : No such file or directory

Do you have any idea, how to solve this? Or is this a windows problem?



44.7k

I don't think that I've worked with it since Docker 1.2 and I was running from Ubuntu 14.04 64 bit. Perhaps try changing it to simply cat the provision script to see if it is there.

Sorry m8, your Dockerfile is building fine. I have had a problem with Sourcetree and line endings. Sourcetree is converting all line endings at windows CRLF by default. Never have had this problem before. Now, I downloaded the project as zip and copied the .git folder and everything is fine.

edited Dec '15

I really tried hard to get it running. Repaired the dockerfile and updated some settings. But I still can not get it to running. Sorry, I try an other dockerfile. I would really like to start to test phalcon.

I could push my changes if you like to. But they contain changes to the config files in the ubuntu1404 folder. And I added colored output to debug the installation process.



44.7k

I'll give my current code a run within the next few days.

I forked your project and pushed my changes to: https://github.com/JanOschii/webird



44.7k

Thanks that looks like a lot of work. I'll probably accept it within the next day or two. One thing that I noticed was that you added nodejs to the system package list but it is already being installed from source.



44.7k

Hey, so by "get it running" do you mean to have the Dockerfile completely setup the environment and to start all of the servers? If that is what you are referring to then Webird does in fact have an incomplete Docker implementation. I primarily used it to repeatedly test the provision script to work that out and I think that Docker is by far the best tool for that purpose. If you really want to test Webird in a complete system then you will need to use a cheap $5 VPS, use Virtualbox or complete the Dockerfile.

Additionally with a VM the ./setup/* code does a whole lot but you will still need to be following instructions on the README.

My rationale is that I don't have experience actually running Dockerized applications and at that level it is going to be such a custom architecture that everyone will be needing to decide how Webird is divided. For example it seems like one type of container runs the database, another runs the web server, another is storage, etc. Sorry about any confusion there.



44.7k

Also perhaps the Dockerfile should have a comment on it that everything is installed and that it is now up to the developer to turn services on and to configure the architecture.

edited Dec '15

you added nodejs to the system package list but it is already being installed from source.

I was stucking at the nodejs installation. Later i get the problem: wrong version number in 20-node.sh. I have kicked at now from the package list. (new commit)

Hey, so by "get it running" do you mean to have the Dockerfile completely setup the environment and to start all of the servers?

No, sorry. The installation seems to be successfull until setting a new password in "95-service-configure.sh"

If you really want to test Webird in a complete system then you will need to use a cheap $5 VPS, use Virtualbox or complete the Dockerfile.

The new Docker Toolbox installation with docker-compose is really an easy way to install such an environment. I am not a pro in such thing, but I use now docker to create development and distribution environments on my windows system.

a custom architecture that everyone will be needing to decide how Webird is divided. For example it seems like one type of container runs the database, another runs the web server, another is storage, etc.

Docker Compose is the perfect tool for it. I added a docker-compose.yml file from an other project that reflects this concept.

Also perhaps the Dockerfile should have a comment on it that everything is installed and that it is now up to the developer to turn services on and to configure the architecture.

I am not sure about that. At the end, a complete docker image should run as expected. For instance, on DockerHub you automatic build docker images by linked repositories. Building an architecture is (as I understand this) something that you do with environment variables (while starting the docker container) and of course docker compose. Check out comp-install.sh. (new commit)



44.7k

I'll read up on Docker Compose tomorrow.



44.7k

Create a pull request and I'll accept it. I only have two very minor issues with the code that are not worth holding up anything on. I'd like to see some tabs changed to two spaces and then somehow getColorStyleBackground.sh put somewhere deeper into the setup directory. For this something can be thought of later.

I suppose that this Docker work needs a bit of documentation either in the README or ./docs.

So I'll let you pave the way with finishing the Docker support and when you think that it is worked out then I'll give it a go based upon some instructions to see if I can work through it without issues. Then I think that would be worthy of a new tagged alpha release.



44.7k

@JanOschii did you survive the holidays? How is the project going?