541-add-linuxbrew-option (#543)

* 541-add-linuxbrew-option

* 541 updated readme with installation information
This commit is contained in:
Mike Erickson 2017-01-13 11:12:44 -08:00 committed by Philippe Trépanier
parent fbc71b5a22
commit a80ef301a9
3 changed files with 77 additions and 14 deletions

View File

@ -4,7 +4,7 @@
[![Gitter](https://badges.gitter.im/LaraDock/laradock.svg)](https://gitter.im/LaraDock/laradock?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Gitter](https://badges.gitter.im/LaraDock/laradock.svg)](https://gitter.im/LaraDock/laradock?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
Laradock is a Docker PHP development environment. It facilitate running **PHP** Apps on **Docker**. Laradock is a Docker PHP development environment. It facilitate running **PHP** Apps on **Docker**.
>Use Docker first and learn about it later. >Use Docker first and learn about it later.
@ -87,6 +87,7 @@ Laradock is configured to run Laravel Apps by default, and it can be modified to
- [Install Prestissimo](#Install-Prestissimo) - [Install Prestissimo](#Install-Prestissimo)
- [Install Node + NVM](#Install-Node) - [Install Node + NVM](#Install-Node)
- [Install Node + YARN](#Install-Yarn) - [Install Node + YARN](#Install-Yarn)
- [Install Linuxbrew](#Install-Brew)
- [Debugging](#debugging) - [Debugging](#debugging)
- [Upgrading LaraDock](#upgrading-laradock) - [Upgrading LaraDock](#upgrading-laradock)
- [Related Projects](#related-projects) - [Related Projects](#related-projects)
@ -101,13 +102,13 @@ Laradock is configured to run Laravel Apps by default, and it can be modified to
Let's see how easy it is to install `NGINX`, `PHP`, `Composer`, `MySQL`, `Redis` and `Beanstalkd`: Let's see how easy it is to install `NGINX`, `PHP`, `Composer`, `MySQL`, `Redis` and `Beanstalkd`:
1 - Clone Laradock inside your PHP project: 1 - Clone Laradock inside your PHP project:
```shell ```shell
git clone https://github.com/Laradock/laradock.git git clone https://github.com/Laradock/laradock.git
``` ```
2 - Enter the laradock folder and run this command: 2 - Enter the laradock folder and run this command:
```shell ```shell
docker-compose up -d nginx mysql redis beanstalkd docker-compose up -d nginx mysql redis beanstalkd
@ -316,7 +317,7 @@ Note: In this case the folder structure will be like this:
- myProject - myProject
``` ```
2 - Edit the `docker-compose.yml` file to map to your project directory once you have it (example: `- ../myProject:/var/www`). 2 - Edit the `docker-compose.yml` file to map to your project directory once you have it (example: `- ../myProject:/var/www`).
3 - Stop and re-run your docker-compose command for the changes to take place. 3 - Stop and re-run your docker-compose command for the changes to take place.
@ -798,7 +799,7 @@ To control the behavior of xDebug (in the `php-fpm` Container), you can run the
<a name="LaraDock-for-Production"></a> <a name="LaraDock-for-Production"></a>
### Prepare LaraDock for Production ### Prepare LaraDock for Production
It's recommended for production to create a custom `docker-compose.yml` file. For that reason, LaraDock is shipped with `production-docker-compose.yml` which should contain only the containers you are planning to run on production (usage exampe: `docker-compose -f production-docker-compose.yml up -d nginx mysql redis ...`). It's recommended for production to create a custom `docker-compose.yml` file. For that reason, LaraDock is shipped with `production-docker-compose.yml` which should contain only the containers you are planning to run on production (usage exampe: `docker-compose -f production-docker-compose.yml up -d nginx mysql redis ...`).
Note: The Database (MySQL/MariaDB/...) ports should not be forwarded on production, because Docker will automatically publish the port on the host, which is quite insecure, unless specifically told not to. So make sure to remove these lines: Note: The Database (MySQL/MariaDB/...) ports should not be forwarded on production, because Docker will automatically publish the port on the host, which is quite insecure, unless specifically told not to. So make sure to remove these lines:
@ -1213,15 +1214,15 @@ docker-compose up -d rethinkdb
```php ```php
'connections' => [ 'connections' => [
'rethinkdb' => [ 'rethinkdb' => [
'name' => 'rethinkdb', 'name' => 'rethinkdb',
'driver' => 'rethinkdb', 'driver' => 'rethinkdb',
'host' => env('DB_HOST', 'rethinkdb'), 'host' => env('DB_HOST', 'rethinkdb'),
'port' => env('DB_PORT', 28015), 'port' => env('DB_PORT', 28015),
'database' => env('DB_DATABASE', 'test'), 'database' => env('DB_DATABASE', 'test'),
] ]
// ... // ...
], ],
@ -1319,7 +1320,7 @@ Make sure you [change the timezone](#Change-the-timezone) if you don't want to u
<br> <br>
<a name="Workspace-ssh"></a> <a name="Workspace-ssh"></a>
### Access workspace via ssh ### Access workspace via ssh
You can access the `workspace` container through `localhost:2222` by setting the `INSTALL_WORKSPACE_SSH` build argument to `true`. You can access the `workspace` container through `localhost:2222` by setting the `INSTALL_WORKSPACE_SSH` build argument to `true`.
To change the default forwarded port for ssh: To change the default forwarded port for ssh:
@ -1378,7 +1379,7 @@ The default username and password for the root mysql user are `root` and `root `
Modify the `mysql/my.cnf` file to set your port number, `1234` is used as an example. Modify the `mysql/my.cnf` file to set your port number, `1234` is used as an example.
``` ```
[mysqld] [mysqld]
port=1234 port=1234
``` ```
@ -1524,6 +1525,34 @@ It should be like this:
<br>
<a name="Install-Linuxbrew"></a>
### Install Linuxbrew
Linuxbrew is a package manager for Linux. It is the Linux version of MacOS Homebrew and can be found [here](http://linuxbrew.sh). To install Linuxbrew in the Workspace container:
1 - Open the `docker-compose.yml` file
2 - Search for the `INSTALL_LINUXBREW` argument under the Workspace Container and set it to `true`
It should be like this:
```yml
workspace:
build:
context: ./workspace
args:
- INSTALL_LINUXBREW=true
...
```
3 - Re-build the container `docker-compose build workspace`
<br> <br>
<a name="Install-Aerospike-Extension"></a> <a name="Install-Aerospike-Extension"></a>
### Install Aerospike extension ### Install Aerospike extension
@ -1659,7 +1688,7 @@ Make sure the ports for the services that you are trying to run (22, 80, 443, 33
#### I get Nginx error 404 Not Found on Windows. #### I get Nginx error 404 Not Found on Windows.
1. Go to docker Settings on your Windows machine. 1. Go to docker Settings on your Windows machine.
2. Click on the `Shared Drives` tab and check the drive that contains your project files. 2. Click on the `Shared Drives` tab and check the drive that contains your project files.
3. Enter your windows username and password. 3. Enter your windows username and password.
4. Go to the `reset` tab and click restart docker. 4. Go to the `reset` tab and click restart docker.
@ -1701,7 +1730,7 @@ Moving from Docker Toolbox (VirtualBox) to Docker Native (for Mac/Windows). Requ
3. Upgrade LaraDock to `v4.*.*` (`git pull origin master`) 3. Upgrade LaraDock to `v4.*.*` (`git pull origin master`)
4. Use LaraDock as you used to do: `docker-compose up -d nginx mysql`. 4. Use LaraDock as you used to do: `docker-compose up -d nginx mysql`.
**Note:** If you face any problem with the last step above: rebuild all your containers **Note:** If you face any problem with the last step above: rebuild all your containers
`docker-compose build --no-cache` `docker-compose build --no-cache`
"Warnning Containers Data might be lost!" "Warnning Containers Data might be lost!"

View File

@ -26,6 +26,7 @@ services:
- COMPOSER_GLOBAL_INSTALL=false - COMPOSER_GLOBAL_INSTALL=false
- INSTALL_WORKSPACE_SSH=false - INSTALL_WORKSPACE_SSH=false
- INSTALL_LARAVEL_ENVOY=false - INSTALL_LARAVEL_ENVOY=false
- INSTALL_LINUXBREW=false
- PUID=1000 - PUID=1000
- PGID=1000 - PGID=1000
- NODE_VERSION=stable - NODE_VERSION=stable
@ -118,7 +119,7 @@ services:
### MySQL Container ######################################### ### MySQL Container #########################################
mysql: mysql:
build: build:
context: ./mysql context: ./mysql
args: args:
- MYSQL_DATABASE=homestead - MYSQL_DATABASE=homestead
@ -190,7 +191,7 @@ services:
- "27017:27017" - "27017:27017"
volumes: volumes:
- mongo:/data/db - mongo:/data/db
### RethinkDB Container ####################################### ### RethinkDB Container #######################################
rethinkdb: rethinkdb:

View File

@ -291,6 +291,39 @@ RUN if [ ${INSTALL_LARAVEL_ENVOY} = true ]; then \
&& composer global require "laravel/envoy=~1.0" \ && composer global require "laravel/envoy=~1.0" \
;fi ;fi
#####################################
# Linuxbrew:
#####################################
USER root
ARG INSTALL_LINUXBREW=true
ENV INSTALL_LINUXBREW ${INSTALL_LINUXBREW}
RUN if [ ${INSTALL_LINUXBREW} = true ]; then \
# Preparation
apt-get update && \
apt-get upgrade -y && \
apt-get install -y build-essential make cmake scons curl git \
ruby autoconf automake autoconf-archive \
gettext libtool flex bison \
libbz2-dev libcurl4-openssl-dev \
libexpat-dev libncurses-dev && \
# Install the Linuxbrew
git clone https://github.com/Homebrew/linuxbrew.git ~/.linuxbrew && \
echo "" >> ~/.bashrc && \
echo 'export PKG_CONFIG_PATH"=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig:/usr/lib64/pkgconfig:/usr/lib/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib64/pkgconfig:/usr/share/pkgconfig:$PKG_CONFIG_PATH"' >> ~/.bashrc && \
# Setup linuxbrew
echo 'export LINUXBREWHOME="$HOME/.linuxbrew"' >> ~/.bashrc && \
echo 'export PATH="$LINUXBREWHOME/bin:$PATH"' >> ~/.bashrc && \
echo 'export MANPATH="$LINUXBREWHOME/man:$MANPATH"' >> ~/.bashrc && \
echo 'export PKG_CONFIG_PATH="$LINUXBREWHOME/lib64/pkgconfig:$LINUXBREWHOME/lib/pkgconfig:$PKG_CONFIG_PATH"' >> ~/.bashrc && \
echo 'export LD_LIBRARY_PATH="$LINUXBREWHOME/lib64:$LINUXBREWHOME/lib:$LD_LIBRARY_PATH"' >> ~/.bashrc \
;fi
# #
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Final Touch # Final Touch