From c5c8c9bc8587b4e533e028f6f16177468014f3b3 Mon Sep 17 00:00:00 2001 From: pushorigin Date: Fri, 13 Mar 2020 03:16:39 +0300 Subject: [PATCH] new feature: Install Oh My ZSH! with Laravel autocomplete plugin --- DOCUMENTATION/content/documentation/index.md | 31 ++++++++++++++++---- docker-compose.yml | 1 + env-example | 8 ++++- workspace/Dockerfile | 31 ++++++++++++++++++++ 4 files changed, 64 insertions(+), 7 deletions(-) diff --git a/DOCUMENTATION/content/documentation/index.md b/DOCUMENTATION/content/documentation/index.md index 8bf6247..c6e54ca 100644 --- a/DOCUMENTATION/content/documentation/index.md +++ b/DOCUMENTATION/content/documentation/index.md @@ -793,20 +793,20 @@ Read the [Laravel official documentation](https://laravel.com/docs/5.7/redis#con ## Use Varnish The goal was to proxy request to varnish server using nginx. So only nginx has been configured for Varnish proxy. -Nginx is on port 80 or 443. Nginx sends request through varnish server and varnish server sends request back to nginx on port 81 (external port is defined in `VARNISH_BACKEND_PORT`). +Nginx is on port 80 or 443. Nginx sends request through varnish server and varnish server sends request back to nginx on port 81 (external port is defined in `VARNISH_BACKEND_PORT`). -The idea was taken from this [post](https://www.linode.com/docs/websites/varnish/use-varnish-and-nginx-to-serve-wordpress-over-ssl-and-http-on-debian-8/) +The idea was taken from this [post](https://www.linode.com/docs/websites/varnish/use-varnish-and-nginx-to-serve-wordpress-over-ssl-and-http-on-debian-8/) The Varnish configuration was developed and tested for Wordpress only. Probably it works with other systems. #### Steps to configure varnish proxy server: 1. You have to set domain name for VARNISH_PROXY1_BACKEND_HOST variable. 2. If you want to use varnish for different domains, you have to add new configuration section in your env file. - ``` + ``` VARNISH_PROXY1_CACHE_SIZE=128m VARNISH_PROXY1_BACKEND_HOST=replace_with_your_domain.name VARNISH_PROXY1_SERVER=SERVER1 - ``` + ``` 3. Then you have to add new config section into docker-compose.yml with related variables: ``` custom_proxy_name: @@ -828,7 +828,7 @@ The Varnish configuration was developed and tested for Wordpress only. Probably - workspace networks: - frontend - ``` + ``` 4. change your varnish config and add nginx configuration. Example Nginx configuration is here: `nginx/sites/laravel_varnish.conf.example`. 5. `varnish/default.vcl` is old varnish configuration, which was used in the previous version. Use `default_wordpress.vcl` instead. @@ -2011,7 +2011,7 @@ To install Supervisor in the Workspace container 3 - Create supervisor configuration file (for ex., named `laravel-worker.conf`) for Laravel Queue Worker in `php-worker/supervisord.d/` by simply copy from `laravel-worker.conf.example` -4 - Re-build the container `docker-compose build workspace` Or `docker-composer up --build -d workspace` +4 - Re-build the container `docker-compose build workspace` Or `docker-composer up --build -d workspace` @@ -2162,8 +2162,27 @@ A bash prompt that displays information about the current git repository. In par **Note** You can configure bash-git-prompt by editing the `workspace/gitprompt.sh` file and re-building the workspace container. For configuration information, visit the [bash-git-prompt repository](https://github.com/magicmonty/bash-git-prompt). +
+ +## Install Oh My ZSH! with Laravel autocomplete plugin +[Zsh](https://en.wikipedia.org/wiki/Z_shell) is an extended Bourne shell with many improvements, including some features of Bash, ksh, and tcsh. +[Oh My Zsh](https://ohmyz.sh/) is a delightful, open source, community-driven framework for managing your Zsh configuration. + +[Laravel autocomplete plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/laravel) adds aliases and autocompletion for Laravel Artisan and Bob command-line interfaces. + +1 - Open the `.env` file + +2 - Search for the `SHELL_OH_MY_ZSH` argument under the Workspace Container + +3 - Set it to `true` + +4 - Re-build the container `docker-compose build workspace` + +5 - Use it `docker-compose exec --user=laradock workspace zsh` + +**Note** You can configure Oh My ZSH by editing the `/home/laradock/.zshrc` in running container.
diff --git a/docker-compose.yml b/docker-compose.yml index 63dbded..5c353a2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -60,6 +60,7 @@ services: context: ./workspace args: - CHANGE_SOURCE=${CHANGE_SOURCE} + - SHELL_OH_MY_ZSH=${SHELL_OH_MY_ZSH} - UBUNTU_SOURCE=${UBUNTU_SOURCE} - LARADOCK_PHP_VERSION=${PHP_VERSION} - LARADOCK_PHALCON_VERSION=${PHALCON_VERSION} diff --git a/env-example b/env-example index 43d913d..6661780 100644 --- a/env-example +++ b/env-example @@ -78,6 +78,12 @@ UBUNTU_SOURCE=aliyun # If you are using Docker Sync. For `osx` use 'native_osx', for `windows` use 'unison', for `linux` docker-sync is not required DOCKER_SYNC_STRATEGY=native_osx +### Install Oh My ZSH! #################################### + +# If you want to use "Oh My ZSH!" with Laravel autocomplete plugin, set SHELL_OH_MY_ZSH to true. + +SHELL_OH_MY_ZSH=false + ########################################################### ################ Containers Customization ################# ########################################################### @@ -859,7 +865,7 @@ GEARMAN_MYSQL_PORT=3306 # Mysql server user (Default: root) GEARMAN_MYSQL_USER=root # Mysql password -GEARMAN_MYSQL_PASSWORD= +GEARMAN_MYSQL_PASSWORD= # Path to file with mysql password(Docker secrets) GEARMAN_MYSQL_PASSWORD_FILE= # Database to use by Gearman (Default: Gearmand) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 48d9ebc..8d00c47 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -1304,6 +1304,37 @@ RUN if [ ${INSTALL_GIT_PROMPT} = true ]; then \ RUN set -xe; php -v | head -n 1 | grep -q "PHP ${LARADOCK_PHP_VERSION}." +########################################################################### +# Oh My ZSH! +########################################################################### + +USER root + +ARG SHELL_OH_MY_ZSH=false +RUN if [ ${SHELL_OH_MY_ZSH} = true ]; then \ + apt install -y zsh \ +;fi + +USER laradock +RUN if [ ${SHELL_OH_MY_ZSH} = true ]; then \ + sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh) --keep-zshrc" && \ + sed -i -r 's/^plugins=\(.*?\)$/plugins=(laravel5)/' /home/laradock/.zshrc && \ + echo '\n\ +bindkey "^[OB" down-line-or-search\n\ +bindkey "^[OC" forward-char\n\ +bindkey "^[OD" backward-char\n\ +bindkey "^[OF" end-of-line\n\ +bindkey "^[OH" beginning-of-line\n\ +bindkey "^[[1~" beginning-of-line\n\ +bindkey "^[[3~" delete-char\n\ +bindkey "^[[4~" end-of-line\n\ +bindkey "^[[5~" up-line-or-history\n\ +bindkey "^[[6~" down-line-or-history\n\ +bindkey "^?" backward-delete-char\n' >> /home/laradock/.zshrc \ +;fi + +USER root + # #-------------------------------------------------------------------------- # Final Touch