new feature: Install Oh My ZSH! with Laravel autocomplete plugin

This commit is contained in:
pushorigin 2020-03-13 03:16:39 +03:00
parent 123e52e563
commit c5c8c9bc85
4 changed files with 64 additions and 7 deletions

View File

@ -793,20 +793,20 @@ Read the [Laravel official documentation](https://laravel.com/docs/5.7/redis#con
## Use Varnish ## Use Varnish
The goal was to proxy request to varnish server using nginx. So only nginx has been configured for Varnish proxy. 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. The Varnish configuration was developed and tested for Wordpress only. Probably it works with other systems.
#### Steps to configure varnish proxy server: #### Steps to configure varnish proxy server:
1. You have to set domain name for VARNISH_PROXY1_BACKEND_HOST variable. 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. 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_CACHE_SIZE=128m
VARNISH_PROXY1_BACKEND_HOST=replace_with_your_domain.name VARNISH_PROXY1_BACKEND_HOST=replace_with_your_domain.name
VARNISH_PROXY1_SERVER=SERVER1 VARNISH_PROXY1_SERVER=SERVER1
``` ```
3. Then you have to add new config section into docker-compose.yml with related variables: 3. Then you have to add new config section into docker-compose.yml with related variables:
``` ```
custom_proxy_name: custom_proxy_name:
@ -828,7 +828,7 @@ The Varnish configuration was developed and tested for Wordpress only. Probably
- workspace - workspace
networks: networks:
- frontend - frontend
``` ```
4. change your varnish config and add nginx configuration. Example Nginx configuration is here: `nginx/sites/laravel_varnish.conf.example`. 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. 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` 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. **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). For configuration information, visit the [bash-git-prompt repository](https://github.com/magicmonty/bash-git-prompt).
<br>
<a name="Install-Oh-My-Zsh"></a>
## 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.
<br> <br>
<a name="phpstorm-debugging"></a> <a name="phpstorm-debugging"></a>

View File

@ -60,6 +60,7 @@ services:
context: ./workspace context: ./workspace
args: args:
- CHANGE_SOURCE=${CHANGE_SOURCE} - CHANGE_SOURCE=${CHANGE_SOURCE}
- SHELL_OH_MY_ZSH=${SHELL_OH_MY_ZSH}
- UBUNTU_SOURCE=${UBUNTU_SOURCE} - UBUNTU_SOURCE=${UBUNTU_SOURCE}
- LARADOCK_PHP_VERSION=${PHP_VERSION} - LARADOCK_PHP_VERSION=${PHP_VERSION}
- LARADOCK_PHALCON_VERSION=${PHALCON_VERSION} - LARADOCK_PHALCON_VERSION=${PHALCON_VERSION}

View File

@ -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 # 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 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 ################# ################ Containers Customization #################
########################################################### ###########################################################
@ -859,7 +865,7 @@ GEARMAN_MYSQL_PORT=3306
# Mysql server user (Default: root) # Mysql server user (Default: root)
GEARMAN_MYSQL_USER=root GEARMAN_MYSQL_USER=root
# Mysql password # Mysql password
GEARMAN_MYSQL_PASSWORD= GEARMAN_MYSQL_PASSWORD=
# Path to file with mysql password(Docker secrets) # Path to file with mysql password(Docker secrets)
GEARMAN_MYSQL_PASSWORD_FILE= GEARMAN_MYSQL_PASSWORD_FILE=
# Database to use by Gearman (Default: Gearmand) # Database to use by Gearman (Default: Gearmand)

View File

@ -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}." 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 # Final Touch