Giter Club home page Giter Club logo

lampvsdocker's Introduction

LAMP vs Docker

Hosting a Laravel site in windows on a fresh Ubuntu 18.04 Server in VirtualBox.

Setup

Installing docker is explained here.
Hosting a simple site with docker is explained here.
Hosting a simple site and setting up a lamp server here.

The real test will be to set up a laravel site

  1. How easy it is to set up
  2. How easy it is to add a new site
  3. How fast is is to add a new site

Docker

Devilbox

I will use devilbox, a pre made LAMP stack to try and host my Laravel website.

Since I'm only using a 10GB virtual drive for my linux server, I can't start all the containers it provides. But for hosting a laravel website I'll only need httpd, php and mysql.

  • git clone https://github.com/cytopia/devilbox
  • cd devilbox cp env-example .env
  • docker-compose up -d httpd php mysql
    • first time setup 4 min
    • once the images are loaded

Installing my Laravel website

  • Enter the php shell so we have access to composer etc ./shell.sh
  • Make a folder, enter the folder and git clone your project in there. Mine is called wedstrijd.
  • Enter the laravel project and composer install. This took 18s65.
  • To make a database we can surf to the ip of our server and just use phpmyadmin out of the box.
  • The root folder is always /htdocs. So make a symbolic link from the public folder to htdos. ln -s wedstrijd/public/ htdocs
  • To make the host we have to edit /etc/hosts on windows. The generated path is wedstrijd.loc. e.g. 192.168.0.110 wedstrijd.loc

LAMP

We will need to install all packages needed to host laravel ourselves.

Composer

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

To add it to our bin we use mv composer.phar /usr/local/bin/composer

Now just install laravel and add the Vhost.

Conclusion

The regular LAMP way still works but is not always as easy to configure because of Ubuntu updates etc, while docker images run their own version of ubuntu where everything will always work. Docker makes it easier to dispose of a website and you can use docker without a VM aswell. Docker is more complex but if Devilbox keeps its images updated then it's a great way to get started really fast.

lampvsdocker's People

Contributors

jordypereira avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.