Hello world!

While I was exploring Laravel Framework to learn about its new features, to use it in one of my small projects, I got this idea to transform my website to use Laravel, instead of just HTML, to add some dynamic content (even though the website as it stood was doing its job as business card 😀 ) However the engineer in me wanted something more.  So I decided to host my own website and to try for at least once the hassle of DevOps. 

The previous version of my website was hosted on some hosting provider, and the hosting was expiring soon anyway, so I headed to Scaleway and I got my self the starter plan (for €3/month) which is a great deal :

  • 2 x86 64Bit Cores
  • 2GB RAM
  • 50GB SSD
  • A public IP and unlimited bandwidth.

I don’t think I would need more than that for hosting a small web site, like mine 🙂

Then, I bought a new domain name, that identifies me better than the previous one, I bought the name from bookmyname.com, which also provides very nice services for reasonable prices.

After buying the necessary tools, I am ready to start my mission!

I started by transforming the HTML to PHP Blade  (blade is the templating  engine used in Laravel Framework). After verifying that everything was working fine in my local machine, I moved to the next step, deployment.

To get smooth deployment experience, I used Docker on both my local and server machines. Why Docker? just to avoid the differences between development, and production environment, what works in Docker containers locally MUST work in production’s Docker containers. To achieve this, I found my ultimate docker solution Laradock which is a great set of configurations to run a lot of services in Docker (including but not limited to: Laravel, MySQL, and so on…)

Major Blockings

While migrating to my own hosting, I encountered many issues, which made me scratch my head! In this section I list some of these issues:

  • Running MySQL inside docker containers and letting the Application container connect to it. Basically, the trick here is to define the bind-address of the mysql server to be all zeros (0.0.0.0) which will allow any host to connect to it, but don’t forget to disable docker’s port forwarding for MySQL to restrict external access like (ahmadhajjar.me:3306)
  • Hosting WordPress Blog (this blog) with Laravel application (the website). I had to do couple of  things:
    •  Install WordPress inside Laravel’s public directory. In a directory I called blog.
    • Change nginx config to be able to access the wordpress installation (insde Laravel). By adding the following couple of lines to the default config file: %CODE1%
    • Change wp-content directory permission to be readable by nginx server.

Future Work

It can be a nice weekend project to add Jenkins support to the server, where I can change my website anywhere and push it to the git repository and then get Jenkins to handle the rest .

Leave a Reply

Your email address will not be published. Required fields are marked *