Deploy php application using Mina

Andrey Eremin
2 min readJun 15, 2016

All means are good when it comes to deliver final product fast while keeping sustainable quality. Sometimes that may result in strange combinations of various technologies, programming languages and frameworks. That is what happened to me. It was the time when the world went crazy from blazing ReactJs. I had to setup a forum system that worked with existing at that time ruby-powered website. To tell the truth, that was pretty interesting experience that probably will not give me anything in the future, but at least this gave the birth to this post.

I am a ruby developer and i am too lazy to put my hands deep enough into PHP world. I would rather prefer doing PHP staff using familiar ruby tools. That is what i did with deployment of the forum. I used phpBB by the way. Why? Just because i worked with this engine long time ago and there were no particular requirements from the customer. Anyway. Since i already used Mina to deploy a ruby-powered website, that was obvious to use this tiny cute library to deploy phpBB as well.

Although it may sound quite an easy task, i found some non-trivial obstacles that i had to overcome. Lets start with directory structure. phpBB is not a rails app. Thanks cap. It has some quite different philosophy of where to put what, so we need to create 3 so called shared folders:

shared/cache
shared/files
shared/images/upload_icons

Next step will be to set proper ‘current path‘ variable:

set :current_path, ‘htdocs’

Basically here we just adjust rails to apache reality. If you are brave enough to configure Apache you may change this ugly htdocs to something more pleasing to your eyes. Finally we just need to define proper tasks for deployment process:

desc “Deploys the current version to the server.”
task :deploy => :environment do
deploy do
invoke :’git:clone’
invoke :’deploy:link_shared_paths’
invoke :’deploy:cleanup’
end
end

You can find complete version of mina configuration in my gist. This is not a rocket science, however doing this for the first time, especially not setting foot on this ground for a long time, can be quite a tricky task. Hope this will save someone’s nerves. Good luck.

Originally published at code.aeremin.ru on June 15, 2016.

--

--

Andrey Eremin

Software Engineer. Write about Ruby, Python, Deep Learning and life