Code Monkey home page Code Monkey logo

lamp's Introduction

lamp

A Dockerised LAMP stack

If you've never used Docker before, see the instructions below.code

setup

There is a placeholder public/index.php in the code directory, from which Apache serves your site. You can delete that, and drop in (or symlink) your existing projects into the code directory.

If you are using the feature/react branch of this repository, note that the PHP code will go in code/backend and not just code, and the react app will go in code/frontend.

starting the server

Simply cd into the folder you cloned into and type

bin/start

Apache logs etc will scroll by, leave this terminal open while you do your work.

You can browse to https://localhost, or https://awesome.scot (if you added to your /etc/hosts, see below, you can customise this domain)

running CLI commands

To run commands such as composer from the terminal that are in your Docker box, you can use the run command:

bin/run composer install

To run npm or npx from the node container you can call runnode:

runnode npm ci --save-all

If you would like to enter the container and run commands from inside, you can type:

bin/terminal [service]

To restart any service, call the following:

bin/restart [service]

If you change the docker config (see belw), you can quickly rebuild using this:

bin/rebuild

Finally, there is an empty script which you can use to perform any of your initial setup tasks, typical examples could include running composer install, performing database migrations, populating fixtures, and warming up caches.

bin/init

stopping the server

When you are finished your work, you can close any bash terminals down until you are left with the one running the server and displaying the logs. Press CTRL-C to quit, then run the following to tidy up.

bin/stop

virtual host

Apache is set up to serve awesome.scot with a self signed SSL certificate in your browser (or you can change the name in docker-compose.yml and rebuild) Edit your /etc/hosts file on your computer (C:\Windows\system32\drivers\etc\hosts on Windows), adding this line:

127.0.0.1 awesome.scot

customising the setup

You customise the setup if you need to. PHP and Apache Dockerfiles can be found in the build folder.

You will notice a file named ssmtp.conf. This LAMP stack uses Mailhog, so you can check all would-have-been-sent emails by going to awesome.scot:8025.

There is a .env file which you add to

When connecting to the dev DB from php, the MySQL host should be set to mariadb and not 127.0.0.1 or localhost.

Now you've configured your stuff, we use Docker's compose command to build it first. This is a one off again.

bin/rebuild

After which, we can just tell it bin/start.

handy tip

A handy tip, if you edit your ~/.bashrc, you should add the following line:

export PATH=$PATH:bin:vendor/bin

This is also in the PHP container. It allows you to run a command without putting bin/ or vendor/bin before it.

vendor/bin/phpunit     // without $PATH export 
phpunit                // with $PATH export 
                       
bin/start              // without $PATH export
start                  // with $PATH export   

lamp's People

Contributors

delboy1978uk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

lamp's Issues

update xdebug ini settings for PHP 8

Xdebug: [Config] The setting 'xdebug.default_enable' has been renamed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-xdebug.default_enable (See: https://xdebug.org/docs/errors#CFG-C-CHANGED)
Xdebug: [Config] The setting 'xdebug.remote_autostart' has been renamed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-xdebug.remote_autostart (See: https://xdebug.org/docs/errors#CFG-C-CHANGED)
Xdebug: [Config] The setting 'xdebug.remote_connect_back' has been renamed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-xdebug.remote_connect_back (See: https://xdebug.org/docs/errors#CFG-C-CHANGED)
Xdebug: [Config] The setting 'xdebug.remote_enable' has been renamed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-xdebug.remote_enable (See: https://xdebug.org/docs/errors#CFG-C-CHANGED)
Xdebug: [Config] The setting 'xdebug.remote_port' has been renamed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-xdebug.remote_port (See: https://xdebug.org/docs/errors#CFG-C-CHANGED)

install unzip

Composer warning

As there is no 'unzip' command installed zip files are being unpacked using the PHP zip extension.
This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.
Installing 'unzip' may remediate them.

FYI for Windows users, change EOL characters

In Windows OS using WSL, to run the bash commands like bin/start those scripts need to be LF end of line characters. The problem is that Windows will clone the GitHub repository code as CRLF line ending (which is a pain to resolve without a script). I use find . -type f -print0 | xargs -0 dos2unix -ic0 | xargs -0 dos2unix -b to automatically switch the EOL characters to LF.

add node image and runyarn/runnpm commands

i'm stuck debugging webpack in work, so i want to isolate what im working on, so i nead a node image. plus it would be cool to integrate webpack in bone framework in the future.

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.