Compare commits
118 Commits
Author | SHA1 | Date | |
---|---|---|---|
b0831240b1 | |||
37dee56bb7 | |||
2b11fc2299 | |||
754ca4cd4f | |||
10e3dc16d2 | |||
e23c6dae90 | |||
96c1d7c59c | |||
c574943e16 | |||
3226206267 | |||
63543b890a | |||
b58f859eff | |||
170a1efeb1 | |||
50e3d1667f | |||
269732d8ea | |||
a11206d4ba | |||
cb78a6c3d6 | |||
662280c139 | |||
68dd2fd019 | |||
c193c5d03b | |||
4efb5b43c6 | |||
3d2eb81cd5 | |||
a8d7937889 | |||
98c9fdff24 | |||
f05512fd1d | |||
fc460f9497 | |||
1fd55d98e1 | |||
4f5746f2a7 | |||
3d90a806fa | |||
cf9abcd5b8 | |||
e1036185ae | |||
d1af24736b | |||
236665d7d3 | |||
c340d851d3 | |||
38545cfffd | |||
bf19ecffcb | |||
6fa6d02360 | |||
e588f261f8 | |||
5d5545ec9e | |||
d152050e29 | |||
a0da2c0ea0 | |||
2e86243d88 | |||
6b61c7d454 | |||
3881a5d66d | |||
69b223a370 | |||
894cb6ea27 | |||
b81e3e8f15 | |||
7d49f9b820 | |||
9dad1586af | |||
d60178f598 | |||
5d74e10b08 | |||
40422ab4b0 | |||
b35a23d89e | |||
3445b5b1b6 | |||
8315a3872d | |||
6abea8746c | |||
09c5ad273c | |||
99b8a45f3b | |||
4f416da26b | |||
53b73798d3 | |||
c6e9b1ed5d | |||
4973dd93be | |||
9096737aa7 | |||
3429681f2c | |||
d4c727bb2d | |||
1ae104167a | |||
8869b22a1d | |||
1650af04cd | |||
bdcc2adf3f | |||
570be592bb | |||
d94de05fd4 | |||
69c180d2e8 | |||
134911843a | |||
d31ccbd268 | |||
2bbe39cf4a | |||
4588685e97 | |||
4b2ddfad20 | |||
516b148dae | |||
0c53eadf34 | |||
3e61554625 | |||
6054c2d250 | |||
5589a12b9d | |||
e2384e2722 | |||
d077085595 | |||
53f1032975 | |||
875ec23ade | |||
cee9de7ed1 | |||
badad156e1 | |||
8e89725381 | |||
2219177eac | |||
baf29b1223 | |||
5c0933d19a | |||
8de9eca8ae | |||
d172180660 | |||
9f78b17fd1 | |||
f5e33fb396 | |||
9ae6e45dda | |||
94d88e91c5 | |||
8b4901ce57 | |||
08086be4c5 | |||
f2805bca52 | |||
033e1b8721 | |||
9e290ffddb | |||
6ada2f1b91 | |||
c6e393f5ce | |||
4e443cec09 | |||
528b60eb17 | |||
aedc7c8438 | |||
ec4ccb4a20 | |||
c62ce7d36f | |||
8ee2229c84 | |||
cbd3cf7c20 | |||
d505871faf | |||
246814874c | |||
1250668267 | |||
c88e690bb4 | |||
c1de398acc | |||
73f7c88122 | |||
37ed904f1a |
@ -9,4 +9,4 @@ charset = utf-8
|
||||
|
||||
[{Dockerfile,docker-compose.yml}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
indent_size = 2
|
||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
.idea
|
||||
/logs
|
||||
/data
|
||||
.env
|
||||
.env
|
||||
/.project
|
@ -39,14 +39,15 @@ You can request a new feature by submitting an [Issue](https://github.com/larado
|
||||
Laradock uses [Hugo](https://gohugo.io/) as website generator tool, with the [Material Docs theme](http://themes.gohugo.io/theme/material-docs/). You might need to check their docs quickly.
|
||||
|
||||
|
||||
1. Install [Hugo](https://gohugo.io/) on your machine (easy steps).
|
||||
2. Open the `DOCUMENTATION/_settings/content` and search for the markdown file you want to edit (every folder is a section in the menu).
|
||||
3. After done editing, run the this command `hugo` to generate the updated site inside the `docs` folder (It's recommended to delete all files form the `/docs` folder, except the `CNAME` file, before running the `hugo` command).
|
||||
1. Install [Hugo](https://gohugo.io/) on your machine (easy thing).
|
||||
2. Open the `DOCUMENTATION/_settings/content` and search for the markdown file you want to edit (every folder represents a section in the menu).
|
||||
3. Delete the `/docs` folder from the root.
|
||||
4. When you finish editing, run the `hugo` command to generate the HTML docs (in the `/docs`).
|
||||
|
||||
#### To Host the website locally
|
||||
### To Host the website locally
|
||||
Go to `DOCUMENTATION/_settings` in your terminal and run `hugo serve` to host the website locally.
|
||||
|
||||
#### Edit the sidebar
|
||||
### Edit the sidebar
|
||||
To add a new section to the sidebar or edit existing one, you need to edit this file `DOCUMENTATION/_settings/config.toml`.
|
||||
|
||||
|
||||
|
@ -176,6 +176,11 @@ However to view the logs of all the other containers (MySQL, PHP-FPM,...) you ca
|
||||
docker logs {container-name}
|
||||
```
|
||||
|
||||
More [options](https://docs.docker.com/compose/reference/logs/)
|
||||
|
||||
```bash
|
||||
docker logs -f {container-name}
|
||||
```
|
||||
|
||||
|
||||
|
||||
@ -701,6 +706,23 @@ docker-compose up -d mariadb phpmyadmin
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<a name="Use-Adminer"></a>
|
||||
## Use Adminer
|
||||
|
||||
1 - Run the Adminer Container (`adminer`) with the `docker-compose up` command. Example:
|
||||
|
||||
```bash
|
||||
docker-compose up -d adminer
|
||||
```
|
||||
|
||||
2 - Open your browser and visit the localhost on port **8080**: `http://localhost:8080`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<a name="Use-pgAdmin"></a>
|
||||
## Use PgAdmin
|
||||
|
@ -32,7 +32,6 @@ Choose the setup the best suits your needs.
|
||||
|
||||
<a name="A1"></a>
|
||||
### A.1) Already have a PHP project:
|
||||
> (Follow these steps if you already have a PHP project, and all you need is an environment to run it)
|
||||
|
||||
1 - Clone laradock on your project root directory:
|
||||
|
||||
@ -44,22 +43,24 @@ git submodule add https://github.com/Laradock/laradock.git
|
||||
|
||||
- If you are not using Git yet for your project, you can use `git clone` instead of `git submodule `.
|
||||
|
||||
- Note 2: To keep track of your Laradock changes, between your projects and also keep Laradock updated. [Check this](#keep-tracking-Laradock)
|
||||
- Note 2: To keep track of your Laradock changes, between your projects and also keep Laradock updated. [Check this](/documentation/#keep-track-of-your-laradock-changes)
|
||||
|
||||
|
||||
Your folder structure should look like this:
|
||||
|
||||
```
|
||||
- project1
|
||||
- laradock
|
||||
- project2
|
||||
- laradock
|
||||
+ project-a
|
||||
+ laradock-a
|
||||
+ project-b
|
||||
+ laradock-b
|
||||
```
|
||||
|
||||
(It's important to rename the folders differently in each project.)
|
||||
|
||||
> **Now jump to the [Usage](#Usage) section.**
|
||||
|
||||
<a name="A2"></a>
|
||||
### A.2) Don't have a PHP project yet:
|
||||
> (Follow these steps if you don't have a PHP project yet, and you need an environment to create the project)
|
||||
|
||||
1 - Clone this repository anywhere on your machine:
|
||||
|
||||
@ -70,58 +71,58 @@ git clone https://github.com/laradock/laradock.git
|
||||
Your folder structure should look like this:
|
||||
|
||||
```
|
||||
- projects
|
||||
- laradock
|
||||
- myProject
|
||||
+ laradock
|
||||
+ project-z
|
||||
```
|
||||
|
||||
2 - Edit the `docker-compose.yml` file to map to your project directory once you have it (example: `- ../myProject:/var/www`).
|
||||
2 - Edit your web server sites configuration.
|
||||
|
||||
3 - Stop and re-run your docker-compose command for the changes to take place.
|
||||
**In case of NGINX:** open `nginx/sites/default.conf` and change the `root` from `/var/www/public` to `/var/www/{my-project-folder-name}/public`.
|
||||
|
||||
*Or you can keep `default.conf` as it is, and create a separate config `my-site.conf` file for it.*
|
||||
|
||||
**In case of Apache:** :P
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
> **Now jump to the [Usage](#Usage) section.**
|
||||
|
||||
```
|
||||
docker-compose stop && docker-compose up -d XXXX YYYY ZZZZ ....
|
||||
```
|
||||
|
||||
<a name="B"></a>
|
||||
### B) Setup for Multiple Projects:
|
||||
> (Follow these steps if you want a single Docker environment for all project)
|
||||
> (Follow these steps if you want a single Docker environment for all your project)
|
||||
|
||||
1 - Clone this repository anywhere on your machine:
|
||||
1 - Clone this repository anywhere on your machine (similar to [Steps A.2. from above](#A2)):
|
||||
|
||||
```bash
|
||||
git clone https://github.com/laradock/laradock.git
|
||||
```
|
||||
|
||||
2 - Edit the `docker-compose.yml` (or the `.env`) file to map to your projects directories:
|
||||
Your folder structure should look like this:
|
||||
|
||||
```
|
||||
applications:
|
||||
volumes:
|
||||
- ../project1/:/var/www/project1
|
||||
- ../project2/:/var/www/project2
|
||||
+ laradock
|
||||
+ project-1
|
||||
+ project-2
|
||||
```
|
||||
|
||||
3 - You can access all sites by visiting `http://localhost/project1/public` and `http://localhost/project2/public` but of course that's not very useful so let's setup NGINX quickly.
|
||||
2 - Go to `nginx/sites` and create config files to point to different project directory when visiting different domains.
|
||||
|
||||
Laradock by default includes `project-1.conf` and `project-2.conf` as working samples.
|
||||
|
||||
4 - Go to `nginx/sites` and copy `sample.conf.example` to `project1.conf` then to `project2.conf`
|
||||
3 - change the default names `project-n`:
|
||||
|
||||
5 - Open the `project1.conf` file and edit the `server_name` and the `root` as follow:
|
||||
You can rename the config files, project folders and domains as you like, just make sure the `root` in the config files, is pointing to the correct project folder name.
|
||||
|
||||
4 - Add the domains to the **hosts** files.
|
||||
|
||||
```
|
||||
server_name project1.dev;
|
||||
root /var/www/project1/public;
|
||||
```
|
||||
Do the same for each project `project2.conf`, `project3.conf`,...
|
||||
|
||||
6 - Add the domains to the **hosts** files.
|
||||
|
||||
```
|
||||
127.0.0.1 project1.dev
|
||||
127.0.0.1 project-1.dev
|
||||
127.0.0.1 project-2.dev
|
||||
```
|
||||
|
||||
7 - Create your project Databases. Right now you have to do it manually by entering your DB container, until we automate it soon.
|
||||
> **Now jump to the [Usage](#Usage) section.**
|
||||
|
||||
|
||||
|
||||
@ -129,14 +130,15 @@ Do the same for each project `project2.conf`, `project3.conf`,...
|
||||
|
||||
|
||||
|
||||
<a name="Usage"></a>
|
||||
## Usage
|
||||
|
||||
**Read Before starting:**
|
||||
|
||||
If you are using **Docker Toolbox** (VM), do one of the following:
|
||||
|
||||
- Upgrade to Docker [Native](https://www.docker.com/products/docker) for Mac/Windows (Recommended). Check out [Upgrading Laradock](#upgrading-laradock)
|
||||
- Use Laradock v3.* (Visit the `Laradock-ToolBox` [Branch](https://github.com/laradock/laradock/tree/Laradock-ToolBox)).
|
||||
- Upgrade to Docker [Native](https://www.docker.com/products/docker) for Mac/Windows (Recommended). Check out [Upgrading Laradock](/documentation/#upgrading-laradock)
|
||||
- Use Laradock v3.\*. Visit the [LaraDock-ToolBox](https://github.com/laradock/laradock/tree/LaraDock-ToolBox) branch. *(outdated)*
|
||||
|
||||
<br>
|
||||
|
||||
@ -144,10 +146,18 @@ If you are using **Docker Toolbox** (VM), do one of the following:
|
||||
|
||||
<br>
|
||||
|
||||
1 - Run Containers: *(Make sure you are in the `laradock` folder before running the `docker-compose` commands).*
|
||||
1 - Enter the laradock folder and rename `env-example` to `.env`
|
||||
|
||||
```shell
|
||||
cp env-example .env
|
||||
```
|
||||
|
||||
You can edit the `.env` file to chose which software's you want to be installed in your environment. You can always refer to the `docker-compose.yml` file to see how those variables are been used.
|
||||
|
||||
|
||||
**Example:** Running NGINX and MySQL:
|
||||
2 - Build the enviroment and run it using `docker-compose`
|
||||
|
||||
In this example we'll see how to run NGINX (web server) and MySQL (database engine) to host a PHP Web Scripts:
|
||||
|
||||
```bash
|
||||
docker-compose up -d nginx mysql
|
||||
@ -156,21 +166,21 @@ docker-compose up -d nginx mysql
|
||||
**Note**: The `workspace` and `php-fpm` will run automatically in most of the cases, so no need to specify them in the `up` command. If you couldn't find them running then you need specify them as follow: `docker-compose up -d nginx php-fpm mysql workspace`.
|
||||
|
||||
|
||||
You can select your own combination of Containers form the list below:
|
||||
You can select your own combination of containers form the list below:
|
||||
|
||||
`nginx`, `hhvm`, `php-fpm`, `mysql`, `redis`, `postgres`, `mariadb`, `neo4j`, `mongo`, `apache2`, `caddy`, `memcached`, `beanstalkd`, `beanstalkd-console`, `rabbitmq`, `beanstalkd-console`, `workspace`, `phpmyadmin`, `aerospike`, `pgadmin`, `elasticsearch`, `rethinkdb`, `postgres-postgis`, `certbot`, `mailhog`, `minio` and more...!
|
||||
> `nginx`, `hhvm`, `php-fpm`, `mysql`, `redis`, `postgres`, `mariadb`, `neo4j`, `mongo`, `apache2`, `caddy`, `memcached`, `beanstalkd`, `beanstalkd-console`, `rabbitmq`, `beanstalkd-console`, `workspace`, `phpmyadmin`, `adminer`, `aerospike`, `pgadmin`, `elasticsearch`, `rethinkdb`, `postgres-postgis`, `certbot`, `mailhog`, `minio` and more...!
|
||||
|
||||
*(Please note that sometimes we forget to update the docs, so check the `docker-compose.yml` file to see an updated list of all available containers).*
|
||||
|
||||
|
||||
<br>
|
||||
2 - Enter the Workspace container, to execute commands like (Artisan, Composer, PHPUnit, Gulp, ...).
|
||||
3 - Enter the Workspace container, to execute commands like (Artisan, Composer, PHPUnit, Gulp, ...)
|
||||
|
||||
```bash
|
||||
docker-compose exec workspace bash
|
||||
```
|
||||
|
||||
Alternatively, for Windows PowerShell users: execute the following command to enter any running container:
|
||||
*Alternatively, for Windows PowerShell users: execute the following command to enter any running container:*
|
||||
|
||||
```bash
|
||||
docker exec -it {workspace-container-id} bash
|
||||
@ -182,12 +192,12 @@ docker exec -it {workspace-container-id} bash
|
||||
docker-compose exec --user=laradock workspace bash
|
||||
```
|
||||
|
||||
*You can change the PUID (User id) and PGID (group id) variables from the `docker-compose.yml` or the `.env`)*
|
||||
*You can change the PUID (User id) and PGID (group id) variables from the `.env` file)*
|
||||
|
||||
<br>
|
||||
3 - Edit your project configurations.
|
||||
4 - Update your project configurations to use the database host
|
||||
|
||||
Open your `.env` file and set the `DB_HOST` to `mysql`:
|
||||
Open your PHP project's `.env` file or whichever configuration file you are reading from, and set the database host `DB_HOST` to `mysql`:
|
||||
|
||||
```env
|
||||
DB_HOST=mysql
|
||||
@ -196,4 +206,6 @@ DB_HOST=mysql
|
||||
*If you want to install Laravel as PHP project, see [How to Install Laravel in a Docker Container](#Install-Laravel).*
|
||||
|
||||
<br>
|
||||
4 - Open your browser and visit your localhost address `http://localhost/`.
|
||||
5 - Open your browser and visit your localhost address `http://localhost/`. If you followed the multiple projects setup, you can visit `http://project-1.dev/` and `http://project-2.dev/`. But first don't
|
||||
|
||||
|
||||
|
@ -169,6 +169,7 @@ What's better than a **Demo Video**:
|
||||
- RabbitMQ Console
|
||||
- **Tools:**
|
||||
- PhpMyAdmin
|
||||
- Adminer
|
||||
- PgAdmin
|
||||
- ElasticSearch
|
||||
- Selenium
|
||||
|
@ -18,7 +18,9 @@ Laradock is a Docker PHP development environment that facilitate running **PHP**
|
||||
- [Bo-Yi Wu](https://github.com/appleboy) (appleboy) [ [Twitter](https://twitter.com/appleboy) ]
|
||||
- [Philippe Trépanier](https://github.com/philtrep) (philtrep)
|
||||
- [Mike Erickson](https://github.com/mikeerickson) (mikeerickson)
|
||||
- Join Us!
|
||||
- [Dwi Fahni Denni](https://github.com/zeroc0d3) (zeroc0d3)
|
||||
- [Thor Erik](https://github.com/thorerik) (thorerik)
|
||||
- Contribute and join us!
|
||||
|
||||
**Amazing Contributors:**
|
||||
|
||||
|
9
adminer/Dockerfile
Normal file
9
adminer/Dockerfile
Normal file
@ -0,0 +1,9 @@
|
||||
FROM adminer:latest
|
||||
|
||||
MAINTAINER Patrick Artounian <partounian@gmail.com>
|
||||
|
||||
# Add volume for sessions to allow session persistence
|
||||
VOLUME /sessions
|
||||
|
||||
# We expose Adminer on port 8080 (Adminer's default)
|
||||
EXPOSE 8080
|
@ -12,6 +12,8 @@ EXPOSE 80 443
|
||||
|
||||
WORKDIR /var/www/
|
||||
|
||||
ADD vhost.conf /etc/apache2/sites-enabled/vhost.conf
|
||||
|
||||
ENTRYPOINT ["/opt/docker/bin/entrypoint.sh"]
|
||||
|
||||
CMD ["supervisord"]
|
||||
|
3
apache2/sites/.gitignore
vendored
Normal file
3
apache2/sites/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
*.conf
|
||||
!default.conf
|
||||
!default.apache.conf
|
16
apache2/sites/default.apache.conf
Normal file
16
apache2/sites/default.apache.conf
Normal file
@ -0,0 +1,16 @@
|
||||
<VirtualHost *:80>
|
||||
ServerName laradock.dev
|
||||
DocumentRoot /var/www/html/
|
||||
Options Indexes FollowSymLinks
|
||||
|
||||
<Directory "/var/www/html/">
|
||||
AllowOverride All
|
||||
<IfVersion < 2.4>
|
||||
Allow from all
|
||||
</IfVersion>
|
||||
<IfVersion >= 2.4>
|
||||
Require all granted
|
||||
</IfVersion>
|
||||
</Directory>
|
||||
|
||||
</VirtualHost>
|
16
apache2/sites/sample.conf.example
Normal file
16
apache2/sites/sample.conf.example
Normal file
@ -0,0 +1,16 @@
|
||||
<VirtualHost *:80>
|
||||
ServerName sample.dev
|
||||
DocumentRoot /var/www/sample/public/
|
||||
Options Indexes FollowSymLinks
|
||||
|
||||
<Directory "/var/www/sample/public/">
|
||||
AllowOverride All
|
||||
<IfVersion < 2.4>
|
||||
Allow from all
|
||||
</IfVersion>
|
||||
<IfVersion >= 2.4>
|
||||
Require all granted
|
||||
</IfVersion>
|
||||
</Directory>
|
||||
|
||||
</VirtualHost>
|
1
apache2/vhost.conf
Normal file
1
apache2/vhost.conf
Normal file
@ -0,0 +1 @@
|
||||
Include /etc/apache2/sites-available/*.conf
|
@ -1,5 +1,7 @@
|
||||
FROM phusion/baseimage:latest
|
||||
|
||||
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
|
||||
|
||||
COPY run-certbot.sh /root/certbot/run-certbot.sh
|
||||
|
||||
RUN apt-get update
|
||||
|
@ -5,395 +5,553 @@ services:
|
||||
### Applications Code Container #############################
|
||||
|
||||
applications:
|
||||
image: tianon/true
|
||||
volumes:
|
||||
- ${APPLICATION_1}:/var/www
|
||||
image: tianon/true
|
||||
volumes:
|
||||
- ${APPLICATION}:/var/www
|
||||
|
||||
### Workspace Utilities Container ###########################
|
||||
|
||||
workspace:
|
||||
build:
|
||||
context: ./workspace
|
||||
args:
|
||||
- INSTALL_XDEBUG=${WORKSPACE_INSTALL_XDEBUG}
|
||||
- INSTALL_SOAP=${WORKSPACE_INSTALL_SOAP}
|
||||
- INSTALL_MONGO=${WORKSPACE_INSTALL_MONGO}
|
||||
- INSTALL_NODE=${WORKSPACE_INSTALL_NODE}
|
||||
- INSTALL_YARN=${WORKSPACE_INSTALL_YARN}
|
||||
- INSTALL_DRUSH=${WORKSPACE_INSTALL_DRUSH}
|
||||
- INSTALL_AEROSPIKE_EXTENSION=${WORKSPACE_INSTALL_AEROSPIKE_EXTENSION}
|
||||
- INSTALL_V8JS_EXTENSION=${WORKSPACE_INSTALL_INSTALL_V8JS_EXTENSION}
|
||||
- COMPOSER_GLOBAL_INSTALL=${WORKSPACE_COMPOSER_GLOBAL_INSTALL}
|
||||
- INSTALL_WORKSPACE_SSH=${WORKSPACE_INSTALL_WORKSPACE_SSH}
|
||||
- INSTALL_LARAVEL_ENVOY=${WORKSPACE_INSTALL_LARAVEL_ENVOY}
|
||||
- INSTALL_DEPLOYER=${WORKSPACE_INSTALL_LARAVEL_ENVOY}
|
||||
- INSTALL_LINUXBREW=${WORKSPACE_INSTALL_LARAVEL_ENVOY}
|
||||
- INSTALL_MC=${WORKSPACE_INSTALL_MC}
|
||||
- PUID=${WORKSPACE_PUID}
|
||||
- PGID=${WORKSPACE_PGID}
|
||||
- NODE_VERSION=${WORKSPACE_NODE_VERSION}
|
||||
- YARN_VERSION=${WORKSPACE_TIMEZONE}
|
||||
- TZ=${WORKSPACE_TIMEZONE}
|
||||
volumes_from:
|
||||
- applications
|
||||
extra_hosts:
|
||||
- "dockerhost:${DOCKER_HOST_IP}"
|
||||
ports:
|
||||
- "${WORKSPACE_SSH_PORT}:22"
|
||||
tty: true
|
||||
build:
|
||||
context: ./workspace
|
||||
args:
|
||||
- INSTALL_XDEBUG=${WORKSPACE_INSTALL_XDEBUG}
|
||||
- INSTALL_SOAP=${WORKSPACE_INSTALL_SOAP}
|
||||
- INSTALL_MONGO=${WORKSPACE_INSTALL_MONGO}
|
||||
- INSTALL_NODE=${WORKSPACE_INSTALL_NODE}
|
||||
- INSTALL_YARN=${WORKSPACE_INSTALL_YARN}
|
||||
- INSTALL_DRUSH=${WORKSPACE_INSTALL_DRUSH}
|
||||
- INSTALL_AEROSPIKE_EXTENSION=${WORKSPACE_INSTALL_AEROSPIKE_EXTENSION}
|
||||
- INSTALL_V8JS_EXTENSION=${WORKSPACE_INSTALL_INSTALL_V8JS_EXTENSION}
|
||||
- COMPOSER_GLOBAL_INSTALL=${WORKSPACE_COMPOSER_GLOBAL_INSTALL}
|
||||
- INSTALL_WORKSPACE_SSH=${WORKSPACE_INSTALL_WORKSPACE_SSH}
|
||||
- INSTALL_LARAVEL_ENVOY=${WORKSPACE_INSTALL_LARAVEL_ENVOY}
|
||||
- INSTALL_DEPLOYER=${WORKSPACE_INSTALL_LARAVEL_ENVOY}
|
||||
- INSTALL_LINUXBREW=${WORKSPACE_INSTALL_LARAVEL_ENVOY}
|
||||
- INSTALL_MC=${WORKSPACE_INSTALL_MC}
|
||||
- PUID=${WORKSPACE_PUID}
|
||||
- PGID=${WORKSPACE_PGID}
|
||||
- NODE_VERSION=${WORKSPACE_NODE_VERSION}
|
||||
- YARN_VERSION=${WORKSPACE_YARN_VERSION}
|
||||
- TZ=${WORKSPACE_TIMEZONE}
|
||||
volumes_from:
|
||||
- applications
|
||||
extra_hosts:
|
||||
- "dockerhost:${DOCKER_HOST_IP}"
|
||||
ports:
|
||||
- "${WORKSPACE_SSH_PORT}:22"
|
||||
tty: true
|
||||
networks:
|
||||
- frontend
|
||||
- backend
|
||||
|
||||
### PHP-FPM Container #######################################
|
||||
|
||||
php-fpm:
|
||||
build:
|
||||
context: ./php-fpm
|
||||
args:
|
||||
- INSTALL_XDEBUG=${PHP_FPM_INSTALL_XDEBUG}
|
||||
- INSTALL_SOAP=${PHP_FPM_INSTALL_SOAP}
|
||||
- INSTALL_MONGO=${PHP_FPM_INSTALL_MONGO}
|
||||
- INSTALL_ZIP_ARCHIVE=${PHP_FPM_INSTALL_ZIP_ARCHIVE}
|
||||
- INSTALL_BCMATH=${PHP_FPM_INSTALL_BCMATH}
|
||||
- INSTALL_PHPREDIS=${PHP_FPM_INSTALL_PHPREDIS}
|
||||
- INSTALL_MEMCACHED=${PHP_FPM_INSTALL_MEMCACHED}
|
||||
- INSTALL_OPCACHE=${PHP_FPM_INSTALL_OPCACHE}
|
||||
- INSTALL_EXIF=${PHP_FPM_INSTALL_EXIF}
|
||||
- INSTALL_AEROSPIKE_EXTENSION=${PHP_FPM_INSTALL_AEROSPIKE_EXTENSION}
|
||||
- INSTALL_MYSQLI=${PHP_FPM_INSTALL_MYSQLI}
|
||||
- INSTALL_TOKENIZER=${PHP_FPM_INSTALL_TOKENIZER}
|
||||
dockerfile: ${PHP_FPM_DOCKER_FILE}
|
||||
volumes_from:
|
||||
- applications
|
||||
expose:
|
||||
- "9000"
|
||||
depends_on:
|
||||
- workspace
|
||||
extra_hosts:
|
||||
- "dockerhost:${DOCKER_HOST_IP}"
|
||||
environment:
|
||||
- PHP_IDE_CONFIG=${PHP_IDE_CONFIG}
|
||||
build:
|
||||
context: ./php-fpm
|
||||
args:
|
||||
- INSTALL_XDEBUG=${PHP_FPM_INSTALL_XDEBUG}
|
||||
- INSTALL_SOAP=${PHP_FPM_INSTALL_SOAP}
|
||||
- INSTALL_MONGO=${PHP_FPM_INSTALL_MONGO}
|
||||
- INSTALL_ZIP_ARCHIVE=${PHP_FPM_INSTALL_ZIP_ARCHIVE}
|
||||
- INSTALL_BCMATH=${PHP_FPM_INSTALL_BCMATH}
|
||||
- INSTALL_PHPREDIS=${PHP_FPM_INSTALL_PHPREDIS}
|
||||
- INSTALL_MEMCACHED=${PHP_FPM_INSTALL_MEMCACHED}
|
||||
- INSTALL_OPCACHE=${PHP_FPM_INSTALL_OPCACHE}
|
||||
- INSTALL_EXIF=${PHP_FPM_INSTALL_EXIF}
|
||||
- INSTALL_AEROSPIKE_EXTENSION=${PHP_FPM_INSTALL_AEROSPIKE_EXTENSION}
|
||||
- INSTALL_MYSQLI=${PHP_FPM_INSTALL_MYSQLI}
|
||||
- INSTALL_TOKENIZER=${PHP_FPM_INSTALL_TOKENIZER}
|
||||
- INSTALL_INTL=${PHP_FPM_INSTALL_INTL}
|
||||
dockerfile: ${PHP_FPM_DOCKER_FILE}
|
||||
volumes_from:
|
||||
- applications
|
||||
expose:
|
||||
- "9000"
|
||||
depends_on:
|
||||
- workspace
|
||||
extra_hosts:
|
||||
- "dockerhost:${DOCKER_HOST_IP}"
|
||||
environment:
|
||||
- PHP_IDE_CONFIG=${PHP_IDE_CONFIG}
|
||||
networks:
|
||||
- backend
|
||||
|
||||
### PHP Worker Container #####################################
|
||||
php-worker:
|
||||
build:
|
||||
context: ./php-worker
|
||||
volumes_from:
|
||||
- applications
|
||||
depends_on:
|
||||
- workspace
|
||||
networks:
|
||||
- backend
|
||||
|
||||
### Nginx Server Container ##################################
|
||||
|
||||
nginx:
|
||||
build:
|
||||
context: ./nginx
|
||||
args:
|
||||
- PHP_UPSTREAM=php-fpm
|
||||
volumes_from:
|
||||
- applications
|
||||
volumes:
|
||||
- ${NGINX_HOST_LOG_PATH}:/var/log/nginx
|
||||
- ${NGINX_SITES_PATH}:/etc/nginx/sites-available
|
||||
ports:
|
||||
- "${NGINX_HOST_HTTP_PORT}:80"
|
||||
- "${NGINX_HOST_HTTPS_PORT}:443"
|
||||
depends_on:
|
||||
- php-fpm
|
||||
build:
|
||||
context: ./nginx
|
||||
args:
|
||||
- PHP_UPSTREAM=php-fpm
|
||||
volumes_from:
|
||||
- applications
|
||||
volumes:
|
||||
- ${NGINX_HOST_LOG_PATH}:/var/log/nginx
|
||||
- ${NGINX_SITES_PATH}:/etc/nginx/sites-available
|
||||
ports:
|
||||
- "${NGINX_HOST_HTTP_PORT}:80"
|
||||
- "${NGINX_HOST_HTTPS_PORT}:443"
|
||||
depends_on:
|
||||
- php-fpm
|
||||
networks:
|
||||
- frontend
|
||||
- backend
|
||||
|
||||
### Apache Server Container #################################
|
||||
|
||||
apache2:
|
||||
build:
|
||||
context: ./apache2
|
||||
args:
|
||||
- PHP_SOCKET=${PHP_SOCKET}
|
||||
volumes_from:
|
||||
- applications
|
||||
volumes:
|
||||
- ${APACHE_HOST_LOG_PATH}:/var/log/apache2
|
||||
ports:
|
||||
- "${APACHE_HOST_HTTP_PORT}:80"
|
||||
- "${APACHE_HOST_HTTPS_PORT}:443"
|
||||
depends_on:
|
||||
- php-fpm
|
||||
build:
|
||||
context: ./apache2
|
||||
args:
|
||||
- PHP_SOCKET=${PHP_SOCKET}
|
||||
volumes_from:
|
||||
- applications
|
||||
volumes:
|
||||
- ${APACHE_HOST_LOG_PATH}:/var/log/apache2
|
||||
- ./apache2/sites:/etc/apache2/sites-available
|
||||
ports:
|
||||
- "${APACHE_HOST_HTTP_PORT}:80"
|
||||
- "${APACHE_HOST_HTTPS_PORT}:443"
|
||||
depends_on:
|
||||
- php-fpm
|
||||
networks:
|
||||
- frontend
|
||||
- backend
|
||||
|
||||
### HHVM Container ##########################################
|
||||
|
||||
hhvm:
|
||||
build: ./hhvm
|
||||
volumes_from:
|
||||
- applications
|
||||
expose:
|
||||
- "9000"
|
||||
depends_on:
|
||||
- workspace
|
||||
build: ./hhvm
|
||||
volumes_from:
|
||||
- applications
|
||||
expose:
|
||||
- "9000"
|
||||
depends_on:
|
||||
- workspace
|
||||
networks:
|
||||
- frontend
|
||||
- backend
|
||||
|
||||
### Minio Container #########################################
|
||||
|
||||
minio:
|
||||
build: ./minio
|
||||
volumes:
|
||||
- minio:/export
|
||||
ports:
|
||||
- "${MINIO_PORT}:9000"
|
||||
environment:
|
||||
MINIO_ACCESS_KEY: access
|
||||
MINIO_SECRET_KEY: secretkey
|
||||
build: ./minio
|
||||
volumes:
|
||||
- minio:/export
|
||||
ports:
|
||||
- "${MINIO_PORT}:9000"
|
||||
environment:
|
||||
- MINIO_ACCESS_KEY=access
|
||||
- MINIO_SECRET_KEY=secretkey
|
||||
networks:
|
||||
- frontend
|
||||
|
||||
### MySQL Container #########################################
|
||||
|
||||
mysql:
|
||||
build:
|
||||
context: ./mysql
|
||||
args:
|
||||
- MYSQL_DATABASE=${MYSQL_DATABASE}
|
||||
- MYSQL_USER=${MYSQL_USER}
|
||||
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
|
||||
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
|
||||
volumes:
|
||||
- mysql:/var/lib/mysql
|
||||
ports:
|
||||
- "${MYSQL_PORT}:3306"
|
||||
build:
|
||||
context: ./mysql
|
||||
args:
|
||||
- MYSQL_DATABASE=${MYSQL_DATABASE}
|
||||
- MYSQL_USER=${MYSQL_USER}
|
||||
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
|
||||
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
|
||||
volumes:
|
||||
- mysql:/var/lib/mysql
|
||||
ports:
|
||||
- "${MYSQL_PORT}:3306"
|
||||
networks:
|
||||
- backend
|
||||
|
||||
### MSSQL Container #########################################
|
||||
|
||||
mssql:
|
||||
build:
|
||||
context: ./mssql
|
||||
environment:
|
||||
- MSSQL_DATABASE=${MSSQL_DATABASE}
|
||||
- SA_PASSWORD=${MSSQL_PASSWORD}
|
||||
- ACCEPT_EULA=Y
|
||||
volumes:
|
||||
- mssql:/var/opt/mssql
|
||||
ports:
|
||||
- "${MSSQL_PORT}:1433"
|
||||
networks:
|
||||
- backend
|
||||
|
||||
### MariaDB Container #######################################
|
||||
|
||||
mariadb:
|
||||
build: ./mariadb
|
||||
volumes:
|
||||
- mariadb:/var/lib/mysql
|
||||
ports:
|
||||
- "${MARIADB_PORT}:3306"
|
||||
environment:
|
||||
MYSQL_DATABASE: ${MARIADB_DATABASE}
|
||||
MYSQL_USER: ${MARIADB_USER}
|
||||
MYSQL_PASSWORD: ${MARIADB_PASSWORD}
|
||||
MYSQL_ROOT_PASSWORD: ${MARIADB_PORT}
|
||||
build: ./mariadb
|
||||
volumes:
|
||||
- mariadb:/var/lib/mysql
|
||||
ports:
|
||||
- "${MARIADB_PORT}:3306"
|
||||
environment:
|
||||
- MYSQL_DATABASE=${MARIADB_DATABASE}
|
||||
- MYSQL_USER=${MARIADB_USER}
|
||||
- MYSQL_PASSWORD=${MARIADB_PASSWORD}
|
||||
- MYSQL_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD}
|
||||
networks:
|
||||
- backend
|
||||
|
||||
### PostgreSQL Container ####################################
|
||||
|
||||
postgres:
|
||||
build: ./postgres
|
||||
volumes:
|
||||
- postgres:/var/lib/postgresql/data
|
||||
ports:
|
||||
- "${POSTGRES_PORT}:5432"
|
||||
environment:
|
||||
POSTGRES_DB: ${POSTGRES_DB}
|
||||
POSTGRES_USER: ${POSTGRES_USER}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
build: ./postgres
|
||||
volumes:
|
||||
- postgres:/var/lib/postgresql/data
|
||||
ports:
|
||||
- "${POSTGRES_PORT}:5432"
|
||||
environment:
|
||||
- POSTGRES_DB=${POSTGRES_DB}
|
||||
- POSTGRES_USER=${POSTGRES_USER}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||
networks:
|
||||
- backend
|
||||
|
||||
### PostgreSQL PostGis Container ############################
|
||||
|
||||
postgres-postgis:
|
||||
build: ./postgres-postgis
|
||||
volumes:
|
||||
- postgres:/var/lib/postgresql/data
|
||||
ports:
|
||||
- "${POSTGRES_PORT}:5432"
|
||||
environment:
|
||||
POSTGRES_DB: ${POSTGRES_DB}
|
||||
POSTGRES_USER: ${POSTGRES_USER}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
build: ./postgres-postgis
|
||||
volumes:
|
||||
- postgres:/var/lib/postgresql/data
|
||||
ports:
|
||||
- "${POSTGRES_PORT}:5432"
|
||||
environment:
|
||||
- POSTGRES_DB=${POSTGRES_DB}
|
||||
- POSTGRES_USER=${POSTGRES_USER}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||
networks:
|
||||
- backend
|
||||
|
||||
### Neo4j Container #########################################
|
||||
|
||||
neo4j:
|
||||
build: ./neo4j
|
||||
ports:
|
||||
- "7474:7474"
|
||||
- "1337:1337"
|
||||
environment:
|
||||
- NEO4J_AUTH=default:secret
|
||||
volumes:
|
||||
- neo4j:/var/lib/neo4j/data
|
||||
build: ./neo4j
|
||||
ports:
|
||||
- "7474:7474"
|
||||
- "1337:1337"
|
||||
environment:
|
||||
- NEO4J_AUTH=default:secret
|
||||
volumes:
|
||||
- neo4j:/var/lib/neo4j/data
|
||||
networks:
|
||||
- backend
|
||||
|
||||
### MongoDB Container #######################################
|
||||
|
||||
mongo:
|
||||
build: ./mongo
|
||||
ports:
|
||||
- "27017:27017"
|
||||
volumes:
|
||||
- mongo:/data/db
|
||||
build: ./mongo
|
||||
ports:
|
||||
- "27017:27017"
|
||||
volumes:
|
||||
- mongo:/data/db
|
||||
networks:
|
||||
- backend
|
||||
|
||||
### RethinkDB Container #######################################
|
||||
|
||||
rethinkdb:
|
||||
build: ./rethinkdb
|
||||
ports:
|
||||
- "8090:8080"
|
||||
volumes:
|
||||
- rethinkdb:/data/rethinkdb_data
|
||||
build: ./rethinkdb
|
||||
ports:
|
||||
- "8090:8080"
|
||||
volumes:
|
||||
- rethinkdb:/data/rethinkdb_data
|
||||
networks:
|
||||
- backend
|
||||
|
||||
### Redis Container #########################################
|
||||
|
||||
redis:
|
||||
build: ./redis
|
||||
volumes:
|
||||
- redis:/data
|
||||
ports:
|
||||
- "6379:6379"
|
||||
build: ./redis
|
||||
volumes:
|
||||
- redis:/data
|
||||
ports:
|
||||
- "6379:6379"
|
||||
networks:
|
||||
- backend
|
||||
|
||||
### Aerospike c Container ###################################
|
||||
|
||||
aerospike:
|
||||
build: ./aerospike
|
||||
volumes_from:
|
||||
- workspace
|
||||
volumes:
|
||||
- aerospike:/opt/aerospike/data
|
||||
ports:
|
||||
- "3000:3000"
|
||||
- "3001:3001"
|
||||
- "3002:3002"
|
||||
- "3003:3003"
|
||||
|
||||
build: ./aerospike
|
||||
volumes_from:
|
||||
- workspace
|
||||
volumes:
|
||||
- aerospike:/opt/aerospike/data
|
||||
ports:
|
||||
- "3000:3000"
|
||||
- "3001:3001"
|
||||
- "3002:3002"
|
||||
- "3003:3003"
|
||||
networks:
|
||||
- backend
|
||||
|
||||
### Memcached Container #####################################
|
||||
|
||||
memcached:
|
||||
build: ./memcached
|
||||
volumes:
|
||||
- memcached:/var/lib/memcached
|
||||
ports:
|
||||
- "${MEMCACHED_HOST_PORT}:11211"
|
||||
depends_on:
|
||||
- php-fpm
|
||||
build: ./memcached
|
||||
volumes:
|
||||
- memcached:/var/lib/memcached
|
||||
ports:
|
||||
- "${MEMCACHED_HOST_PORT}:11211"
|
||||
depends_on:
|
||||
- php-fpm
|
||||
networks:
|
||||
- backend
|
||||
|
||||
### Beanstalkd Container ####################################
|
||||
|
||||
beanstalkd:
|
||||
build: ./beanstalkd
|
||||
ports:
|
||||
- "${BEANSTALKD_HOST_PORT}:11300"
|
||||
privileged: true
|
||||
depends_on:
|
||||
- php-fpm
|
||||
build: ./beanstalkd
|
||||
ports:
|
||||
- "${BEANSTALKD_HOST_PORT}:11300"
|
||||
privileged: true
|
||||
depends_on:
|
||||
- php-fpm
|
||||
networks:
|
||||
- backend
|
||||
|
||||
### RabbitMQ Container ######################################
|
||||
|
||||
rabbitmq:
|
||||
build: ./rabbitmq
|
||||
ports:
|
||||
- "${RABBITMQ_NODE_HOST_PORT}:5672"
|
||||
- "${RABBITMQ_MANAGEMENT_HTTP_HOST_PORT}:15672"
|
||||
- "${RABBITMQ_MANAGEMENT_HTTPS_HOST_PORT}:15671"
|
||||
privileged: true
|
||||
environment:
|
||||
RABBITMQ_DEFAULT_USER: ${RABBITMQ_DEFAULT_USER}
|
||||
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS}
|
||||
depends_on:
|
||||
- php-fpm
|
||||
build: ./rabbitmq
|
||||
ports:
|
||||
- "${RABBITMQ_NODE_HOST_PORT}:5672"
|
||||
- "${RABBITMQ_MANAGEMENT_HTTP_HOST_PORT}:15672"
|
||||
- "${RABBITMQ_MANAGEMENT_HTTPS_HOST_PORT}:15671"
|
||||
privileged: true
|
||||
environment:
|
||||
- RABBITMQ_DEFAULT_USER=${RABBITMQ_DEFAULT_USER}
|
||||
- RABBITMQ_DEFAULT_PASS=${RABBITMQ_DEFAULT_PASS}
|
||||
depends_on:
|
||||
- php-fpm
|
||||
networks:
|
||||
- backend
|
||||
|
||||
### Beanstalkd Console Container ############################
|
||||
|
||||
beanstalkd-console:
|
||||
build: ./beanstalkd-console
|
||||
ports:
|
||||
- "2080:2080"
|
||||
depends_on:
|
||||
- beanstalkd
|
||||
build: ./beanstalkd-console
|
||||
ports:
|
||||
- "2080:2080"
|
||||
depends_on:
|
||||
- beanstalkd
|
||||
networks:
|
||||
- backend
|
||||
|
||||
### Caddy Server Container ##################################
|
||||
|
||||
caddy:
|
||||
build: ./caddy
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
- "2015:2015"
|
||||
volumes_from:
|
||||
- applications
|
||||
volumes:
|
||||
- ./caddy/Caddyfile:/etc/Caddyfile
|
||||
- ./logs/caddy:/var/log/caddy
|
||||
- caddy:/root/.caddy
|
||||
depends_on:
|
||||
- php-fpm
|
||||
build: ./caddy
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
- "2015:2015"
|
||||
volumes_from:
|
||||
- applications
|
||||
volumes:
|
||||
- ./caddy/Caddyfile:/etc/Caddyfile
|
||||
- ./logs/caddy:/var/log/caddy
|
||||
- caddy:/root/.caddy
|
||||
depends_on:
|
||||
- php-fpm
|
||||
networks:
|
||||
- frontend
|
||||
- backend
|
||||
|
||||
### phpMyAdmin Container ####################################
|
||||
|
||||
phpmyadmin:
|
||||
build: ./phpmyadmin
|
||||
environment:
|
||||
PMA_ARBITRARY: 1
|
||||
MYSQL_USER: ${PMA_USER}
|
||||
MYSQL_PASSWORD: ${PMA_PASSWORD}
|
||||
MYSQL_ROOT_PASSWORD: ${PMA_ROOT_PASSWORD}
|
||||
ports:
|
||||
- "${PMA_PORT}:80"
|
||||
depends_on:
|
||||
- "${PMA_DB_ENGINE}"
|
||||
build: ./phpmyadmin
|
||||
environment:
|
||||
- PMA_ARBITRARY=1
|
||||
- MYSQL_USER=${PMA_USER}
|
||||
- MYSQL_PASSWORD=${PMA_PASSWORD}
|
||||
- MYSQL_ROOT_PASSWORD=${PMA_ROOT_PASSWORD}
|
||||
ports:
|
||||
- "${PMA_PORT}:80"
|
||||
depends_on:
|
||||
- "${PMA_DB_ENGINE}"
|
||||
networks:
|
||||
- frontend
|
||||
|
||||
### Adminer Container ####################################
|
||||
|
||||
adminer:
|
||||
build: ./adminer
|
||||
ports:
|
||||
- "${ADM_PORT}:8080"
|
||||
depends_on:
|
||||
- php-fpm
|
||||
networks:
|
||||
- frontend
|
||||
|
||||
### pgAdmin Container #######################################
|
||||
|
||||
pgadmin:
|
||||
build: ./pgadmin
|
||||
ports:
|
||||
- "5050:5050"
|
||||
depends_on:
|
||||
- postgres
|
||||
build: ./pgadmin
|
||||
ports:
|
||||
- "5050:5050"
|
||||
depends_on:
|
||||
- postgres
|
||||
networks:
|
||||
- frontend
|
||||
|
||||
### ElasticSearch Container #################################
|
||||
|
||||
elasticsearch:
|
||||
build: ./elasticsearch
|
||||
volumes:
|
||||
- elasticsearch-data:/usr/share/elasticsearch/data
|
||||
- elasticsearch-plugins:/usr/share/elasticsearch/plugins
|
||||
ports:
|
||||
- "${ELASTICSEARCH_HOST_HTTP_PORT}:9200"
|
||||
- "${ELASTICSEARCH_HOST_TRANSPORT_PORT}:9300"
|
||||
depends_on:
|
||||
- php-fpm
|
||||
|
||||
build: ./elasticsearch
|
||||
volumes:
|
||||
- elasticsearch-data:/usr/share/elasticsearch/data
|
||||
- elasticsearch-plugins:/usr/share/elasticsearch/plugins
|
||||
ports:
|
||||
- "${ELASTICSEARCH_HOST_HTTP_PORT}:9200"
|
||||
- "${ELASTICSEARCH_HOST_TRANSPORT_PORT}:9300"
|
||||
depends_on:
|
||||
- php-fpm
|
||||
networks:
|
||||
- frontend
|
||||
|
||||
### Certbot Container ##################################
|
||||
|
||||
|
||||
certbot:
|
||||
build:
|
||||
context: ./certbot
|
||||
volumes:
|
||||
- ./data/certbot/certs/:/var/certs
|
||||
- ./certbot/letsencrypt/:/var/www/letsencrypt
|
||||
environment:
|
||||
CN: "fake.domain.com"
|
||||
EMAIL: "fake.email@gmail.com"
|
||||
build:
|
||||
context: ./certbot
|
||||
volumes:
|
||||
- ./data/certbot/certs/:/var/certs
|
||||
- ./certbot/letsencrypt/:/var/www/letsencrypt
|
||||
environment:
|
||||
- CN="fake.domain.com"
|
||||
- EMAIL="fake.email@gmail.com"
|
||||
networks:
|
||||
- frontend
|
||||
|
||||
### Mailhog Container #########################################
|
||||
|
||||
mailhog:
|
||||
build: ./mailhog
|
||||
ports:
|
||||
- "1025:1025"
|
||||
- "8025:8025"
|
||||
build: ./mailhog
|
||||
ports:
|
||||
- "1025:1025"
|
||||
- "8025:8025"
|
||||
networks:
|
||||
- frontend
|
||||
|
||||
### Selenium Container #########################################
|
||||
### Selenium Container ########################################
|
||||
|
||||
selenium:
|
||||
build: ./selenium
|
||||
ports:
|
||||
- "${SELENIUM_PORT}:4444"
|
||||
volumes:
|
||||
- /dev/shm:/dev/shm
|
||||
build: ./selenium
|
||||
ports:
|
||||
- "${SELENIUM_PORT}:4444"
|
||||
volumes:
|
||||
- /dev/shm:/dev/shm
|
||||
networks:
|
||||
- frontend
|
||||
|
||||
### Volumes Setup ###########################################
|
||||
### Varnish Proxy 1 ##########################################
|
||||
|
||||
proxy:
|
||||
build: ./varnish
|
||||
expose:
|
||||
- ${VARNISH_PORT}
|
||||
environment:
|
||||
- VARNISH_CONFIG=${VARNISH_CONFIG}
|
||||
- CACHE_SIZE=${VARNISH_PROXY1_CACHE_SIZE}
|
||||
- VARNISHD_PARAMS=${VARNISHD_PARAMS}
|
||||
- VARNISH_PORT=${VARNISH_PORT}
|
||||
- BACKEND_HOST=${VARNISH_PROXY1_BACKEND_HOST}
|
||||
- BACKEND_PORT=${VARNISH_BACKEND_PORT}
|
||||
- VARNISH_SERVER=${VARNISH_PROXY1_SERVER}
|
||||
links:
|
||||
- workspace
|
||||
networks:
|
||||
- frontend
|
||||
|
||||
### Varnish Proxy 2 ##########################################
|
||||
|
||||
proxy2:
|
||||
build: ./varnish
|
||||
expose:
|
||||
- ${VARNISH_PORT}
|
||||
environment:
|
||||
- VARNISH_CONFIG=${VARNISH_CONFIG}
|
||||
- CACHE_SIZE=${VARNISH_PROXY2_CACHE_SIZE}
|
||||
- VARNISHD_PARAMS=${VARNISHD_PARAMS}
|
||||
- VARNISH_PORT=${VARNISH_PORT}
|
||||
- BACKEND_HOST=${VARNISH_PROXY2_BACKEND_HOST}
|
||||
- BACKEND_PORT=${VARNISH_BACKEND_PORT}
|
||||
- VARNISH_SERVER=${VARNISH_PROXY2_SERVER}
|
||||
links:
|
||||
- workspace
|
||||
networks:
|
||||
- frontend
|
||||
|
||||
### Balancer Haproxy ##########################################
|
||||
|
||||
balancer:
|
||||
build: ./haproxy
|
||||
ports:
|
||||
- "${HAPROXY_HOST_HTTP_PORT}:8085"
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
links:
|
||||
- proxy
|
||||
- proxy2
|
||||
|
||||
### Networks Setup ############################################
|
||||
|
||||
networks:
|
||||
frontend:
|
||||
driver: "bridge"
|
||||
backend:
|
||||
driver: "bridge"
|
||||
|
||||
### Volumes Setup #############################################
|
||||
|
||||
volumes:
|
||||
mysql:
|
||||
driver: "local"
|
||||
postgres:
|
||||
driver: "local"
|
||||
memcached:
|
||||
driver: "local"
|
||||
redis:
|
||||
driver: "local"
|
||||
neo4j:
|
||||
driver: "local"
|
||||
mariadb:
|
||||
driver: "local"
|
||||
mongo:
|
||||
driver: "local"
|
||||
minio:
|
||||
driver: "local"
|
||||
rethinkdb:
|
||||
driver: "local"
|
||||
phpmyadmin:
|
||||
driver: "local"
|
||||
aerospike:
|
||||
driver: "local"
|
||||
caddy:
|
||||
driver: "local"
|
||||
elasticsearch-data:
|
||||
driver: "local"
|
||||
elasticsearch-plugins:
|
||||
driver: "local"
|
||||
mysql:
|
||||
driver: "local"
|
||||
mssql:
|
||||
driver: "local"
|
||||
postgres:
|
||||
driver: "local"
|
||||
memcached:
|
||||
driver: "local"
|
||||
redis:
|
||||
driver: "local"
|
||||
neo4j:
|
||||
driver: "local"
|
||||
mariadb:
|
||||
driver: "local"
|
||||
mongo:
|
||||
driver: "local"
|
||||
minio:
|
||||
driver: "local"
|
||||
rethinkdb:
|
||||
driver: "local"
|
||||
phpmyadmin:
|
||||
driver: "local"
|
||||
adminer:
|
||||
driver: "local"
|
||||
aerospike:
|
||||
driver: "local"
|
||||
caddy:
|
||||
driver: "local"
|
||||
elasticsearch-data:
|
||||
driver: "local"
|
||||
elasticsearch-plugins:
|
||||
driver: "local"
|
||||
|
@ -346,16 +346,17 @@ features, by not reporting duplicate issues.</em></p>
|
||||
<p>Laradock uses <a href="https://gohugo.io/">Hugo</a> as website generator tool, with the <a href="http://themes.gohugo.io/theme/material-docs/">Material Docs theme</a>. You might need to check their docs quickly.</p>
|
||||
|
||||
<ol>
|
||||
<li>Install <a href="https://gohugo.io/">Hugo</a> on your machine (easy steps).</li>
|
||||
<li>Open the <code>DOCUMENTATION/_settings/content</code> and search for the markdown file you want to edit (every folder is a section in the menu).</li>
|
||||
<li>After done editing, run the this command <code>hugo</code> to generate the updated site inside the <code>docs</code> folder (It’s recommended to delete all files form the <code>/docs</code> folder, except the <code>CNAME</code> file, before running the <code>hugo</code> command).</li>
|
||||
<li>Install <a href="https://gohugo.io/">Hugo</a> on your machine (easy thing).</li>
|
||||
<li>Open the <code>DOCUMENTATION/_settings/content</code> and search for the markdown file you want to edit (every folder represents a section in the menu).</li>
|
||||
<li>Delete the <code>/docs</code> folder from the root.</li>
|
||||
<li>When you finish editing, run the <code>hugo</code> command to generate the HTML docs (in the <code>/docs</code>).</li>
|
||||
</ol>
|
||||
|
||||
<h4 id="to-host-the-website-locally">To Host the website locally</h4>
|
||||
<h3 id="to-host-the-website-locally">To Host the website locally</h3>
|
||||
|
||||
<p>Go to <code>DOCUMENTATION/_settings</code> in your terminal and run <code>hugo serve</code> to host the website locally.</p>
|
||||
|
||||
<h4 id="edit-the-sidebar">Edit the sidebar</h4>
|
||||
<h3 id="edit-the-sidebar">Edit the sidebar</h3>
|
||||
|
||||
<p>To add a new section to the sidebar or edit existing one, you need to edit this file <code>DOCUMENTATION/_settings/config.toml</code>.</p>
|
||||
|
||||
|
@ -49,16 +49,17 @@ features, by not reporting duplicate issues.</em></p>
|
||||
<p>Laradock uses <a href="https://gohugo.io/">Hugo</a> as website generator tool, with the <a href="http://themes.gohugo.io/theme/material-docs/">Material Docs theme</a>. You might need to check their docs quickly.</p>
|
||||
|
||||
<ol>
|
||||
<li>Install <a href="https://gohugo.io/">Hugo</a> on your machine (easy steps).</li>
|
||||
<li>Open the <code>DOCUMENTATION/_settings/content</code> and search for the markdown file you want to edit (every folder is a section in the menu).</li>
|
||||
<li>After done editing, run the this command <code>hugo</code> to generate the updated site inside the <code>docs</code> folder (It&rsquo;s recommended to delete all files form the <code>/docs</code> folder, except the <code>CNAME</code> file, before running the <code>hugo</code> command).</li>
|
||||
<li>Install <a href="https://gohugo.io/">Hugo</a> on your machine (easy thing).</li>
|
||||
<li>Open the <code>DOCUMENTATION/_settings/content</code> and search for the markdown file you want to edit (every folder represents a section in the menu).</li>
|
||||
<li>Delete the <code>/docs</code> folder from the root.</li>
|
||||
<li>When you finish editing, run the <code>hugo</code> command to generate the HTML docs (in the <code>/docs</code>).</li>
|
||||
</ol>
|
||||
|
||||
<h4 id="to-host-the-website-locally">To Host the website locally</h4>
|
||||
<h3 id="to-host-the-website-locally">To Host the website locally</h3>
|
||||
|
||||
<p>Go to <code>DOCUMENTATION/_settings</code> in your terminal and run <code>hugo serve</code> to host the website locally.</p>
|
||||
|
||||
<h4 id="edit-the-sidebar">Edit the sidebar</h4>
|
||||
<h3 id="edit-the-sidebar">Edit the sidebar</h3>
|
||||
|
||||
<p>To add a new section to the sidebar or edit existing one, you need to edit this file <code>DOCUMENTATION/_settings/config.toml</code>.</p>
|
||||
|
||||
|
@ -447,6 +447,11 @@ example for <code>mysql</code> it will be <code>mysql/Dockerfile</code>.</p>
|
||||
<pre><code class="language-bash">docker logs {container-name}
|
||||
</code></pre>
|
||||
|
||||
<p>More <a href="https://docs.docker.com/compose/reference/logs/">options</a></p>
|
||||
|
||||
<pre><code class="language-bash">docker logs -f {container-name}
|
||||
</code></pre>
|
||||
|
||||
<p><br>
|
||||
<a name="PHP"></a></p>
|
||||
|
||||
|
@ -150,6 +150,11 @@ example for <code>mysql</code> it will be <code>mysql/Dockerfi
|
||||
<pre><code class="language-bash">docker logs {container-name}
|
||||
</code></pre>
|
||||
|
||||
<p>More <a href="https://docs.docker.com/compose/reference/logs/">options</a></p>
|
||||
|
||||
<pre><code class="language-bash">docker logs -f {container-name}
|
||||
</code></pre>
|
||||
|
||||
<p><br>
|
||||
<a name="PHP"></a></p>
|
||||
|
||||
|
@ -346,10 +346,6 @@
|
||||
|
||||
<h3 id="a-1-already-have-a-php-project">A.1) Already have a PHP project:</h3>
|
||||
|
||||
<blockquote>
|
||||
<p>(Follow these steps if you already have a PHP project, and all you need is an environment to run it)</p>
|
||||
</blockquote>
|
||||
|
||||
<p>1 - Clone laradock on your project root directory:</p>
|
||||
|
||||
<pre><code class="language-bash">git submodule add https://github.com/Laradock/laradock.git
|
||||
@ -365,20 +361,22 @@
|
||||
|
||||
<p>Your folder structure should look like this:</p>
|
||||
|
||||
<pre><code>- project1
|
||||
- laradock
|
||||
- project2
|
||||
- laradock
|
||||
<pre><code>+ project-a
|
||||
+ laradock-a
|
||||
+ project-b
|
||||
+ laradock-b
|
||||
</code></pre>
|
||||
|
||||
<p>(It’s important to rename the folders differently in each project.)</p>
|
||||
|
||||
<blockquote>
|
||||
<p><strong>Now jump to the <a href="#Usage">Usage</a> section.</strong></p>
|
||||
</blockquote>
|
||||
|
||||
<p><a name="A2"></a></p>
|
||||
|
||||
<h3 id="a-2-don-t-have-a-php-project-yet">A.2) Don’t have a PHP project yet:</h3>
|
||||
|
||||
<blockquote>
|
||||
<p>(Follow these steps if you don’t have a PHP project yet, and you need an environment to create the project)</p>
|
||||
</blockquote>
|
||||
|
||||
<p>1 - Clone this repository anywhere on your machine:</p>
|
||||
|
||||
<pre><code class="language-bash">git clone https://github.com/laradock/laradock.git
|
||||
@ -386,57 +384,62 @@
|
||||
|
||||
<p>Your folder structure should look like this:</p>
|
||||
|
||||
<pre><code>- projects
|
||||
- laradock
|
||||
- myProject
|
||||
<pre><code>+ laradock
|
||||
+ project-z
|
||||
</code></pre>
|
||||
|
||||
<p>2 - Edit the <code>docker-compose.yml</code> file to map to your project directory once you have it (example: <code>- ../myProject:/var/www</code>).</p>
|
||||
<p>2 - Edit your web server sites configuration.</p>
|
||||
|
||||
<p>3 - Stop and re-run your docker-compose command for the changes to take place.</p>
|
||||
<p><strong>In case of NGINX:</strong> open <code>nginx/sites/default.conf</code> and change the <code>root</code> from <code>/var/www/public</code> to <code>/var/www/{my-project-folder-name}/public</code>.</p>
|
||||
|
||||
<pre><code>docker-compose stop && docker-compose up -d XXXX YYYY ZZZZ ....
|
||||
</code></pre>
|
||||
<p><em>Or you can keep <code>default.conf</code> as it is, and create a separate config <code>my-site.conf</code> file for it.</em></p>
|
||||
|
||||
<p><strong>In case of Apache:</strong> :P
|
||||
<br></p>
|
||||
|
||||
<blockquote>
|
||||
<p><strong>Now jump to the <a href="#Usage">Usage</a> section.</strong></p>
|
||||
</blockquote>
|
||||
|
||||
<p><a name="B"></a></p>
|
||||
|
||||
<h3 id="b-setup-for-multiple-projects">B) Setup for Multiple Projects:</h3>
|
||||
|
||||
<blockquote>
|
||||
<p>(Follow these steps if you want a single Docker environment for all project)</p>
|
||||
<p>(Follow these steps if you want a single Docker environment for all your project)</p>
|
||||
</blockquote>
|
||||
|
||||
<p>1 - Clone this repository anywhere on your machine:</p>
|
||||
<p>1 - Clone this repository anywhere on your machine (similar to <a href="#A2">Steps A.2. from above</a>):</p>
|
||||
|
||||
<pre><code class="language-bash">git clone https://github.com/laradock/laradock.git
|
||||
</code></pre>
|
||||
|
||||
<p>2 - Edit the <code>docker-compose.yml</code> (or the <code>.env</code>) file to map to your projects directories:</p>
|
||||
<p>Your folder structure should look like this:</p>
|
||||
|
||||
<pre><code> applications:
|
||||
volumes:
|
||||
- ../project1/:/var/www/project1
|
||||
- ../project2/:/var/www/project2
|
||||
<pre><code>+ laradock
|
||||
+ project-1
|
||||
+ project-2
|
||||
</code></pre>
|
||||
|
||||
<p>3 - You can access all sites by visiting <code>http://localhost/project1/public</code> and <code>http://localhost/project2/public</code> but of course that’s not very useful so let’s setup NGINX quickly.</p>
|
||||
<p>2 - Go to <code>nginx/sites</code> and create config files to point to different project directory when visiting different domains.</p>
|
||||
|
||||
<p>4 - Go to <code>nginx/sites</code> and copy <code>sample.conf.example</code> to <code>project1.conf</code> then to <code>project2.conf</code></p>
|
||||
<p>Laradock by default includes <code>project-1.conf</code> and <code>project-2.conf</code> as working samples.</p>
|
||||
|
||||
<p>5 - Open the <code>project1.conf</code> file and edit the <code>server_name</code> and the <code>root</code> as follow:</p>
|
||||
<p>3 - change the default names <code>project-n</code>:</p>
|
||||
|
||||
<pre><code> server_name project1.dev;
|
||||
root /var/www/project1/public;
|
||||
<p>You can rename the config files, project folders and domains as you like, just make sure the <code>root</code> in the config files, is pointing to the correct project folder name.</p>
|
||||
|
||||
<p>4 - Add the domains to the <strong>hosts</strong> files.</p>
|
||||
|
||||
<pre><code>127.0.0.1 project-1.dev
|
||||
127.0.0.1 project-2.dev
|
||||
</code></pre>
|
||||
|
||||
<p>Do the same for each project <code>project2.conf</code>, <code>project3.conf</code>,…</p>
|
||||
<blockquote>
|
||||
<p><strong>Now jump to the <a href="#Usage">Usage</a> section.</strong></p>
|
||||
</blockquote>
|
||||
|
||||
<p>6 - Add the domains to the <strong>hosts</strong> files.</p>
|
||||
|
||||
<pre><code>127.0.0.1 project1.dev
|
||||
</code></pre>
|
||||
|
||||
<p>7 - Create your project Databases. Right now you have to do it manually by entering your DB container, until we automate it soon.</p>
|
||||
<p><a name="Usage"></a></p>
|
||||
|
||||
<h2 id="usage">Usage</h2>
|
||||
|
||||
@ -457,28 +460,37 @@
|
||||
|
||||
<p><br></p>
|
||||
|
||||
<p>1 - Run Containers: <em>(Make sure you are in the <code>laradock</code> folder before running the <code>docker-compose</code> commands).</em></p>
|
||||
<p>1 - Enter the laradock folder and rename <code>env-example</code> to <code>.env</code></p>
|
||||
|
||||
<p><strong>Example:</strong> Running NGINX and MySQL:</p>
|
||||
<pre><code class="language-shell">cp env-example .env
|
||||
</code></pre>
|
||||
|
||||
<p>You can edit the <code>.env</code> file to chose which software’s you want to be installed in your environment. You can always refer to the <code>docker-compose.yml</code> file to see how those variables are been used.</p>
|
||||
|
||||
<p>2 - Build the enviroment and run it using <code>docker-compose</code></p>
|
||||
|
||||
<p>In this example we’ll see how to run NGINX (web server) and MySQL (database engine) to host a PHP Web Scripts:</p>
|
||||
|
||||
<pre><code class="language-bash">docker-compose up -d nginx mysql
|
||||
</code></pre>
|
||||
|
||||
<p><strong>Note</strong>: The <code>workspace</code> and <code>php-fpm</code> will run automatically in most of the cases, so no need to specify them in the <code>up</code> command. If you couldn’t find them running then you need specify them as follow: <code>docker-compose up -d nginx php-fpm mysql workspace</code>.</p>
|
||||
|
||||
<p>You can select your own combination of Containers form the list below:</p>
|
||||
<p>You can select your own combination of containers form the list below:</p>
|
||||
|
||||
<blockquote>
|
||||
<p><code>nginx</code>, <code>hhvm</code>, <code>php-fpm</code>, <code>mysql</code>, <code>redis</code>, <code>postgres</code>, <code>mariadb</code>, <code>neo4j</code>, <code>mongo</code>, <code>apache2</code>, <code>caddy</code>, <code>memcached</code>, <code>beanstalkd</code>, <code>beanstalkd-console</code>, <code>rabbitmq</code>, <code>beanstalkd-console</code>, <code>workspace</code>, <code>phpmyadmin</code>, <code>aerospike</code>, <code>pgadmin</code>, <code>elasticsearch</code>, <code>rethinkdb</code>, <code>postgres-postgis</code>, <code>certbot</code>, <code>mailhog</code>, <code>minio</code> and more…!</p>
|
||||
</blockquote>
|
||||
|
||||
<p><em>(Please note that sometimes we forget to update the docs, so check the <code>docker-compose.yml</code> file to see an updated list of all available containers).</em></p>
|
||||
|
||||
<p><br>
|
||||
2 - Enter the Workspace container, to execute commands like (Artisan, Composer, PHPUnit, Gulp, …).</p>
|
||||
3 - Enter the Workspace container, to execute commands like (Artisan, Composer, PHPUnit, Gulp, …)</p>
|
||||
|
||||
<pre><code class="language-bash">docker-compose exec workspace bash
|
||||
</code></pre>
|
||||
|
||||
<p>Alternatively, for Windows PowerShell users: execute the following command to enter any running container:</p>
|
||||
<p><em>Alternatively, for Windows PowerShell users: execute the following command to enter any running container:</em></p>
|
||||
|
||||
<pre><code class="language-bash">docker exec -it {workspace-container-id} bash
|
||||
</code></pre>
|
||||
@ -488,12 +500,12 @@
|
||||
<pre><code class="language-shell">docker-compose exec --user=laradock workspace bash
|
||||
</code></pre>
|
||||
|
||||
<p><em>You can change the PUID (User id) and PGID (group id) variables from the <code>docker-compose.yml</code> or the <code>.env</code>)</em></p>
|
||||
<p><em>You can change the PUID (User id) and PGID (group id) variables from the <code>.env</code> file)</em></p>
|
||||
|
||||
<p><br>
|
||||
3 - Edit your project configurations.</p>
|
||||
4 - Update your project configurations to use the database host</p>
|
||||
|
||||
<p>Open your <code>.env</code> file and set the <code>DB_HOST</code> to <code>mysql</code>:</p>
|
||||
<p>Open your PHP project’s <code>.env</code> file or whichever configuration file you are reading from, and set the database host <code>DB_HOST</code> to <code>mysql</code>:</p>
|
||||
|
||||
<pre><code class="language-env">DB_HOST=mysql
|
||||
</code></pre>
|
||||
@ -501,7 +513,7 @@
|
||||
<p><em>If you want to install Laravel as PHP project, see <a href="#Install-Laravel">How to Install Laravel in a Docker Container</a>.</em></p>
|
||||
|
||||
<p><br>
|
||||
4 - Open your browser and visit your localhost address <code>http://localhost/</code>.</p>
|
||||
5 - Open your browser and visit your localhost address <code>http://localhost/</code>. If you followed the multiple projects setup, you can visit <code>http://project-1.dev/</code> and <code>http://project-2.dev/</code>. But first don’t</p>
|
||||
|
||||
|
||||
<aside class="copyright" role="note">
|
||||
|
@ -49,10 +49,6 @@
|
||||
|
||||
<h3 id="a-1-already-have-a-php-project">A.1) Already have a PHP project:</h3>
|
||||
|
||||
<blockquote>
|
||||
<p>(Follow these steps if you already have a PHP project, and all you need is an environment to run it)</p>
|
||||
</blockquote>
|
||||
|
||||
<p>1 - Clone laradock on your project root directory:</p>
|
||||
|
||||
<pre><code class="language-bash">git submodule add https://github.com/Laradock/laradock.git
|
||||
@ -68,20 +64,22 @@
|
||||
|
||||
<p>Your folder structure should look like this:</p>
|
||||
|
||||
<pre><code>- project1
|
||||
- laradock
|
||||
- project2
|
||||
- laradock
|
||||
<pre><code>+ project-a
|
||||
+ laradock-a
|
||||
+ project-b
|
||||
+ laradock-b
|
||||
</code></pre>
|
||||
|
||||
<p>(It&rsquo;s important to rename the folders differently in each project.)</p>
|
||||
|
||||
<blockquote>
|
||||
<p><strong>Now jump to the <a href="#Usage">Usage</a> section.</strong></p>
|
||||
</blockquote>
|
||||
|
||||
<p><a name="A2"></a></p>
|
||||
|
||||
<h3 id="a-2-don-t-have-a-php-project-yet">A.2) Don&rsquo;t have a PHP project yet:</h3>
|
||||
|
||||
<blockquote>
|
||||
<p>(Follow these steps if you don&rsquo;t have a PHP project yet, and you need an environment to create the project)</p>
|
||||
</blockquote>
|
||||
|
||||
<p>1 - Clone this repository anywhere on your machine:</p>
|
||||
|
||||
<pre><code class="language-bash">git clone https://github.com/laradock/laradock.git
|
||||
@ -89,57 +87,62 @@
|
||||
|
||||
<p>Your folder structure should look like this:</p>
|
||||
|
||||
<pre><code>- projects
|
||||
- laradock
|
||||
- myProject
|
||||
<pre><code>+ laradock
|
||||
+ project-z
|
||||
</code></pre>
|
||||
|
||||
<p>2 - Edit the <code>docker-compose.yml</code> file to map to your project directory once you have it (example: <code>- ../myProject:/var/www</code>).</p>
|
||||
<p>2 - Edit your web server sites configuration.</p>
|
||||
|
||||
<p>3 - Stop and re-run your docker-compose command for the changes to take place.</p>
|
||||
<p><strong>In case of NGINX:</strong> open <code>nginx/sites/default.conf</code> and change the <code>root</code> from <code>/var/www/public</code> to <code>/var/www/{my-project-folder-name}/public</code>.</p>
|
||||
|
||||
<pre><code>docker-compose stop &amp;&amp; docker-compose up -d XXXX YYYY ZZZZ ....
|
||||
</code></pre>
|
||||
<p><em>Or you can keep <code>default.conf</code> as it is, and create a separate config <code>my-site.conf</code> file for it.</em></p>
|
||||
|
||||
<p><strong>In case of Apache:</strong> :P
|
||||
<br></p>
|
||||
|
||||
<blockquote>
|
||||
<p><strong>Now jump to the <a href="#Usage">Usage</a> section.</strong></p>
|
||||
</blockquote>
|
||||
|
||||
<p><a name="B"></a></p>
|
||||
|
||||
<h3 id="b-setup-for-multiple-projects">B) Setup for Multiple Projects:</h3>
|
||||
|
||||
<blockquote>
|
||||
<p>(Follow these steps if you want a single Docker environment for all project)</p>
|
||||
<p>(Follow these steps if you want a single Docker environment for all your project)</p>
|
||||
</blockquote>
|
||||
|
||||
<p>1 - Clone this repository anywhere on your machine:</p>
|
||||
<p>1 - Clone this repository anywhere on your machine (similar to <a href="#A2">Steps A.2. from above</a>):</p>
|
||||
|
||||
<pre><code class="language-bash">git clone https://github.com/laradock/laradock.git
|
||||
</code></pre>
|
||||
|
||||
<p>2 - Edit the <code>docker-compose.yml</code> (or the <code>.env</code>) file to map to your projects directories:</p>
|
||||
<p>Your folder structure should look like this:</p>
|
||||
|
||||
<pre><code> applications:
|
||||
volumes:
|
||||
- ../project1/:/var/www/project1
|
||||
- ../project2/:/var/www/project2
|
||||
<pre><code>+ laradock
|
||||
+ project-1
|
||||
+ project-2
|
||||
</code></pre>
|
||||
|
||||
<p>3 - You can access all sites by visiting <code>http://localhost/project1/public</code> and <code>http://localhost/project2/public</code> but of course that&rsquo;s not very useful so let&rsquo;s setup NGINX quickly.</p>
|
||||
<p>2 - Go to <code>nginx/sites</code> and create config files to point to different project directory when visiting different domains.</p>
|
||||
|
||||
<p>4 - Go to <code>nginx/sites</code> and copy <code>sample.conf.example</code> to <code>project1.conf</code> then to <code>project2.conf</code></p>
|
||||
<p>Laradock by default includes <code>project-1.conf</code> and <code>project-2.conf</code> as working samples.</p>
|
||||
|
||||
<p>5 - Open the <code>project1.conf</code> file and edit the <code>server_name</code> and the <code>root</code> as follow:</p>
|
||||
<p>3 - change the default names <code>project-n</code>:</p>
|
||||
|
||||
<pre><code> server_name project1.dev;
|
||||
root /var/www/project1/public;
|
||||
<p>You can rename the config files, project folders and domains as you like, just make sure the <code>root</code> in the config files, is pointing to the correct project folder name.</p>
|
||||
|
||||
<p>4 - Add the domains to the <strong>hosts</strong> files.</p>
|
||||
|
||||
<pre><code>127.0.0.1 project-1.dev
|
||||
127.0.0.1 project-2.dev
|
||||
</code></pre>
|
||||
|
||||
<p>Do the same for each project <code>project2.conf</code>, <code>project3.conf</code>,&hellip;</p>
|
||||
<blockquote>
|
||||
<p><strong>Now jump to the <a href="#Usage">Usage</a> section.</strong></p>
|
||||
</blockquote>
|
||||
|
||||
<p>6 - Add the domains to the <strong>hosts</strong> files.</p>
|
||||
|
||||
<pre><code>127.0.0.1 project1.dev
|
||||
</code></pre>
|
||||
|
||||
<p>7 - Create your project Databases. Right now you have to do it manually by entering your DB container, until we automate it soon.</p>
|
||||
<p><a name="Usage"></a></p>
|
||||
|
||||
<h2 id="usage">Usage</h2>
|
||||
|
||||
@ -160,28 +163,37 @@
|
||||
|
||||
<p><br></p>
|
||||
|
||||
<p>1 - Run Containers: <em>(Make sure you are in the <code>laradock</code> folder before running the <code>docker-compose</code> commands).</em></p>
|
||||
<p>1 - Enter the laradock folder and rename <code>env-example</code> to <code>.env</code></p>
|
||||
|
||||
<p><strong>Example:</strong> Running NGINX and MySQL:</p>
|
||||
<pre><code class="language-shell">cp env-example .env
|
||||
</code></pre>
|
||||
|
||||
<p>You can edit the <code>.env</code> file to chose which software&rsquo;s you want to be installed in your environment. You can always refer to the <code>docker-compose.yml</code> file to see how those variables are been used.</p>
|
||||
|
||||
<p>2 - Build the enviroment and run it using <code>docker-compose</code></p>
|
||||
|
||||
<p>In this example we&rsquo;ll see how to run NGINX (web server) and MySQL (database engine) to host a PHP Web Scripts:</p>
|
||||
|
||||
<pre><code class="language-bash">docker-compose up -d nginx mysql
|
||||
</code></pre>
|
||||
|
||||
<p><strong>Note</strong>: The <code>workspace</code> and <code>php-fpm</code> will run automatically in most of the cases, so no need to specify them in the <code>up</code> command. If you couldn&rsquo;t find them running then you need specify them as follow: <code>docker-compose up -d nginx php-fpm mysql workspace</code>.</p>
|
||||
|
||||
<p>You can select your own combination of Containers form the list below:</p>
|
||||
<p>You can select your own combination of containers form the list below:</p>
|
||||
|
||||
<blockquote>
|
||||
<p><code>nginx</code>, <code>hhvm</code>, <code>php-fpm</code>, <code>mysql</code>, <code>redis</code>, <code>postgres</code>, <code>mariadb</code>, <code>neo4j</code>, <code>mongo</code>, <code>apache2</code>, <code>caddy</code>, <code>memcached</code>, <code>beanstalkd</code>, <code>beanstalkd-console</code>, <code>rabbitmq</code>, <code>beanstalkd-console</code>, <code>workspace</code>, <code>phpmyadmin</code>, <code>aerospike</code>, <code>pgadmin</code>, <code>elasticsearch</code>, <code>rethinkdb</code>, <code>postgres-postgis</code>, <code>certbot</code>, <code>mailhog</code>, <code>minio</code> and more&hellip;!</p>
|
||||
</blockquote>
|
||||
|
||||
<p><em>(Please note that sometimes we forget to update the docs, so check the <code>docker-compose.yml</code> file to see an updated list of all available containers).</em></p>
|
||||
|
||||
<p><br>
|
||||
2 - Enter the Workspace container, to execute commands like (Artisan, Composer, PHPUnit, Gulp, &hellip;).</p>
|
||||
3 - Enter the Workspace container, to execute commands like (Artisan, Composer, PHPUnit, Gulp, &hellip;)</p>
|
||||
|
||||
<pre><code class="language-bash">docker-compose exec workspace bash
|
||||
</code></pre>
|
||||
|
||||
<p>Alternatively, for Windows PowerShell users: execute the following command to enter any running container:</p>
|
||||
<p><em>Alternatively, for Windows PowerShell users: execute the following command to enter any running container:</em></p>
|
||||
|
||||
<pre><code class="language-bash">docker exec -it {workspace-container-id} bash
|
||||
</code></pre>
|
||||
@ -191,12 +203,12 @@
|
||||
<pre><code class="language-shell">docker-compose exec --user=laradock workspace bash
|
||||
</code></pre>
|
||||
|
||||
<p><em>You can change the PUID (User id) and PGID (group id) variables from the <code>docker-compose.yml</code> or the <code>.env</code>)</em></p>
|
||||
<p><em>You can change the PUID (User id) and PGID (group id) variables from the <code>.env</code> file)</em></p>
|
||||
|
||||
<p><br>
|
||||
3 - Edit your project configurations.</p>
|
||||
4 - Update your project configurations to use the database host</p>
|
||||
|
||||
<p>Open your <code>.env</code> file and set the <code>DB_HOST</code> to <code>mysql</code>:</p>
|
||||
<p>Open your PHP project&rsquo;s <code>.env</code> file or whichever configuration file you are reading from, and set the database host <code>DB_HOST</code> to <code>mysql</code>:</p>
|
||||
|
||||
<pre><code class="language-env">DB_HOST=mysql
|
||||
</code></pre>
|
||||
@ -204,7 +216,8 @@
|
||||
<p><em>If you want to install Laravel as PHP project, see <a href="#Install-Laravel">How to Install Laravel in a Docker Container</a>.</em></p>
|
||||
|
||||
<p><br>
|
||||
4 - Open your browser and visit your localhost address <code>http://localhost/</code>.</p>
|
||||
5 - Open your browser and visit your localhost address <code>http://localhost/</code>. If you followed the multiple projects setup, you can visit <code>http://project-1.dev/</code> and <code>http://project-2.dev/</code>. But first don&rsquo;t</p>
|
||||
|
||||
</description>
|
||||
</item>
|
||||
|
||||
|
123
docs/index.html
123
docs/index.html
@ -544,10 +544,6 @@ QUEUE_HOST=beanstalkd
|
||||
|
||||
<h3 id="a-1-already-have-a-php-project">A.1) Already have a PHP project:</h3>
|
||||
|
||||
<blockquote>
|
||||
<p>(Follow these steps if you already have a PHP project, and all you need is an environment to run it)</p>
|
||||
</blockquote>
|
||||
|
||||
<p>1 - Clone laradock on your project root directory:</p>
|
||||
|
||||
<pre><code class="language-bash">git submodule add https://github.com/Laradock/laradock.git
|
||||
@ -563,20 +559,22 @@ QUEUE_HOST=beanstalkd
|
||||
|
||||
<p>Your folder structure should look like this:</p>
|
||||
|
||||
<pre><code>- project1
|
||||
- laradock
|
||||
- project2
|
||||
- laradock
|
||||
<pre><code>+ project-a
|
||||
+ laradock-a
|
||||
+ project-b
|
||||
+ laradock-b
|
||||
</code></pre>
|
||||
|
||||
<p>(It’s important to rename the folders differently in each project.)</p>
|
||||
|
||||
<blockquote>
|
||||
<p><strong>Now jump to the <a href="#Usage">Usage</a> section.</strong></p>
|
||||
</blockquote>
|
||||
|
||||
<p><a name="A2"></a></p>
|
||||
|
||||
<h3 id="a-2-don-t-have-a-php-project-yet">A.2) Don’t have a PHP project yet:</h3>
|
||||
|
||||
<blockquote>
|
||||
<p>(Follow these steps if you don’t have a PHP project yet, and you need an environment to create the project)</p>
|
||||
</blockquote>
|
||||
|
||||
<p>1 - Clone this repository anywhere on your machine:</p>
|
||||
|
||||
<pre><code class="language-bash">git clone https://github.com/laradock/laradock.git
|
||||
@ -584,57 +582,62 @@ QUEUE_HOST=beanstalkd
|
||||
|
||||
<p>Your folder structure should look like this:</p>
|
||||
|
||||
<pre><code>- projects
|
||||
- laradock
|
||||
- myProject
|
||||
<pre><code>+ laradock
|
||||
+ project-z
|
||||
</code></pre>
|
||||
|
||||
<p>2 - Edit the <code>docker-compose.yml</code> file to map to your project directory once you have it (example: <code>- ../myProject:/var/www</code>).</p>
|
||||
<p>2 - Edit your web server sites configuration.</p>
|
||||
|
||||
<p>3 - Stop and re-run your docker-compose command for the changes to take place.</p>
|
||||
<p><strong>In case of NGINX:</strong> open <code>nginx/sites/default.conf</code> and change the <code>root</code> from <code>/var/www/public</code> to <code>/var/www/{my-project-folder-name}/public</code>.</p>
|
||||
|
||||
<pre><code>docker-compose stop && docker-compose up -d XXXX YYYY ZZZZ ....
|
||||
</code></pre>
|
||||
<p><em>Or you can keep <code>default.conf</code> as it is, and create a separate config <code>my-site.conf</code> file for it.</em></p>
|
||||
|
||||
<p><strong>In case of Apache:</strong> :P
|
||||
<br></p>
|
||||
|
||||
<blockquote>
|
||||
<p><strong>Now jump to the <a href="#Usage">Usage</a> section.</strong></p>
|
||||
</blockquote>
|
||||
|
||||
<p><a name="B"></a></p>
|
||||
|
||||
<h3 id="b-setup-for-multiple-projects">B) Setup for Multiple Projects:</h3>
|
||||
|
||||
<blockquote>
|
||||
<p>(Follow these steps if you want a single Docker environment for all project)</p>
|
||||
<p>(Follow these steps if you want a single Docker environment for all your project)</p>
|
||||
</blockquote>
|
||||
|
||||
<p>1 - Clone this repository anywhere on your machine:</p>
|
||||
<p>1 - Clone this repository anywhere on your machine (similar to <a href="#A2">Steps A.2. from above</a>):</p>
|
||||
|
||||
<pre><code class="language-bash">git clone https://github.com/laradock/laradock.git
|
||||
</code></pre>
|
||||
|
||||
<p>2 - Edit the <code>docker-compose.yml</code> (or the <code>.env</code>) file to map to your projects directories:</p>
|
||||
<p>Your folder structure should look like this:</p>
|
||||
|
||||
<pre><code> applications:
|
||||
volumes:
|
||||
- ../project1/:/var/www/project1
|
||||
- ../project2/:/var/www/project2
|
||||
<pre><code>+ laradock
|
||||
+ project-1
|
||||
+ project-2
|
||||
</code></pre>
|
||||
|
||||
<p>3 - You can access all sites by visiting <code>http://localhost/project1/public</code> and <code>http://localhost/project2/public</code> but of course that’s not very useful so let’s setup NGINX quickly.</p>
|
||||
<p>2 - Go to <code>nginx/sites</code> and create config files to point to different project directory when visiting different domains.</p>
|
||||
|
||||
<p>4 - Go to <code>nginx/sites</code> and copy <code>sample.conf.example</code> to <code>project1.conf</code> then to <code>project2.conf</code></p>
|
||||
<p>Laradock by default includes <code>project-1.conf</code> and <code>project-2.conf</code> as working samples.</p>
|
||||
|
||||
<p>5 - Open the <code>project1.conf</code> file and edit the <code>server_name</code> and the <code>root</code> as follow:</p>
|
||||
<p>3 - change the default names <code>project-n</code>:</p>
|
||||
|
||||
<pre><code> server_name project1.dev;
|
||||
root /var/www/project1/public;
|
||||
<p>You can rename the config files, project folders and domains as you like, just make sure the <code>root</code> in the config files, is pointing to the correct project folder name.</p>
|
||||
|
||||
<p>4 - Add the domains to the <strong>hosts</strong> files.</p>
|
||||
|
||||
<pre><code>127.0.0.1 project-1.dev
|
||||
127.0.0.1 project-2.dev
|
||||
</code></pre>
|
||||
|
||||
<p>Do the same for each project <code>project2.conf</code>, <code>project3.conf</code>,…</p>
|
||||
<blockquote>
|
||||
<p><strong>Now jump to the <a href="#Usage">Usage</a> section.</strong></p>
|
||||
</blockquote>
|
||||
|
||||
<p>6 - Add the domains to the <strong>hosts</strong> files.</p>
|
||||
|
||||
<pre><code>127.0.0.1 project1.dev
|
||||
</code></pre>
|
||||
|
||||
<p>7 - Create your project Databases. Right now you have to do it manually by entering your DB container, until we automate it soon.</p>
|
||||
<p><a name="Usage"></a></p>
|
||||
|
||||
<h2 id="usage">Usage</h2>
|
||||
|
||||
@ -655,28 +658,37 @@ QUEUE_HOST=beanstalkd
|
||||
|
||||
<p><br></p>
|
||||
|
||||
<p>1 - Run Containers: <em>(Make sure you are in the <code>laradock</code> folder before running the <code>docker-compose</code> commands).</em></p>
|
||||
<p>1 - Enter the laradock folder and rename <code>env-example</code> to <code>.env</code></p>
|
||||
|
||||
<p><strong>Example:</strong> Running NGINX and MySQL:</p>
|
||||
<pre><code class="language-shell">cp env-example .env
|
||||
</code></pre>
|
||||
|
||||
<p>You can edit the <code>.env</code> file to chose which software’s you want to be installed in your environment. You can always refer to the <code>docker-compose.yml</code> file to see how those variables are been used.</p>
|
||||
|
||||
<p>2 - Build the enviroment and run it using <code>docker-compose</code></p>
|
||||
|
||||
<p>In this example we’ll see how to run NGINX (web server) and MySQL (database engine) to host a PHP Web Scripts:</p>
|
||||
|
||||
<pre><code class="language-bash">docker-compose up -d nginx mysql
|
||||
</code></pre>
|
||||
|
||||
<p><strong>Note</strong>: The <code>workspace</code> and <code>php-fpm</code> will run automatically in most of the cases, so no need to specify them in the <code>up</code> command. If you couldn’t find them running then you need specify them as follow: <code>docker-compose up -d nginx php-fpm mysql workspace</code>.</p>
|
||||
|
||||
<p>You can select your own combination of Containers form the list below:</p>
|
||||
<p>You can select your own combination of containers form the list below:</p>
|
||||
|
||||
<blockquote>
|
||||
<p><code>nginx</code>, <code>hhvm</code>, <code>php-fpm</code>, <code>mysql</code>, <code>redis</code>, <code>postgres</code>, <code>mariadb</code>, <code>neo4j</code>, <code>mongo</code>, <code>apache2</code>, <code>caddy</code>, <code>memcached</code>, <code>beanstalkd</code>, <code>beanstalkd-console</code>, <code>rabbitmq</code>, <code>beanstalkd-console</code>, <code>workspace</code>, <code>phpmyadmin</code>, <code>aerospike</code>, <code>pgadmin</code>, <code>elasticsearch</code>, <code>rethinkdb</code>, <code>postgres-postgis</code>, <code>certbot</code>, <code>mailhog</code>, <code>minio</code> and more…!</p>
|
||||
</blockquote>
|
||||
|
||||
<p><em>(Please note that sometimes we forget to update the docs, so check the <code>docker-compose.yml</code> file to see an updated list of all available containers).</em></p>
|
||||
|
||||
<p><br>
|
||||
2 - Enter the Workspace container, to execute commands like (Artisan, Composer, PHPUnit, Gulp, …).</p>
|
||||
3 - Enter the Workspace container, to execute commands like (Artisan, Composer, PHPUnit, Gulp, …)</p>
|
||||
|
||||
<pre><code class="language-bash">docker-compose exec workspace bash
|
||||
</code></pre>
|
||||
|
||||
<p>Alternatively, for Windows PowerShell users: execute the following command to enter any running container:</p>
|
||||
<p><em>Alternatively, for Windows PowerShell users: execute the following command to enter any running container:</em></p>
|
||||
|
||||
<pre><code class="language-bash">docker exec -it {workspace-container-id} bash
|
||||
</code></pre>
|
||||
@ -686,12 +698,12 @@ QUEUE_HOST=beanstalkd
|
||||
<pre><code class="language-shell">docker-compose exec --user=laradock workspace bash
|
||||
</code></pre>
|
||||
|
||||
<p><em>You can change the PUID (User id) and PGID (group id) variables from the <code>docker-compose.yml</code> or the <code>.env</code>)</em></p>
|
||||
<p><em>You can change the PUID (User id) and PGID (group id) variables from the <code>.env</code> file)</em></p>
|
||||
|
||||
<p><br>
|
||||
3 - Edit your project configurations.</p>
|
||||
4 - Update your project configurations to use the database host</p>
|
||||
|
||||
<p>Open your <code>.env</code> file and set the <code>DB_HOST</code> to <code>mysql</code>:</p>
|
||||
<p>Open your PHP project’s <code>.env</code> file or whichever configuration file you are reading from, and set the database host <code>DB_HOST</code> to <code>mysql</code>:</p>
|
||||
|
||||
<pre><code class="language-env">DB_HOST=mysql
|
||||
</code></pre>
|
||||
@ -699,7 +711,7 @@ QUEUE_HOST=beanstalkd
|
||||
<p><em>If you want to install Laravel as PHP project, see <a href="#Install-Laravel">How to Install Laravel in a Docker Container</a>.</em></p>
|
||||
|
||||
<p><br>
|
||||
4 - Open your browser and visit your localhost address <code>http://localhost/</code>.</p>
|
||||
5 - Open your browser and visit your localhost address <code>http://localhost/</code>. If you followed the multiple projects setup, you can visit <code>http://project-1.dev/</code> and <code>http://project-2.dev/</code>. But first don’t</p>
|
||||
|
||||
|
||||
<h1>Documentation </h1>
|
||||
@ -840,6 +852,11 @@ example for <code>mysql</code> it will be <code>mysql/Dockerfile</code>.</p>
|
||||
<pre><code class="language-bash">docker logs {container-name}
|
||||
</code></pre>
|
||||
|
||||
<p>More <a href="https://docs.docker.com/compose/reference/logs/">options</a></p>
|
||||
|
||||
<pre><code class="language-bash">docker logs -f {container-name}
|
||||
</code></pre>
|
||||
|
||||
<p><br>
|
||||
<a name="PHP"></a></p>
|
||||
|
||||
@ -1932,7 +1949,6 @@ These Docker Compose projects have piqued our interest:</li>
|
||||
<h2 id="i-have-a-question-problem">I have a Question/Problem</h2>
|
||||
|
||||
<p>If you have questions about how to use Laradock, please direct your questions to the discussion on <a href="https://gitter.im/Laradock/laradock">Gitter</a>. If you believe your question could help others, then consider opening an <a href="https://github.com/laradock/laradock/issues">Issue</a> (it will be labeled as <code>Question</code>) And you can still seek help on Gitter for it.</p>
|
||||
|
||||
<h2 id="i-found-an-issue">I found an Issue</h2>
|
||||
|
||||
<p>If have an issue or you found a typo in the documentation, you can help us by
|
||||
@ -1960,16 +1976,17 @@ features, by not reporting duplicate issues.</em></p>
|
||||
<p>Laradock uses <a href="https://gohugo.io/">Hugo</a> as website generator tool, with the <a href="http://themes.gohugo.io/theme/material-docs/">Material Docs theme</a>. You might need to check their docs quickly.</p>
|
||||
|
||||
<ol>
|
||||
<li>Install <a href="https://gohugo.io/">Hugo</a> on your machine (easy steps).</li>
|
||||
<li>Open the <code>DOCUMENTATION/_settings/content</code> and search for the markdown file you want to edit (every folder is a section in the menu).</li>
|
||||
<li>After done editing, run the this command <code>hugo</code> to generate the updated site inside the <code>docs</code> folder (It’s recommended to delete all files form the <code>/docs</code> folder, except the <code>CNAME</code> file, before running the <code>hugo</code> command).</li>
|
||||
<li>Install <a href="https://gohugo.io/">Hugo</a> on your machine (easy thing).</li>
|
||||
<li>Open the <code>DOCUMENTATION/_settings/content</code> and search for the markdown file you want to edit (every folder represents a section in the menu).</li>
|
||||
<li>Delete the <code>/docs</code> folder from the root.</li>
|
||||
<li>When you finish editing, run the <code>hugo</code> command to generate the HTML docs (in the <code>/docs</code>).</li>
|
||||
</ol>
|
||||
|
||||
<h4 id="to-host-the-website-locally">To Host the website locally</h4>
|
||||
<h3 id="to-host-the-website-locally">To Host the website locally</h3>
|
||||
|
||||
<p>Go to <code>DOCUMENTATION/_settings</code> in your terminal and run <code>hugo serve</code> to host the website locally.</p>
|
||||
|
||||
<h4 id="edit-the-sidebar">Edit the sidebar</h4>
|
||||
<h3 id="edit-the-sidebar">Edit the sidebar</h3>
|
||||
|
||||
<p>To add a new section to the sidebar or edit existing one, you need to edit this file <code>DOCUMENTATION/_settings/config.toml</code>.</p>
|
||||
|
||||
|
123
docs/index.xml
123
docs/index.xml
@ -251,10 +251,6 @@ QUEUE_HOST=beanstalkd
|
||||
|
||||
<h3 id="a-1-already-have-a-php-project">A.1) Already have a PHP project:</h3>
|
||||
|
||||
<blockquote>
|
||||
<p>(Follow these steps if you already have a PHP project, and all you need is an environment to run it)</p>
|
||||
</blockquote>
|
||||
|
||||
<p>1 - Clone laradock on your project root directory:</p>
|
||||
|
||||
<pre><code class="language-bash">git submodule add https://github.com/Laradock/laradock.git
|
||||
@ -270,20 +266,22 @@ QUEUE_HOST=beanstalkd
|
||||
|
||||
<p>Your folder structure should look like this:</p>
|
||||
|
||||
<pre><code>- project1
|
||||
- laradock
|
||||
- project2
|
||||
- laradock
|
||||
<pre><code>+ project-a
|
||||
+ laradock-a
|
||||
+ project-b
|
||||
+ laradock-b
|
||||
</code></pre>
|
||||
|
||||
<p>(It&rsquo;s important to rename the folders differently in each project.)</p>
|
||||
|
||||
<blockquote>
|
||||
<p><strong>Now jump to the <a href="#Usage">Usage</a> section.</strong></p>
|
||||
</blockquote>
|
||||
|
||||
<p><a name="A2"></a></p>
|
||||
|
||||
<h3 id="a-2-don-t-have-a-php-project-yet">A.2) Don&rsquo;t have a PHP project yet:</h3>
|
||||
|
||||
<blockquote>
|
||||
<p>(Follow these steps if you don&rsquo;t have a PHP project yet, and you need an environment to create the project)</p>
|
||||
</blockquote>
|
||||
|
||||
<p>1 - Clone this repository anywhere on your machine:</p>
|
||||
|
||||
<pre><code class="language-bash">git clone https://github.com/laradock/laradock.git
|
||||
@ -291,57 +289,62 @@ QUEUE_HOST=beanstalkd
|
||||
|
||||
<p>Your folder structure should look like this:</p>
|
||||
|
||||
<pre><code>- projects
|
||||
- laradock
|
||||
- myProject
|
||||
<pre><code>+ laradock
|
||||
+ project-z
|
||||
</code></pre>
|
||||
|
||||
<p>2 - Edit the <code>docker-compose.yml</code> file to map to your project directory once you have it (example: <code>- ../myProject:/var/www</code>).</p>
|
||||
<p>2 - Edit your web server sites configuration.</p>
|
||||
|
||||
<p>3 - Stop and re-run your docker-compose command for the changes to take place.</p>
|
||||
<p><strong>In case of NGINX:</strong> open <code>nginx/sites/default.conf</code> and change the <code>root</code> from <code>/var/www/public</code> to <code>/var/www/{my-project-folder-name}/public</code>.</p>
|
||||
|
||||
<pre><code>docker-compose stop &amp;&amp; docker-compose up -d XXXX YYYY ZZZZ ....
|
||||
</code></pre>
|
||||
<p><em>Or you can keep <code>default.conf</code> as it is, and create a separate config <code>my-site.conf</code> file for it.</em></p>
|
||||
|
||||
<p><strong>In case of Apache:</strong> :P
|
||||
<br></p>
|
||||
|
||||
<blockquote>
|
||||
<p><strong>Now jump to the <a href="#Usage">Usage</a> section.</strong></p>
|
||||
</blockquote>
|
||||
|
||||
<p><a name="B"></a></p>
|
||||
|
||||
<h3 id="b-setup-for-multiple-projects">B) Setup for Multiple Projects:</h3>
|
||||
|
||||
<blockquote>
|
||||
<p>(Follow these steps if you want a single Docker environment for all project)</p>
|
||||
<p>(Follow these steps if you want a single Docker environment for all your project)</p>
|
||||
</blockquote>
|
||||
|
||||
<p>1 - Clone this repository anywhere on your machine:</p>
|
||||
<p>1 - Clone this repository anywhere on your machine (similar to <a href="#A2">Steps A.2. from above</a>):</p>
|
||||
|
||||
<pre><code class="language-bash">git clone https://github.com/laradock/laradock.git
|
||||
</code></pre>
|
||||
|
||||
<p>2 - Edit the <code>docker-compose.yml</code> (or the <code>.env</code>) file to map to your projects directories:</p>
|
||||
<p>Your folder structure should look like this:</p>
|
||||
|
||||
<pre><code> applications:
|
||||
volumes:
|
||||
- ../project1/:/var/www/project1
|
||||
- ../project2/:/var/www/project2
|
||||
<pre><code>+ laradock
|
||||
+ project-1
|
||||
+ project-2
|
||||
</code></pre>
|
||||
|
||||
<p>3 - You can access all sites by visiting <code>http://localhost/project1/public</code> and <code>http://localhost/project2/public</code> but of course that&rsquo;s not very useful so let&rsquo;s setup NGINX quickly.</p>
|
||||
<p>2 - Go to <code>nginx/sites</code> and create config files to point to different project directory when visiting different domains.</p>
|
||||
|
||||
<p>4 - Go to <code>nginx/sites</code> and copy <code>sample.conf.example</code> to <code>project1.conf</code> then to <code>project2.conf</code></p>
|
||||
<p>Laradock by default includes <code>project-1.conf</code> and <code>project-2.conf</code> as working samples.</p>
|
||||
|
||||
<p>5 - Open the <code>project1.conf</code> file and edit the <code>server_name</code> and the <code>root</code> as follow:</p>
|
||||
<p>3 - change the default names <code>project-n</code>:</p>
|
||||
|
||||
<pre><code> server_name project1.dev;
|
||||
root /var/www/project1/public;
|
||||
<p>You can rename the config files, project folders and domains as you like, just make sure the <code>root</code> in the config files, is pointing to the correct project folder name.</p>
|
||||
|
||||
<p>4 - Add the domains to the <strong>hosts</strong> files.</p>
|
||||
|
||||
<pre><code>127.0.0.1 project-1.dev
|
||||
127.0.0.1 project-2.dev
|
||||
</code></pre>
|
||||
|
||||
<p>Do the same for each project <code>project2.conf</code>, <code>project3.conf</code>,&hellip;</p>
|
||||
<blockquote>
|
||||
<p><strong>Now jump to the <a href="#Usage">Usage</a> section.</strong></p>
|
||||
</blockquote>
|
||||
|
||||
<p>6 - Add the domains to the <strong>hosts</strong> files.</p>
|
||||
|
||||
<pre><code>127.0.0.1 project1.dev
|
||||
</code></pre>
|
||||
|
||||
<p>7 - Create your project Databases. Right now you have to do it manually by entering your DB container, until we automate it soon.</p>
|
||||
<p><a name="Usage"></a></p>
|
||||
|
||||
<h2 id="usage">Usage</h2>
|
||||
|
||||
@ -362,28 +365,37 @@ QUEUE_HOST=beanstalkd
|
||||
|
||||
<p><br></p>
|
||||
|
||||
<p>1 - Run Containers: <em>(Make sure you are in the <code>laradock</code> folder before running the <code>docker-compose</code> commands).</em></p>
|
||||
<p>1 - Enter the laradock folder and rename <code>env-example</code> to <code>.env</code></p>
|
||||
|
||||
<p><strong>Example:</strong> Running NGINX and MySQL:</p>
|
||||
<pre><code class="language-shell">cp env-example .env
|
||||
</code></pre>
|
||||
|
||||
<p>You can edit the <code>.env</code> file to chose which software&rsquo;s you want to be installed in your environment. You can always refer to the <code>docker-compose.yml</code> file to see how those variables are been used.</p>
|
||||
|
||||
<p>2 - Build the enviroment and run it using <code>docker-compose</code></p>
|
||||
|
||||
<p>In this example we&rsquo;ll see how to run NGINX (web server) and MySQL (database engine) to host a PHP Web Scripts:</p>
|
||||
|
||||
<pre><code class="language-bash">docker-compose up -d nginx mysql
|
||||
</code></pre>
|
||||
|
||||
<p><strong>Note</strong>: The <code>workspace</code> and <code>php-fpm</code> will run automatically in most of the cases, so no need to specify them in the <code>up</code> command. If you couldn&rsquo;t find them running then you need specify them as follow: <code>docker-compose up -d nginx php-fpm mysql workspace</code>.</p>
|
||||
|
||||
<p>You can select your own combination of Containers form the list below:</p>
|
||||
<p>You can select your own combination of containers form the list below:</p>
|
||||
|
||||
<blockquote>
|
||||
<p><code>nginx</code>, <code>hhvm</code>, <code>php-fpm</code>, <code>mysql</code>, <code>redis</code>, <code>postgres</code>, <code>mariadb</code>, <code>neo4j</code>, <code>mongo</code>, <code>apache2</code>, <code>caddy</code>, <code>memcached</code>, <code>beanstalkd</code>, <code>beanstalkd-console</code>, <code>rabbitmq</code>, <code>beanstalkd-console</code>, <code>workspace</code>, <code>phpmyadmin</code>, <code>aerospike</code>, <code>pgadmin</code>, <code>elasticsearch</code>, <code>rethinkdb</code>, <code>postgres-postgis</code>, <code>certbot</code>, <code>mailhog</code>, <code>minio</code> and more&hellip;!</p>
|
||||
</blockquote>
|
||||
|
||||
<p><em>(Please note that sometimes we forget to update the docs, so check the <code>docker-compose.yml</code> file to see an updated list of all available containers).</em></p>
|
||||
|
||||
<p><br>
|
||||
2 - Enter the Workspace container, to execute commands like (Artisan, Composer, PHPUnit, Gulp, &hellip;).</p>
|
||||
3 - Enter the Workspace container, to execute commands like (Artisan, Composer, PHPUnit, Gulp, &hellip;)</p>
|
||||
|
||||
<pre><code class="language-bash">docker-compose exec workspace bash
|
||||
</code></pre>
|
||||
|
||||
<p>Alternatively, for Windows PowerShell users: execute the following command to enter any running container:</p>
|
||||
<p><em>Alternatively, for Windows PowerShell users: execute the following command to enter any running container:</em></p>
|
||||
|
||||
<pre><code class="language-bash">docker exec -it {workspace-container-id} bash
|
||||
</code></pre>
|
||||
@ -393,12 +405,12 @@ QUEUE_HOST=beanstalkd
|
||||
<pre><code class="language-shell">docker-compose exec --user=laradock workspace bash
|
||||
</code></pre>
|
||||
|
||||
<p><em>You can change the PUID (User id) and PGID (group id) variables from the <code>docker-compose.yml</code> or the <code>.env</code>)</em></p>
|
||||
<p><em>You can change the PUID (User id) and PGID (group id) variables from the <code>.env</code> file)</em></p>
|
||||
|
||||
<p><br>
|
||||
3 - Edit your project configurations.</p>
|
||||
4 - Update your project configurations to use the database host</p>
|
||||
|
||||
<p>Open your <code>.env</code> file and set the <code>DB_HOST</code> to <code>mysql</code>:</p>
|
||||
<p>Open your PHP project&rsquo;s <code>.env</code> file or whichever configuration file you are reading from, and set the database host <code>DB_HOST</code> to <code>mysql</code>:</p>
|
||||
|
||||
<pre><code class="language-env">DB_HOST=mysql
|
||||
</code></pre>
|
||||
@ -406,7 +418,7 @@ QUEUE_HOST=beanstalkd
|
||||
<p><em>If you want to install Laravel as PHP project, see <a href="#Install-Laravel">How to Install Laravel in a Docker Container</a>.</em></p>
|
||||
|
||||
<p><br>
|
||||
4 - Open your browser and visit your localhost address <code>http://localhost/</code>.</p>
|
||||
5 - Open your browser and visit your localhost address <code>http://localhost/</code>. If you followed the multiple projects setup, you can visit <code>http://project-1.dev/</code> and <code>http://project-2.dev/</code>. But first don&rsquo;t</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
@ -552,6 +564,11 @@ example for <code>mysql</code> it will be <code>mysql/Dockerfi
|
||||
<pre><code class="language-bash">docker logs {container-name}
|
||||
</code></pre>
|
||||
|
||||
<p>More <a href="https://docs.docker.com/compose/reference/logs/">options</a></p>
|
||||
|
||||
<pre><code class="language-bash">docker logs -f {container-name}
|
||||
</code></pre>
|
||||
|
||||
<p><br>
|
||||
<a name="PHP"></a></p>
|
||||
|
||||
@ -1687,16 +1704,16 @@ features, by not reporting duplicate issues.</em></p>
|
||||
<p>Laradock uses <a href="https://gohugo.io/">Hugo</a> as website generator tool, with the <a href="http://themes.gohugo.io/theme/material-docs/">Material Docs theme</a>. You might need to check their docs quickly.</p>
|
||||
|
||||
<ol>
|
||||
<li>Install <a href="https://gohugo.io/">Hugo</a> on your machine (easy steps).</li>
|
||||
<li>Open the <code>DOCUMENTATION/_settings/content</code> and search for the markdown file you want to edit (every folder is a section in the menu).</li>
|
||||
<li>After done editing, run the this command <code>hugo</code> to generate the updated site inside the <code>docs</code> folder (It&rsquo;s recommended to delete all files form the <code>/docs</code> folder, except the <code>CNAME</code> file, before running the <code>hugo</code> command).</li>
|
||||
<li>Install <a href="https://gohugo.io/">Hugo</a> on your machine (easy thing).</li>
|
||||
<li>Open the <code>DOCUMENTATION/_settings/content</code> and search for the markdown file you want to edit (every folder represents a section in the menu).</li>
|
||||
<li>Delete the <code>/docs</code> folder from the root.</li>
|
||||
<li>When you finish editing, run the <code>hugo</code> command to generate the HTML docs (in the <code>/docs</code>).</li>
|
||||
</ol>
|
||||
|
||||
<h4 id="to-host-the-website-locally">To Host the website locally</h4>
|
||||
<h3 id="to-host-the-website-locally">To Host the website locally</h3>
|
||||
|
||||
<p>Go to <code>DOCUMENTATION/_settings</code> in your terminal and run <code>hugo serve</code> to host the website locally.</p>
|
||||
|
||||
<h4 id="edit-the-sidebar">Edit the sidebar</h4>
|
||||
<h3 id="edit-the-sidebar">Edit the sidebar</h3>
|
||||
|
||||
<p>To add a new section to the sidebar or edit existing one, you need to edit this file <code>DOCUMENTATION/_settings/config.toml</code>.</p>
|
||||
|
||||
|
37
env-example
37
env-example
@ -1,6 +1,6 @@
|
||||
### Application
|
||||
# Point to your application code, wish should be available at `/var/www`
|
||||
APPLICATION_1=../
|
||||
APPLICATION=../
|
||||
|
||||
### PHP version (Does not apply for HHVM)
|
||||
# PHP_VERSION=55
|
||||
@ -29,6 +29,7 @@ WORKSPACE_INSTALL_MC=false
|
||||
WORKSPACE_PUID=1000
|
||||
WORKSPACE_PGID=1000
|
||||
WORKSPACE_NODE_VERSION=stable
|
||||
WORKSPACE_YARN_VERSION=latest
|
||||
WORKSPACE_TIMEZONE=UTC
|
||||
WORKSPACE_SSH_PORT=2222
|
||||
|
||||
@ -46,10 +47,11 @@ PHP_FPM_INSTALL_EXIF=false
|
||||
PHP_FPM_INSTALL_AEROSPIKE_EXTENSION=false
|
||||
PHP_FPM_INSTALL_MYSQLI=false
|
||||
PHP_FPM_INSTALL_TOKENIZER=false
|
||||
PHP_FPM_INSTALL_INTL=false
|
||||
|
||||
### NGINX Container
|
||||
NGINX_HOST_HTTP_PORT=80
|
||||
NGINX_HOST_HTTPS_PORT=433
|
||||
NGINX_HOST_HTTPS_PORT=443
|
||||
NGINX_HOST_LOG_PATH=./logs/nginx/
|
||||
NGINX_SITES_PATH=./nginx/sites/
|
||||
|
||||
@ -67,12 +69,17 @@ MYSQL_PASSWORD=secret
|
||||
MYSQL_PORT=3306
|
||||
MYSQL_ROOT_PASSWORD=root
|
||||
|
||||
### MSSQL Container
|
||||
MSSQL_DATABASE=homestead
|
||||
MSSQL_PASSWORD=yourStrong(!)Password
|
||||
MSSQL_PORT=1433
|
||||
|
||||
### MARIADB Container
|
||||
MARIADB_DATABASE=default
|
||||
MARIADB_USER=default
|
||||
MARIADB_PASSWORD=secret
|
||||
MARIADB_PORT=3306
|
||||
|
||||
MARIADB_ROOT_PASSWORD=root
|
||||
|
||||
### POSTGRES Container
|
||||
POSTGRES_DB=default
|
||||
@ -116,10 +123,34 @@ PMA_PASSWORD=secret
|
||||
PMA_ROOT_PASSWORD=secret
|
||||
PMA_PORT=88
|
||||
|
||||
### ADMINER Container
|
||||
ADM_PORT=88
|
||||
|
||||
### VARNISH Container
|
||||
VARNISH_CONFIG=/etc/varnish/default.vcl
|
||||
VARNISH_PORT=8080
|
||||
VARNISH_BACKEND_PORT=8888
|
||||
VARNISHD_PARAMS=-p default_ttl=3600 -p default_grace=3600
|
||||
|
||||
### Varnish Proxy 1 Container
|
||||
VARNISH_PROXY1_CACHE_SIZE=128m
|
||||
VARNISH_PROXY1_BACKEND_HOST=workspace
|
||||
VARNISH_PROXY1_SERVER=SERVER1
|
||||
|
||||
### Varnish Proxy 2 Container
|
||||
VARNISH_PROXY2_CACHE_SIZE=128m
|
||||
VARNISH_PROXY2_BACKEND_HOST=workspace
|
||||
VARNISH_PROXY2_SERVER=SERVER2
|
||||
|
||||
### HAPROXY Container
|
||||
HAPROXY_HOST_HTTP_PORT=8085
|
||||
|
||||
### MISC
|
||||
# Replace with your Docker Host IP (will be appended to /etc/hosts)
|
||||
DOCKER_HOST_IP=10.0.75.1
|
||||
# The Remote Interpreter entry matching name `laradock`
|
||||
PHP_IDE_CONFIG=serverName=laradock
|
||||
# Fix for windows users to make sure the application path works.
|
||||
COMPOSE_CONVERT_WINDOWS_PATHS=1
|
||||
|
||||
### to be continue neo4j mongo rethinkdb redis aerospike pgadmin ...
|
||||
|
5
haproxy/Dockerfile
Normal file
5
haproxy/Dockerfile
Normal file
@ -0,0 +1,5 @@
|
||||
FROM dockercloud/haproxy:latest
|
||||
|
||||
MAINTAINER ZeroC0D3 Team<zeroc0d3.team@gmail.com>
|
||||
|
||||
EXPOSE 80
|
@ -1,5 +1,7 @@
|
||||
FROM ubuntu:14.04
|
||||
|
||||
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
|
||||
|
||||
RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449
|
||||
|
||||
RUN apt-get update -y \
|
||||
|
@ -1,6 +1,6 @@
|
||||
FROM mailhog/mailhog
|
||||
|
||||
Maintainer Mahmoud Zalt <mahmoud@zalt.me>
|
||||
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
|
||||
|
||||
CMD ["Mailhog"]
|
||||
|
||||
|
23
mssql/Dockerfile
Normal file
23
mssql/Dockerfile
Normal file
@ -0,0 +1,23 @@
|
||||
FROM microsoft/mssql-server-linux
|
||||
|
||||
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
|
||||
|
||||
# Create config directory
|
||||
# an set it as WORKDIR
|
||||
RUN mkdir -p /usr/src/app
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# Bundle app source
|
||||
COPY . /usr/src/app
|
||||
|
||||
RUN chmod +x /usr/src/app/create_table.sh
|
||||
|
||||
ENV MSSQL_DATABASE=$MSSQL_DATABASE
|
||||
ENV ACCEPT_EULA=Y
|
||||
ENV SA_PASSWORD=$MSSQL_PASSWORD
|
||||
|
||||
VOLUME /var/opt/mssql
|
||||
|
||||
EXPOSE 1433
|
||||
|
||||
CMD /bin/bash ./entrypoint.sh
|
5
mssql/create_table.sh
Normal file
5
mssql/create_table.sh
Normal file
@ -0,0 +1,5 @@
|
||||
#wait for the SQL Server to come up
|
||||
sleep 45s
|
||||
|
||||
#run the setup script to create the DB and the schema in the DB
|
||||
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P $SA_PASSWORD -d master -i setup.sql
|
2
mssql/entrypoint.sh
Normal file
2
mssql/entrypoint.sh
Normal file
@ -0,0 +1,2 @@
|
||||
#start SQL Server, start the script to create the DB and import the data, start the app
|
||||
/opt/mssql/bin/sqlservr.sh & /usr/src/app/create_table.sh & tail -f /dev/null
|
4
mssql/setup.sql
Normal file
4
mssql/setup.sql
Normal file
@ -0,0 +1,4 @@
|
||||
CREATE DATABASE $(MSSQL_DATABASE);
|
||||
GO
|
||||
USE $(MSSQL_DATABASE);
|
||||
GO
|
@ -1,4 +1,4 @@
|
||||
DROP USER IF EXISTS 'MYSQL_USER';
|
||||
CREATE USER 'MYSQL_USER'@'%';
|
||||
CREATE DATABASE IF NOT EXISTS MYSQL_DATABASE;
|
||||
GRANT ALL ON MYSQL_DATABASE.* TO 'MYSQL_USER'@'%' IDENTIFIED BY 'MYSQL_PASSWORD';
|
||||
CREATE USER 'MYSQL_USER'@'%' IDENTIFIED BY 'MYSQL_PASSWORD';
|
||||
CREATE DATABASE IF NOT EXISTS `MYSQL_DATABASE`;
|
||||
GRANT ALL ON `MYSQL_DATABASE`.* TO 'MYSQL_USER'@'%';
|
||||
|
2
nginx/sites/.gitignore
vendored
2
nginx/sites/.gitignore
vendored
@ -1,2 +1,2 @@
|
||||
*.conf
|
||||
!default.conf
|
||||
!default.conf
|
@ -3,7 +3,7 @@ server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server ipv6only=on;
|
||||
|
||||
server_name laradock;
|
||||
server_name locahost;
|
||||
root /var/www/public;
|
||||
index index.php index.html index.htm;
|
||||
|
||||
|
@ -3,8 +3,8 @@ server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
server_name sample.dev;
|
||||
root /var/www/sample/public;
|
||||
server_name project-1.dev;
|
||||
root /var/www/project-1/public;
|
||||
index index.php index.html index.htm;
|
||||
|
||||
location / {
|
||||
@ -15,6 +15,8 @@ server {
|
||||
try_files $uri /index.php =404;
|
||||
fastcgi_pass php-upstream;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_buffers 16 16k;
|
||||
fastcgi_buffer_size 32k;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
}
|
||||
@ -22,6 +24,11 @@ server {
|
||||
location ~ /\.ht {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location /.well-known/acme-challenge/ {
|
||||
root /var/www/letsencrypt/;
|
||||
log_not_found off;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,10 @@
|
||||
server {
|
||||
|
||||
listen 443 default_server;
|
||||
listen [::]:443 default_server ipv6only=on;
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
#ssl on;
|
||||
#ssl_certificate /var/certs/cert1.pem;
|
||||
#ssl_certificate_key /var/certs/privkey1.pem;
|
||||
|
||||
server_name laravel;
|
||||
root /var/www/laravel/public;
|
||||
server_name project-2.dev;
|
||||
root /var/www/project-2/public;
|
||||
index index.php index.html index.htm;
|
||||
|
||||
location / {
|
||||
@ -19,6 +15,8 @@ server {
|
||||
try_files $uri /index.php =404;
|
||||
fastcgi_pass php-upstream;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_buffers 16 16k;
|
||||
fastcgi_buffer_size 32k;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
}
|
||||
@ -27,4 +25,11 @@ server {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location /.well-known/acme-challenge/ {
|
||||
root /var/www/letsencrypt/;
|
||||
log_not_found off;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -45,7 +45,7 @@ ARG INSTALL_SOAP=false
|
||||
RUN if [ ${INSTALL_SOAP} = true ]; then \
|
||||
# Install the soap extension
|
||||
apt-get -y update && \
|
||||
apt-get -y install libxml2-dev php-soap && \
|
||||
apt-get -y install libxml2-dev php-soap && \
|
||||
docker-php-ext-install soap \
|
||||
;fi
|
||||
|
||||
@ -192,6 +192,91 @@ RUN if [ ${INSTALL_TOKENIZER} = true ]; then \
|
||||
docker-php-ext-install tokenizer \
|
||||
;fi
|
||||
|
||||
#####################################
|
||||
# SQL SERVER:
|
||||
#####################################
|
||||
ARG MSSQL=false
|
||||
RUN if [ ${MSSQL} = true ]; then \
|
||||
|
||||
#####################################
|
||||
# Install Depenencies:
|
||||
#####################################
|
||||
apt-get update && \
|
||||
apt-get install -y --force-yes wget apt-transport-https curl freetds-common php5-odbc libsybdb5 freetds-bin unixodbc unixodbc-dev php5-sybase && \
|
||||
|
||||
#####################################
|
||||
# The following steps were taken from
|
||||
# Microsoft's github account:
|
||||
# https://github.com/Microsoft/msphpsql/wiki/Dockerfile-for-getting-pdo_sqlsrv-for-PHP-7.0-on-Debian-in-3-ways
|
||||
#####################################
|
||||
|
||||
# Add PHP 7 repository
|
||||
# for Debian jessie
|
||||
# And System upgrade
|
||||
echo "deb http://packages.dotdeb.org jessie all" \
|
||||
| tee /etc/apt/sources.list.d/dotdeb.list \
|
||||
&& wget -qO- https://www.dotdeb.org/dotdeb.gpg \
|
||||
| apt-key add - \
|
||||
&& apt-get update \
|
||||
&& apt-get upgrade -qq && \
|
||||
|
||||
# Install UnixODBC
|
||||
# Compile odbc_config as it is not part of unixodbc package
|
||||
apt-get install -y whiptail \
|
||||
unixodbc libgss3 odbcinst devscripts debhelper dh-exec dh-autoreconf libreadline-dev libltdl-dev \
|
||||
&& dget -u -x http://http.debian.net/debian/pool/main/u/unixodbc/unixodbc_2.3.1-3.dsc \
|
||||
&& cd unixodbc-*/ \
|
||||
&& dpkg-buildpackage -uc -us -B -d \
|
||||
&& cp -v ./exe/odbc_config /usr/local/bin/ && \
|
||||
|
||||
# Fake uname for install.sh
|
||||
printf '#!/bin/bash\nif [ "$*" == "-p" ]; then echo "x86_64"; else /bin/uname "$@"; fi' \
|
||||
| tee /usr/local/bin/uname \
|
||||
&& chmod +x /usr/local/bin/uname && \
|
||||
|
||||
# Microsoft ODBC Driver 13 for Linux
|
||||
# Note: There's a copy of this tar on my hubiC
|
||||
wget -nv -O msodbcsql-13.0.0.0.tar.gz \
|
||||
"https://meetsstorenew.blob.core.windows.net/contianerhd/Ubuntu%2013.0%20Tar/msodbcsql-13.0.0.0.tar.gz?st=2016-10-18T17%3A29%3A00Z&se=2022-10-19T17%3A29%3A00Z&sp=rl&sv=2015-04-05&sr=b&sig=cDwPfrouVeIQf0vi%2BnKt%2BzX8Z8caIYvRCmicDL5oknY%3D" \
|
||||
&& tar -xf msodbcsql-13.0.0.0.tar.gz \
|
||||
&& cd msodbcsql-*/ \
|
||||
&& ldd lib64/libmsodbcsql-13.0.so.0.0 \
|
||||
&& ./install.sh install --accept-license \
|
||||
&& ls -l /opt/microsoft/msodbcsql/ \
|
||||
&& odbcinst -q -d -n "ODBC Driver 13 for SQL Server" && \
|
||||
|
||||
|
||||
#####################################
|
||||
# Install sqlsrv y pdo_sqlsrv
|
||||
# extensions:
|
||||
#####################################
|
||||
|
||||
pecl install sqlsrv-4.0.6 && \
|
||||
pecl install pdo_sqlsrv-4.0.6 && \
|
||||
|
||||
#####################################
|
||||
# Set locales for the container
|
||||
#####################################
|
||||
|
||||
apt-get install -y locales \
|
||||
&& echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
|
||||
&& locale-gen \
|
||||
;fi
|
||||
|
||||
|
||||
|
||||
#####################################
|
||||
# Human Language and Character Encoding Support:
|
||||
#####################################
|
||||
|
||||
ARG INSTALL_INTL=false
|
||||
RUN if [ ${INSTALL_INTL} = true ]; then \
|
||||
# Install intl and requirements
|
||||
apt-get install -y zlib1g-dev libicu-dev g++ && \
|
||||
docker-php-ext-configure intl && \
|
||||
docker-php-ext-install intl \
|
||||
;fi
|
||||
|
||||
#####################################
|
||||
# GHOSTSCRIPT:
|
||||
#####################################
|
||||
@ -206,6 +291,7 @@ RUN if [ ${GHOSTSCRIPT} = true ]; then \
|
||||
ghostscript \
|
||||
;fi
|
||||
|
||||
|
||||
#
|
||||
#--------------------------------------------------------------------------
|
||||
# Final Touch
|
||||
|
@ -10,7 +10,7 @@
|
||||
# https://hub.docker.com/r/laradock/php-fpm/tags/
|
||||
#
|
||||
|
||||
FROM laradock/php-fpm:7.1--0.0 # placeholder. Need change after new image would be built.
|
||||
FROM laradock/php-fpm:7.1--1.3
|
||||
|
||||
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
|
||||
|
||||
@ -130,16 +130,48 @@ RUN if [ ${INSTALL_OPCACHE} = true ]; then \
|
||||
COPY ./opcache.ini /usr/local/etc/php/conf.d/opcache.ini
|
||||
|
||||
#####################################
|
||||
# Codeigniter Modifications:
|
||||
# Mysqli Modifications:
|
||||
#####################################
|
||||
ARG INSTALL_MYSQLI=false
|
||||
RUN if [ ${INSTALL_MYSQLI} = true ]; then \
|
||||
docker-php-ext-install mysqli \
|
||||
;fi
|
||||
|
||||
#####################################
|
||||
# Tokenizer Modifications:
|
||||
#####################################
|
||||
|
||||
ARG CODEIGNITER=false
|
||||
RUN if [ ${CODEIGNITER} = true ]; then \
|
||||
# Install Codeigniter PHP extentions requirements
|
||||
docker-php-ext-install mysqli && \
|
||||
ARG INSTALL_TOKENIZER=false
|
||||
RUN if [ ${INSTALL_TOKENIZER} = true ]; then \
|
||||
docker-php-ext-install tokenizer \
|
||||
;fi
|
||||
|
||||
#####################################
|
||||
# Human Language and Character Encoding Support:
|
||||
#####################################
|
||||
|
||||
ARG INTL=false
|
||||
RUN if [ ${INTL} = true ]; then \
|
||||
# Install intl and requirements
|
||||
apt-get install -y zlib1g-dev libicu-dev g++ && \
|
||||
docker-php-ext-configure intl && \
|
||||
docker-php-ext-install intl \
|
||||
;fi
|
||||
|
||||
#####################################
|
||||
# GHOSTSCRIPT:
|
||||
#####################################
|
||||
|
||||
ARG GHOSTSCRIPT=false
|
||||
RUN if [ ${GHOSTSCRIPT} = true ]; then \
|
||||
# Install the ghostscript extension
|
||||
# for PDF editing
|
||||
apt-get -y update \
|
||||
&& apt-get install -y \
|
||||
poppler-utils \
|
||||
ghostscript \
|
||||
;fi
|
||||
|
||||
#
|
||||
#--------------------------------------------------------------------------
|
||||
# Final Touch
|
||||
|
@ -11,3 +11,6 @@ upload_max_filesize = 20M
|
||||
; Sets max size of post data allowed.
|
||||
; http://php.net/post-max-size
|
||||
post_max_size = 20M
|
||||
; Enables the MSSQL extensions
|
||||
extension=sqlsrv.so
|
||||
extension=pdo_sqlsrv.so
|
41
php-worker/Dockerfile
Normal file
41
php-worker/Dockerfile
Normal file
@ -0,0 +1,41 @@
|
||||
#
|
||||
#--------------------------------------------------------------------------
|
||||
# Image Setup
|
||||
#--------------------------------------------------------------------------
|
||||
#
|
||||
# To take a look at the'php-worker' base Image, visit its DockerHub page
|
||||
# https://hub.docker.com/r/nielsvdoorn/laravel-supervisor/
|
||||
#
|
||||
|
||||
FROM nielsvdoorn/laravel-supervisor
|
||||
|
||||
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
|
||||
|
||||
#
|
||||
#--------------------------------------------------------------------------
|
||||
# Optional Supervisord Configuration
|
||||
#--------------------------------------------------------------------------
|
||||
#
|
||||
# Modify the ./supervisor.conf file to match your App's requirements.
|
||||
# Make sure you rebuild your container with every change.
|
||||
#
|
||||
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
|
||||
#
|
||||
#--------------------------------------------------------------------------
|
||||
# Optional Software's Installation
|
||||
#--------------------------------------------------------------------------
|
||||
#
|
||||
# If you need to modify this image, feel free to do it right here.
|
||||
#
|
||||
# -- Your awesome modifications go here -- #
|
||||
|
||||
|
||||
#
|
||||
#--------------------------------------------------------------------------
|
||||
# Final Touch
|
||||
#--------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
RUN rm -r /var/lib/apt/lists/*
|
||||
WORKDIR /etc/supervisor/conf.d/
|
9
php-worker/supervisord.conf
Normal file
9
php-worker/supervisord.conf
Normal file
@ -0,0 +1,9 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
[program:laravel-worker]
|
||||
process_name=%(program_name)s_%(process_num)02d
|
||||
command=php /var/www/artisan queue:work --sleep=3 --tries=3 --daemon
|
||||
autostart=true
|
||||
autorestart=true
|
||||
numprocs=8
|
||||
redirect_stderr=true
|
@ -1,5 +1,7 @@
|
||||
FROM mdillon/postgis:latest
|
||||
|
||||
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
|
||||
|
||||
CMD ["postgres"]
|
||||
|
||||
EXPOSE 5432
|
||||
EXPOSE 5432
|
||||
|
@ -1,5 +1,7 @@
|
||||
FROM rabbitmq
|
||||
|
||||
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
|
||||
|
||||
RUN rabbitmq-plugins enable --offline rabbitmq_management
|
||||
|
||||
EXPOSE 15671 15672
|
||||
|
29
varnish/Dockerfile
Normal file
29
varnish/Dockerfile
Normal file
@ -0,0 +1,29 @@
|
||||
FROM debian:latest
|
||||
|
||||
MAINTAINER ZeroC0D3 Team<zeroc0d3.team@gmail.com>
|
||||
|
||||
# Set Environment Variables
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
# Install Dependencies
|
||||
RUN apt-get update && apt-get install -y apt-utils && apt-get upgrade -y
|
||||
RUN mkdir /home/site && mkdir /home/site/cache
|
||||
RUN apt-get install -y varnish
|
||||
RUN rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Setting Configurations
|
||||
ENV VARNISH_CONFIG /etc/varnish/default.vcl
|
||||
ENV CACHE_SIZE 128m
|
||||
ENV VARNISHD_PARAMS -p default_ttl=3600 -p default_grace=3600
|
||||
ENV VARNISH_PORT 6081
|
||||
ENV BACKEND_HOST localhost
|
||||
ENV BACKEND_PORT 80
|
||||
|
||||
ADD default.vcl /etc/varnish/default.vcl
|
||||
ADD start.sh /etc/varnish/start.sh
|
||||
|
||||
RUN chmod +x /etc/varnish/start.sh
|
||||
|
||||
CMD ["/etc/varnish/start.sh"]
|
||||
|
||||
EXPOSE 8080
|
415
varnish/default.vcl
Normal file
415
varnish/default.vcl
Normal file
@ -0,0 +1,415 @@
|
||||
vcl 4.0;
|
||||
# Based on: https://github.com/mattiasgeniar/varnish-4.0-configuration-templates/blob/master/default.vcl
|
||||
|
||||
import std;
|
||||
import directors;
|
||||
|
||||
backend server1 { # Define one backend
|
||||
.host = "${BACKEND_HOST}"; # IP or Hostname of backend
|
||||
.port = "${BACKEND_PORT}"; # Port Apache or whatever is listening
|
||||
.max_connections = 300; # That's it
|
||||
|
||||
.probe = {
|
||||
#.url = "/"; # short easy way (GET /)
|
||||
# We prefer to only do a HEAD /
|
||||
.request =
|
||||
"HEAD / HTTP/1.1"
|
||||
"Host: ${BACKEND_HOST}"
|
||||
"Connection: close"
|
||||
"User-Agent: Varnish Health Probe";
|
||||
|
||||
.interval = 5s; # check the health of each backend every 5 seconds
|
||||
.timeout = 1s; # timing out after 1 second.
|
||||
.window = 5; # If 3 out of the last 5 polls succeeded the backend is considered healthy, otherwise it will be marked as sick
|
||||
.threshold = 3;
|
||||
}
|
||||
|
||||
.first_byte_timeout = 300s; # How long to wait before we receive a first byte from our backend?
|
||||
.connect_timeout = 5s; # How long to wait for a backend connection?
|
||||
.between_bytes_timeout = 2s; # How long to wait between bytes received from our backend?
|
||||
}
|
||||
|
||||
acl purge {
|
||||
# ACL we'll use later to allow purges
|
||||
"localhost";
|
||||
"127.0.0.1";
|
||||
"::1";
|
||||
}
|
||||
|
||||
#acl editors {
|
||||
# # ACL to honor the "Cache-Control: no-cache" header to force a refresh but only from selected IPs
|
||||
# "localhost";
|
||||
# "127.0.0.1";
|
||||
# "::1";
|
||||
#}
|
||||
|
||||
sub vcl_init {
|
||||
# Called when VCL is loaded, before any requests pass through it.
|
||||
# Typically used to initialize VMODs.
|
||||
|
||||
new vdir = directors.round_robin();
|
||||
vdir.add_backend(server1);
|
||||
# vdir.add_backend(servern);
|
||||
}
|
||||
|
||||
sub vcl_recv {
|
||||
# Called at the beginning of a request, after the complete request has been received and parsed.
|
||||
# Its purpose is to decide whether or not to serve the request, how to do it, and, if applicable,
|
||||
# which backend to use.
|
||||
# also used to modify the request
|
||||
|
||||
set req.backend_hint = vdir.backend(); # send all traffic to the vdir director
|
||||
|
||||
# Normalize the header, remove the port (in case you're testing this on various TCP ports)
|
||||
set req.http.Host = regsub(req.http.Host, ":[0-9]+", "");
|
||||
|
||||
# Remove the proxy header (see https://httpoxy.org/#mitigate-varnish)
|
||||
unset req.http.proxy;
|
||||
|
||||
# Normalize the query arguments
|
||||
set req.url = std.querysort(req.url);
|
||||
|
||||
# Allow purging
|
||||
if (req.method == "PURGE") {
|
||||
if (!client.ip ~ purge) { # purge is the ACL defined at the begining
|
||||
# Not from an allowed IP? Then die with an error.
|
||||
return (synth(405, "This IP is not allowed to send PURGE requests."));
|
||||
}
|
||||
# If you got this stage (and didn't error out above), purge the cached result
|
||||
return (purge);
|
||||
}
|
||||
|
||||
# Only deal with "normal" types
|
||||
if (req.method != "GET" &&
|
||||
req.method != "HEAD" &&
|
||||
req.method != "PUT" &&
|
||||
req.method != "POST" &&
|
||||
req.method != "TRACE" &&
|
||||
req.method != "OPTIONS" &&
|
||||
req.method != "PATCH" &&
|
||||
req.method != "DELETE") {
|
||||
# Non-RFC2616 or CONNECT which is weird.
|
||||
return (pipe);
|
||||
}
|
||||
|
||||
# Implementing websocket support (https://www.varnish-cache.org/docs/4.0/users-guide/vcl-example-websockets.html)
|
||||
if (req.http.Upgrade ~ "(?i)websocket") {
|
||||
return (pipe);
|
||||
}
|
||||
|
||||
# Only cache GET or HEAD requests. This makes sure the POST requests are always passed.
|
||||
if (req.method != "GET" && req.method != "HEAD") {
|
||||
return (pass);
|
||||
}
|
||||
|
||||
# Some generic URL manipulation, useful for all templates that follow
|
||||
# First remove the Google Analytics added parameters, useless for our backend
|
||||
if (req.url ~ "(\?|&)(utm_source|utm_medium|utm_campaign|utm_content|gclid|cx|ie|cof|siteurl)=") {
|
||||
set req.url = regsuball(req.url, "&(utm_source|utm_medium|utm_campaign|utm_content|gclid|cx|ie|cof|siteurl)=([A-z0-9_\-\.%25]+)", "");
|
||||
set req.url = regsuball(req.url, "\?(utm_source|utm_medium|utm_campaign|utm_content|gclid|cx|ie|cof|siteurl)=([A-z0-9_\-\.%25]+)", "?");
|
||||
set req.url = regsub(req.url, "\?&", "?");
|
||||
set req.url = regsub(req.url, "\?$", "");
|
||||
}
|
||||
|
||||
# Strip hash, server doesn't need it.
|
||||
if (req.url ~ "\#") {
|
||||
set req.url = regsub(req.url, "\#.*$", "");
|
||||
}
|
||||
|
||||
# Strip a trailing ? if it exists
|
||||
if (req.url ~ "\?$") {
|
||||
set req.url = regsub(req.url, "\?$", "");
|
||||
}
|
||||
|
||||
# Some generic cookie manipulation, useful for all templates that follow
|
||||
# Remove the "has_js" cookie
|
||||
set req.http.Cookie = regsuball(req.http.Cookie, "has_js=[^;]+(; )?", "");
|
||||
|
||||
# Remove any Google Analytics based cookies
|
||||
set req.http.Cookie = regsuball(req.http.Cookie, "__utm.=[^;]+(; )?", "");
|
||||
set req.http.Cookie = regsuball(req.http.Cookie, "_ga=[^;]+(; )?", "");
|
||||
set req.http.Cookie = regsuball(req.http.Cookie, "_gat=[^;]+(; )?", "");
|
||||
set req.http.Cookie = regsuball(req.http.Cookie, "utmctr=[^;]+(; )?", "");
|
||||
set req.http.Cookie = regsuball(req.http.Cookie, "utmcmd.=[^;]+(; )?", "");
|
||||
set req.http.Cookie = regsuball(req.http.Cookie, "utmccn.=[^;]+(; )?", "");
|
||||
|
||||
# Remove DoubleClick offensive cookies
|
||||
set req.http.Cookie = regsuball(req.http.Cookie, "__gads=[^;]+(; )?", "");
|
||||
|
||||
# Remove the Quant Capital cookies (added by some plugin, all __qca)
|
||||
set req.http.Cookie = regsuball(req.http.Cookie, "__qc.=[^;]+(; )?", "");
|
||||
|
||||
# Remove the AddThis cookies
|
||||
set req.http.Cookie = regsuball(req.http.Cookie, "__atuv.=[^;]+(; )?", "");
|
||||
|
||||
# Remove a ";" prefix in the cookie if present
|
||||
set req.http.Cookie = regsuball(req.http.Cookie, "^;\s*", "");
|
||||
|
||||
# Are there cookies left with only spaces or that are empty?
|
||||
if (req.http.cookie ~ "^\s*$") {
|
||||
unset req.http.cookie;
|
||||
}
|
||||
|
||||
if (req.http.Cache-Control ~ "(?i)no-cache") {
|
||||
#if (req.http.Cache-Control ~ "(?i)no-cache" && client.ip ~ editors) { # create the acl editors if you want to restrict the Ctrl-F5
|
||||
# http://varnish.projects.linpro.no/wiki/VCLExampleEnableForceRefresh
|
||||
# Ignore requests via proxy caches and badly behaved crawlers
|
||||
# like msnbot that send no-cache with every request.
|
||||
if (! (req.http.Via || req.http.User-Agent ~ "(?i)bot" || req.http.X-Purge)) {
|
||||
#set req.hash_always_miss = true; # Doesn't seems to refresh the object in the cache
|
||||
return(purge); # Couple this with restart in vcl_purge and X-Purge header to avoid loops
|
||||
}
|
||||
}
|
||||
|
||||
# Large static files are delivered directly to the end-user without
|
||||
# waiting for Varnish to fully read the file first.
|
||||
# Varnish 4 fully supports Streaming, so set do_stream in vcl_backend_response()
|
||||
if (req.url ~ "^[^?]*\.(7z|avi|bz2|flac|flv|gz|mka|mkv|mov|mp3|mp4|mpeg|mpg|ogg|ogm|opus|rar|tar|tgz|tbz|txz|wav|webm|xz|zip)(\?.*)?$") {
|
||||
unset req.http.Cookie;
|
||||
return (hash);
|
||||
}
|
||||
|
||||
# Remove all cookies for static files
|
||||
# A valid discussion could be held on this line: do you really need to cache static files that don't cause load? Only if you have memory left.
|
||||
# Sure, there's disk I/O, but chances are your OS will already have these files in their buffers (thus memory).
|
||||
# Before you blindly enable this, have a read here: https://ma.ttias.be/stop-caching-static-files/
|
||||
if (req.url ~ "^[^?]*\.(7z|avi|bmp|bz2|css|csv|doc|docx|eot|flac|flv|gif|gz|ico|jpeg|jpg|js|less|mka|mkv|mov|mp3|mp4|mpeg|mpg|odt|otf|ogg|ogm|opus|pdf|png|ppt|pptx|rar|rtf|svg|svgz|swf|tar|tbz|tgz|ttf|txt|txz|wav|webm|webp|woff|woff2|xls|xlsx|xml|xz|zip)(\?.*)?$") {
|
||||
unset req.http.Cookie;
|
||||
return (hash);
|
||||
}
|
||||
|
||||
# Send Surrogate-Capability headers to announce ESI support to backend
|
||||
set req.http.Surrogate-Capability = "key=ESI/1.0";
|
||||
|
||||
if (req.http.Authorization) {
|
||||
# Not cacheable by default
|
||||
return (pass);
|
||||
}
|
||||
|
||||
return (hash);
|
||||
}
|
||||
|
||||
sub vcl_pipe {
|
||||
# Called upon entering pipe mode.
|
||||
# In this mode, the request is passed on to the backend, and any further data from both the client
|
||||
# and backend is passed on unaltered until either end closes the connection. Basically, Varnish will
|
||||
# degrade into a simple TCP proxy, shuffling bytes back and forth. For a connection in pipe mode,
|
||||
# no other VCL subroutine will ever get called after vcl_pipe.
|
||||
|
||||
# Note that only the first request to the backend will have
|
||||
# X-Forwarded-For set. If you use X-Forwarded-For and want to
|
||||
# have it set for all requests, make sure to have:
|
||||
# set bereq.http.connection = "close";
|
||||
# here. It is not set by default as it might break some broken web
|
||||
# applications, like IIS with NTLM authentication.
|
||||
|
||||
# set bereq.http.Connection = "Close";
|
||||
|
||||
# Implementing websocket support (https://www.varnish-cache.org/docs/4.0/users-guide/vcl-example-websockets.html)
|
||||
if (req.http.upgrade) {
|
||||
set bereq.http.upgrade = req.http.upgrade;
|
||||
}
|
||||
|
||||
return (pipe);
|
||||
}
|
||||
|
||||
sub vcl_pass {
|
||||
# Called upon entering pass mode. In this mode, the request is passed on to the backend, and the
|
||||
# backend's response is passed on to the client, but is not entered into the cache. Subsequent
|
||||
# requests submitted over the same client connection are handled normally.
|
||||
|
||||
# return (pass);
|
||||
}
|
||||
|
||||
# The data on which the hashing will take place
|
||||
sub vcl_hash {
|
||||
# Called after vcl_recv to create a hash value for the request. This is used as a key
|
||||
# to look up the object in Varnish.
|
||||
|
||||
hash_data(req.url);
|
||||
|
||||
if (req.http.host) {
|
||||
hash_data(req.http.host);
|
||||
} else {
|
||||
hash_data(server.ip);
|
||||
}
|
||||
|
||||
# hash cookies for requests that have them
|
||||
if (req.http.Cookie) {
|
||||
hash_data(req.http.Cookie);
|
||||
}
|
||||
}
|
||||
|
||||
sub vcl_hit {
|
||||
# Called when a cache lookup is successful.
|
||||
|
||||
if (obj.ttl >= 0s) {
|
||||
# A pure unadultered hit, deliver it
|
||||
return (deliver);
|
||||
}
|
||||
|
||||
# https://www.varnish-cache.org/docs/trunk/users-guide/vcl-grace.html
|
||||
# When several clients are requesting the same page Varnish will send one request to the backend and place the others on hold while fetching one copy from the backend. In some products this is called request coalescing and Varnish does this automatically.
|
||||
# If you are serving thousands of hits per second the queue of waiting requests can get huge. There are two potential problems - one is a thundering herd problem - suddenly releasing a thousand threads to serve content might send the load sky high. Secondly - nobody likes to wait. To deal with this we can instruct Varnish to keep the objects in cache beyond their TTL and to serve the waiting requests somewhat stale content.
|
||||
|
||||
# if (!std.healthy(req.backend_hint) && (obj.ttl + obj.grace > 0s)) {
|
||||
# return (deliver);
|
||||
# } else {
|
||||
# return (fetch);
|
||||
# }
|
||||
|
||||
# We have no fresh fish. Lets look at the stale ones.
|
||||
if (std.healthy(req.backend_hint)) {
|
||||
# Backend is healthy. Limit age to 10s.
|
||||
if (obj.ttl + 10s > 0s) {
|
||||
#set req.http.grace = "normal(limited)";
|
||||
return (deliver);
|
||||
} else {
|
||||
# No candidate for grace. Fetch a fresh object.
|
||||
return(fetch);
|
||||
}
|
||||
} else {
|
||||
# backend is sick - use full grace
|
||||
if (obj.ttl + obj.grace > 0s) {
|
||||
#set req.http.grace = "full";
|
||||
return (deliver);
|
||||
} else {
|
||||
# no graced object.
|
||||
return (fetch);
|
||||
}
|
||||
}
|
||||
|
||||
# fetch & deliver once we get the result
|
||||
return (fetch); # Dead code, keep as a safeguard
|
||||
}
|
||||
|
||||
sub vcl_miss {
|
||||
# Called after a cache lookup if the requested document was not found in the cache. Its purpose
|
||||
# is to decide whether or not to attempt to retrieve the document from the backend, and which
|
||||
# backend to use.
|
||||
|
||||
return (fetch);
|
||||
}
|
||||
|
||||
# Handle the HTTP request coming from our backend
|
||||
sub vcl_backend_response {
|
||||
# Called after the response headers has been successfully retrieved from the backend.
|
||||
|
||||
# Pause ESI request and remove Surrogate-Control header
|
||||
if (beresp.http.Surrogate-Control ~ "ESI/1.0") {
|
||||
unset beresp.http.Surrogate-Control;
|
||||
set beresp.do_esi = true;
|
||||
}
|
||||
|
||||
# Enable cache for all static files
|
||||
# The same argument as the static caches from above: monitor your cache size, if you get data nuked out of it, consider giving up the static file cache.
|
||||
# Before you blindly enable this, have a read here: https://ma.ttias.be/stop-caching-static-files/
|
||||
if (bereq.url ~ "^[^?]*\.(7z|avi|bmp|bz2|css|csv|doc|docx|eot|flac|flv|gif|gz|ico|jpeg|jpg|js|less|mka|mkv|mov|mp3|mp4|mpeg|mpg|odt|otf|ogg|ogm|opus|pdf|png|ppt|pptx|rar|rtf|svg|svgz|swf|tar|tbz|tgz|ttf|txt|txz|wav|webm|webp|woff|woff2|xls|xlsx|xml|xz|zip)(\?.*)?$") {
|
||||
unset beresp.http.set-cookie;
|
||||
}
|
||||
|
||||
# Large static files are delivered directly to the end-user without
|
||||
# waiting for Varnish to fully read the file first.
|
||||
# Varnish 4 fully supports Streaming, so use streaming here to avoid locking.
|
||||
if (bereq.url ~ "^[^?]*\.(7z|avi|bz2|flac|flv|gz|mka|mkv|mov|mp3|mp4|mpeg|mpg|ogg|ogm|opus|rar|tar|tgz|tbz|txz|wav|webm|xz|zip)(\?.*)?$") {
|
||||
unset beresp.http.set-cookie;
|
||||
set beresp.do_stream = true; # Check memory usage it'll grow in fetch_chunksize blocks (128k by default) if the backend doesn't send a Content-Length header, so only enable it for big objects
|
||||
}
|
||||
|
||||
# Sometimes, a 301 or 302 redirect formed via Apache's mod_rewrite can mess with the HTTP port that is being passed along.
|
||||
# This often happens with simple rewrite rules in a scenario where Varnish runs on :80 and Apache on :8080 on the same box.
|
||||
# A redirect can then often redirect the end-user to a URL on :8080, where it should be :80.
|
||||
# This may need finetuning on your setup.
|
||||
#
|
||||
# To prevent accidental replace, we only filter the 301/302 redirects for now.
|
||||
if (beresp.status == 301 || beresp.status == 302) {
|
||||
set beresp.http.Location = regsub(beresp.http.Location, ":[0-9]+", "");
|
||||
}
|
||||
|
||||
# Set 2min cache if unset for static files
|
||||
if (beresp.ttl <= 0s || beresp.http.Set-Cookie || beresp.http.Vary == "*") {
|
||||
set beresp.ttl = 120s; # Important, you shouldn't rely on this, SET YOUR HEADERS in the backend
|
||||
set beresp.uncacheable = true;
|
||||
return (deliver);
|
||||
}
|
||||
|
||||
# Don't cache 50x responses
|
||||
if (beresp.status == 500 || beresp.status == 502 || beresp.status == 503 || beresp.status == 504) {
|
||||
return (abandon);
|
||||
}
|
||||
|
||||
# Allow stale content, in case the backend goes down.
|
||||
# make Varnish keep all objects for 6 hours beyond their TTL
|
||||
set beresp.grace = 6h;
|
||||
|
||||
return (deliver);
|
||||
}
|
||||
|
||||
# The routine when we deliver the HTTP request to the user
|
||||
# Last chance to modify headers that are sent to the client
|
||||
sub vcl_deliver {
|
||||
# Called before a cached object is delivered to the client.
|
||||
|
||||
if (obj.hits > 0) { # Add debug header to see if it's a HIT/MISS and the number of hits, disable when not needed
|
||||
set resp.http.X-Cache = "HIT";
|
||||
} else {
|
||||
set resp.http.X-Cache = "MISS";
|
||||
}
|
||||
|
||||
# Please note that obj.hits behaviour changed in 4.0, now it counts per objecthead, not per object
|
||||
# and obj.hits may not be reset in some cases where bans are in use. See bug 1492 for details.
|
||||
# So take hits with a grain of salt
|
||||
set resp.http.X-Cache-Hits = obj.hits;
|
||||
|
||||
# Remove some headers: PHP version
|
||||
unset resp.http.X-Powered-By;
|
||||
|
||||
# Remove some headers: Apache version & OS
|
||||
unset resp.http.Server;
|
||||
unset resp.http.X-Drupal-Cache;
|
||||
unset resp.http.X-Varnish;
|
||||
unset resp.http.Via;
|
||||
unset resp.http.Link;
|
||||
unset resp.http.X-Generator;
|
||||
unset resp.http.X-Debug-Token;
|
||||
unset resp.http.X-Debug-Token-Link;
|
||||
set resp.http.Server = "${VARNISH_SERVER}";
|
||||
set resp.http.X-Powered-By = "MSI<surya.kejawen@gmail.com>";
|
||||
|
||||
return (deliver);
|
||||
}
|
||||
|
||||
sub vcl_purge {
|
||||
# Only handle actual PURGE HTTP methods, everything else is discarded
|
||||
if (req.method != "PURGE") {
|
||||
# restart request
|
||||
set req.http.X-Purge = "Yes";
|
||||
return(restart);
|
||||
}
|
||||
}
|
||||
|
||||
sub vcl_synth {
|
||||
if (resp.status == 720) {
|
||||
# We use this special error status 720 to force redirects with 301 (permanent) redirects
|
||||
# To use this, call the following from anywhere in vcl_recv: return (synth(720, "http://host/new.html"));
|
||||
set resp.http.Location = resp.reason;
|
||||
set resp.status = 301;
|
||||
return (deliver);
|
||||
} elseif (resp.status == 721) {
|
||||
# And we use error status 721 to force redirects with a 302 (temporary) redirect
|
||||
# To use this, call the following from anywhere in vcl_recv: return (synth(720, "http://host/new.html"));
|
||||
set resp.http.Location = resp.reason;
|
||||
set resp.status = 302;
|
||||
return (deliver);
|
||||
}
|
||||
|
||||
return (deliver);
|
||||
}
|
||||
|
||||
|
||||
sub vcl_fini {
|
||||
# Called when VCL is discarded only after all requests have exited the VCL.
|
||||
# Typically used to clean up VMODs.
|
||||
|
||||
return (ok);
|
||||
}
|
17
varnish/start.sh
Normal file
17
varnish/start.sh
Normal file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
for name in BACKEND_PORT BACKEND_HOST VARNISH_SERVER
|
||||
do
|
||||
eval value=\$$name
|
||||
sed -i "s|\${${name}}|${value}|g" /etc/varnish/default.vcl
|
||||
done
|
||||
|
||||
exec bash -c \
|
||||
"exec varnishd \
|
||||
-a :$VARNISH_PORT \
|
||||
-T localhost:6082 \
|
||||
-F -u varnish \
|
||||
-f $VARNISH_CONFIG \
|
||||
-s malloc,$CACHE_SIZE \
|
||||
$VARNISHD_PARAMS"
|
@ -12,7 +12,7 @@
|
||||
|
||||
FROM laradock/workspace:1.3 # placeholder. Need change after new image would be built.
|
||||
|
||||
MAINTAINER MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
|
||||
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
|
||||
|
||||
#
|
||||
#--------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user