Devilbox Documentation Release 1.0
Total Page:16
File Type:pdf, Size:1020Kb
Devilbox Documentation Release 1.0 cytopia Jul 24, 2018 Contents 1 Read first 3 1.1 Shell commands.............................................3 1.2 Examples.................................................3 1.3 Checklists................................................3 1.4 Where to start?..............................................4 2 Features 5 2.1 Projects..................................................6 2.2 Service and version choice........................................7 2.3 Configuration...............................................7 2.4 Intranet..................................................8 2.5 Dockerized................................................8 2.6 Others..................................................8 3 Devilbox purpose 11 3.1 Why did I built this?........................................... 11 3.2 Automation is key............................................ 11 3.3 Issues with Docker encountered..................................... 12 3.4 Today’s state............................................... 12 3.5 Tomorrow’s state............................................. 12 4 Prerequisites 13 4.1 Supported host OS............................................ 14 4.2 Required software............................................ 14 4.3 Docker installation............................................ 15 4.4 Post installation............................................. 17 4.5 Optional previous knowledge...................................... 17 5 Install the Devilbox 19 5.1 Download the Devilbox......................................... 19 5.2 Create .env file............................................. 20 5.3 Set uid and gid.............................................. 20 5.4 Checklist................................................. 21 6 Start the Devilbox 23 6.1 The Devilbox startup explained..................................... 23 6.2 Start all container............................................. 24 i 6.3 Start some container........................................... 24 6.4 Open Devilbox intranet......................................... 25 6.5 Checklist................................................. 26 7 Devilbox intranet 27 7.1 Devilbox tools.............................................. 28 7.2 Third-party tools............................................. 28 7.3 Settings.................................................. 30 7.4 Checklist................................................. 32 8 Directory overview 35 8.1 Data directory.............................................. 35 8.2 Project directory............................................. 36 8.3 Docroot directory............................................. 36 8.4 Domain suffix.............................................. 36 8.5 Making sense of it............................................ 36 8.6 Checklist................................................. 37 9 Create your first project 39 9.1 Step 1: visit Intranet vhost page..................................... 39 9.2 Step 2: create a project directory..................................... 40 9.3 Step 3: create a docroot directory.................................... 40 9.4 Step 4: create a DNS entry........................................ 42 9.5 Step 5: visit your project......................................... 42 9.6 Step 6: create a hello world file..................................... 43 9.7 Checklist................................................. 44 9.8 Further examples............................................. 44 10 Enter the PHP container 45 10.1 How to enter............................................... 45 10.2 How to become root........................................... 46 10.3 Tools................................................... 46 10.4 Advanced................................................. 47 10.5 Checklist................................................. 47 11 Change container versions 49 11.1 Implications............................................... 50 11.2 Examples................................................. 50 11.3 Gotchas.................................................. 53 11.4 Checklist................................................. 53 12 Setup Auto DNS 55 12.1 Native Docker.............................................. 55 12.2 Docker Toolbox............................................. 57 13 Setup valid HTTPS 59 13.1 TL;DR.................................................. 59 13.2 How does it work............................................. 60 13.3 Import the CA into your browser.................................... 60 13.4 Further Reading............................................. 61 14 Configure PHP Xdebug 69 14.1 Introduction............................................... 69 14.2 Configure PHP container for Xdebug.................................. 70 14.3 Configure your IDE/editor for Xdebug................................. 80 ii 15 Enable/disable PHP modules 89 15.1 Enabled PHP modules.......................................... 89 15.2 Disable PHP modules.......................................... 90 15.3 Roadmap................................................. 90 16 Read log files 91 16.1 Mounted logs............................................... 91 16.2 Docker logs................................................ 92 16.3 Checklist................................................. 92 17 Email catch-all 93 18 Add custom environment variables 95 18.1 Add custom environment variables................................... 95 18.2 Use custom environment variables.................................... 96 19 Work inside the PHP container 97 19.1 Enter the container............................................ 98 19.2 Inside the container............................................ 98 19.3 Leave the container............................................ 99 19.4 Host to Container mappings....................................... 99 19.5 Checklist................................................. 101 20 Source Code Analysis 103 20.1 Awesome-ci............................................... 103 20.2 PHPCS.................................................. 104 20.3 ESLint.................................................. 104 21 Best practice 107 21.1 Move data out of Devilbox directory................................... 107 21.2 PHP project hostname settings...................................... 110 21.3 Timezone................................................. 110 22 Customize PHP globally 113 22.1 Configure PHP settings globally..................................... 113 22.2 Configure non-overwritable settings globally.............................. 114 22.3 Configure loaded PHP modules..................................... 114 22.4 Configure PHP-FPM service....................................... 114 23 Customize web server globally 115 23.1 Configure Apache............................................ 115 23.2 Configure Nginx............................................. 115 23.3 Devilbox specific settings........................................ 116 24 Connect to host OS 117 24.1 Prerequisites............................................... 117 24.2 Docker on Linux............................................. 118 24.3 Docker for Mac.............................................. 118 24.4 Docker for Windows........................................... 118 24.5 Docker Toolbox............................................. 119 25 Connect to other Docker container 121 25.1 Any Docker container on host os.................................... 121 25.2 Add Docker container to Devilbox network............................... 122 25.3 Add Docker container to Devilbox stack................................ 122 iii 26 Connect to external hosts 123 27 Add custom CNAME DNS entries 125 27.1 Why and what?.............................................. 125 27.2 How?................................................... 125 28 Add your own Docker image 127 28.1 Prerequisites............................................... 127 28.2 What information do you need?..................................... 128 28.3 How to add a new service?........................................ 128 28.4 How to start the new service?...................................... 130 28.5 Further reading.............................................. 130 29 Overwrite existing Docker image 131 29.1 Prerequisites............................................... 131 29.2 What information do you need?..................................... 131 29.3 How to overwrite a service?....................................... 132 29.4 Further reading.............................................. 133 30 Customize specific virtual host 135 30.1 vhost-gen................................................. 136 30.2 Templates explained........................................... 138 30.3 Apply Changes.............................................. 141 30.4 Further readings............................................. 142 31 Example: add sub domains 143 31.1 Single sub domain for one project.................................... 144 31.2 Multiple sub domains for one project.................................. 144 32 Shared Devilbox server in LAN 153 32.1 Prerequisites............................................... 154 32.2 Project access............................................... 154 32.3 Handle DNS records........................................... 155 32.4 Share Devilbox CA............................................ 157 33 Use external databases 159 33.1 Why................................................... 159 33.2 Database on host os..........................................