This repository is a setup for working on a development machine and you want to run on docker. It's mostly build on the edge version of Alpine Linux. If you are a developer looking into this repo and don't own a Mac, hmm.. don't know if it's going to work right out of the box. PR's are appreciated!
I set it up for the Automotivated projects Automotivated.vroom( ) and Automotivated.engine( ), but kept it general so others can enjoy my effort.
It contains setups for the following containers:
apache
mysql
nginx
php
elasticsearch
Put on some nice Electro Swing and make sure you got the following applications installed:
You can validate it by running docker -v in your favorite (fish || zsh) flavoured (oh-my-fish || oh-my-zsh) terminal (iterm).
It should output something like: Docker version 17.03.0-ce, build 60ccb22
First get the necessary files by cloning this repository:
git clone https://github.com/Automotivated/development.gitThis repository comes with a script that can handle all important stuff! Sweet!
Just open your terminal and go to the root of this project. If you're using fish, prefix /bin/sh
/bin/sh run.sh install
If you somehow forget the install argument, the script will print out the help. Also available under run.sh -h or run.sh --help
Usage: run.sh COMMAND
Options:
-h, --help Will print this message
-v, --verbose Will output everything
-f, --force-recreate Force recreation
-b, --build Force rebuild of dockers
Commands:
install Start a fresh installation
add Add a new domain / project
up Will bring the services up
down Shutsdown all services
ssh Directly login to the php container
The installation will ask you some questions and if you fill them in correctly you'll end up with an .config and .env
The .config is for future reference and the .env is a default docker compose environment file.
You can change the contents of the .env to your own likings, but please be advised that the run script is depending on it!
When you run the fresh install, it will automatically fire up the add project procedure. You can offcourse as many projects as you like. To add a project simply run:
/bin/sh run.sh addThis setup will follow a few important rules! First, the created folder structure will be named to the domainname you filled in in the process.
All generated config files point to that directory and the script will add that domainname to the /etc/hosts file. So it's good practice to keep it like a real tld: my-awesome-project.local or my-awesome-project.dev
Your freshly squeezed project will be available under that domain and you find your files in: projects/my-awesome-project.dev See chapter 2 for existing projects.
This shouldn't be that hard!
/bin/sh run.sh up
Want to know what's happening in the background or do some troubleshooting? Just add the -v flag for some verbose output.
Now, just navigate to: http://127.0.0.1 or your chosen domainname. You should see the default server is up page.
If something already runs on port 80, shut that down!
Mostly we should login to the php container for example, run the bin/console or composer commands
/bin/sh run.sh ssh
You can always use the docker commands, therefore replace <container> with your own project name followed by _php_1 (if you want to login to the php container)
docker exec -it <container> /bin/sh
Offcourse you already have a project loaded into somesort of git repository. To make this work, follow these steps.
- Add project like described in chapter 1.2
- Clone the root of your project into the created folder
- Fix any bugs like vhosts settings
Okay, so you're a badass! Good for you! Get to know docker compose and use this repo as a guideline.
Make sure to create a valid docker-compose.yml or use the -f operator like we do in the run.sh.
Make your changes..
Create a Pull request
Fingers crossed it get's merged
- Mysql available over the network