DVL-012 be able to customize bash config files

This commit is contained in:
cytopia 2017-08-17 21:20:41 +02:00
parent 5c22c045a1
commit bb0a15f4e6
No known key found for this signature in database
GPG Key ID: 6D56EDB8695128A2
11 changed files with 50 additions and 31 deletions

4
.gitignore vendored
View File

@ -53,6 +53,10 @@
/mod/php-fpm-7.2/*.so
/mod/hhvm-latest/*.so
# Ignore custom bash and other confi files
/bash/*
!/bash/bashrc.sh-example
!/bash/README.md
######################################
# GENERIC

View File

@ -165,15 +165,16 @@ Every single attachable container comes with many different versions. In order t
#### Enter the container
You can also work directly inside the php container. Simply use the bundled scripts `bash.sh` or `root_bash.sh`. The `PS1` will automatically be populated with current chosen php version.
You can also work directly inside the php container. Simply use the bundled scripts `shell.sh`. The `PS1` will automatically be populated with current chosen php version.
```shell
# Enter as user devilbox (normal operation / development)
host> ./bash.sh
host> ./shell.sh
devilbox@php-7.0.19 in /shared/httpd $
```
```shell
# Enter as root user (do root stuff)
host> ./root_bash.sh
host> ./shell.sh
devilbox@php-7.0.19 in /shared/httpd $ sudo su -
root@php-7.0.19 in /shared/httpd $
```

0
bash/README.md Normal file
View File

14
bash/bashrc.sh-example Normal file
View File

@ -0,0 +1,14 @@
# Bashrc folder
#
# 1. This folder will be mounted to /etc/bashrc-devilbox.d
# 2. All files ending by *.sh will be sourced by bash automatically
# for the devilbox and root user.
#
# Add your custom vimrc and always load it with vim.
# Also make sure you add vimrc to this folder.
alias vim='vim -u /etc/bashrc-devilbox.d/vimrc

View File

@ -185,6 +185,9 @@ services:
# to load custom PHP modules
- ${DEVILBOX_PATH}/mod/${PHP_SERVER}:/usr/lib64/php/custom-modules:ro
# Mount devilbox user-defined bash config
- ${DEVILBOX_PATH}/bash:/etc/bashrc-devilbox.d
# Mount custom mass virtual hosting
# (configured in /etc/${HTTPD_SERVER}/02-vhost-mass.conf)
- ${HOST_PATH_HTTPD_DATADIR}:/shared/httpd

View File

@ -81,7 +81,7 @@ There are many different options to backup your MySQL database including some fo
```shell
# Enter the Container
host> ./bash.sh
host> ./shell.sh
# Start the backup
devilbox@php-7.1.6 in /shared/httpd $ mysqldump-secure
@ -209,7 +209,7 @@ To find out more about the configuration and options of mysqldump-secure, visit
```shell
# Enter the Container
host> ./bash.sh
host> ./shell.sh
# Start the backup
devilbox@php-7.1.6 in /shared/httpd $ mysqldump -h mysql -u root -p my_db_name > /shared/backups/mysql/my_db_name.sql
@ -239,7 +239,7 @@ In order to restore or import mysql databases on the command line, you need to u
```shell
# Enter the Container
host> ./bash.sh
host> ./shell.sh
# Start the import
devilbox@php-7.1.6 in /shared/httpd $ mysql -h mysql -u root -p my_db_name < /shared/backups/mysql/my_db_name.sql
@ -249,7 +249,7 @@ devilbox@php-7.1.6 in /shared/httpd $ mysql -h mysql -u root -p my_db_name < /sh
```shell
# Enter the Container
host> ./bash.sh
host> ./shell.sh
# Start the import
devilbox@php-7.1.6 in /shared/httpd $ zcat /shared/backups/mysql/my_db_name.sql.gz | mysql -h mysql -u root -p my_db_name
@ -259,7 +259,7 @@ devilbox@php-7.1.6 in /shared/httpd $ zcat /shared/backups/mysql/my_db_name.sql.
```shell
# Enter the Container
host> ./bash.sh
host> ./shell.sh
# Start the import
devilbox@php-7.1.6 in /shared/httpd $ tar xzOf /shared/backups/mysql/my_db_name.sql.tar.gz | mysql -h mysql -u root -p my_db_name
@ -284,7 +284,7 @@ devilbox@php-7.1.6 in /shared/httpd $ tar xzOf /shared/backups/mysql/my_db_name.
```shell
# Enter the Container
host> ./bash.sh
host> ./shell.sh
# Start the import
devilbox@php-7.1.6 in /shared/httpd $ pg_dump -h pgsql -U postgres -W my_db_name > /shared/backups/pgsql/my_db_name.sql
@ -308,7 +308,7 @@ In order to restore or import PostgreSQL databases on the command line, you need
```shell
# Enter the Container
host> ./bash.sh
host> ./shell.sh
# Start the import
devilbox@php-7.1.6 in /shared/httpd $ psql -h pgsql -U postgres -W my_db_name < /shared/backups/pgsql/my_db_name.sql
@ -318,7 +318,7 @@ devilbox@php-7.1.6 in /shared/httpd $ psql -h pgsql -U postgres -W my_db_name <
```shell
# Enter the Container
host> ./bash.sh
host> ./shell.sh
# Start the import
devilbox@php-7.1.6 in /shared/httpd $ zcat /shared/backups/pgsql/my_db_name.sql.gz | psql -h pgsql -U postgres -W my_db_name
@ -328,7 +328,7 @@ devilbox@php-7.1.6 in /shared/httpd $ zcat /shared/backups/pgsql/my_db_name.sql.
```shell
# Enter the Container
host> ./bash.sh
host> ./shell.sh
# Start the import
devilbox@php-7.1.6 in /shared/httpd $ tar xzOf /shared/backups/pgsql/my_db_name.sql.tar.gz | psql -h pgsql -U postgres -W my_db_name
@ -349,7 +349,7 @@ devilbox@php-7.1.6 in /shared/httpd $ tar xzOf /shared/backups/pgsql/my_db_name.
```shell
# Enter the Container
host> ./bash.sh
host> ./shell.sh
# Start the dump into /shared/backups/mongo
devilbox@php-7.1.6 in /shared/httpd $ mongodump --out /shared/backups/mongo
@ -365,7 +365,7 @@ To find out more about the configuration and options of mongodump, visit its pro
```shell
# Enter the Container
host> ./bash.sh
host> ./shell.sh
# Start the restore/import from /shared/backups/mongo
devilbox@php-7.1.6 in /shared/httpd $ mongorestore /shared/backups/mongo

View File

@ -92,7 +92,7 @@ It will be ready in eight simple steps:
```shell
# 1. Enter the PHP container
host> ./bash.sh
host> ./shell.sh
# 2. Create a new VirtualHost directory
devilbox@php-7.0.20 in /shared/httpd $ mkdir my-cake
@ -165,7 +165,7 @@ It will be ready in six simple steps:
```shell
# 1. Enter the PHP container
host> ./bash.sh
host> ./shell.sh
# 2. Create a new VirtualHost directory
devilbox@php-7.0.20 in /shared/httpd $ mkdir my-drupal
@ -213,7 +213,7 @@ It will be ready in six simple steps:
```shell
# 1. Enter the PHP container
host> ./bash.sh
host> ./shell.sh
# 2. Create a new VirtualHost directory
devilbox@php-7.0.20 in /shared/httpd $ mkdir my-laravel
@ -259,7 +259,7 @@ It will be ready in six simple steps:
```shell
# 1. Enter the PHP container
host> ./bash.sh
host> ./shell.sh
# 2. Create a new VirtualHost directory
devilbox@php-7.0.20 in /shared/httpd $ mkdir my-phalcon
@ -306,7 +306,7 @@ It will be ready in six simple steps:
```shell
# 1. Enter the PHP container
host> ./bash.sh
host> ./shell.sh
# 2. Create a new VirtualHost directory
devilbox@php-7.0.20 in /shared/httpd $ mkdir my-symfony
@ -356,7 +356,7 @@ It will be ready in six simple steps:
```shell
# 1. Enter the PHP container
host> ./bash.sh
host> ./shell.sh
# 2. Create a new VirtualHost directory
devilbox@php-7.0.20 in /shared/httpd $ mkdir my-wp
@ -402,7 +402,7 @@ It will be ready in six simple steps:
```shell
# 1. Enter the PHP container
host> ./bash.sh
host> ./shell.sh
# 2. Create a new VirtualHost directory
devilbox@php-7.0.20 in /shared/httpd $ mkdir my-yii
@ -448,7 +448,7 @@ It will be ready in six simple steps:
```shell
# 1. Enter the PHP container
host> ./bash.sh
host> ./shell.sh
# 2. Create a new VirtualHost directory
devilbox@php-7.0.20 in /shared/httpd $ mkdir my-zend

View File

@ -204,7 +204,7 @@ To quickly find setup instructions for your framework of choice head over to **[
The PHP Docker container is your workhorse which has many tools pre-installed and you can do every task inside instead of doing it on the docker host. Entering the container is done via a shipped script:
```shell
host> ./bash.sh
host> ./shell.sh
devilbox@php-7.0.19 in /shared/httpd $
```

View File

@ -100,10 +100,10 @@ The situation inside the container is not different from on the Docker host. All
#### 3.1 As devilbox user
In the devilbox git directory you will find a bash script called `bash.sh`. Just execute this script and it will take you directly into the PHP docker container at the project root directory.
In the devilbox git directory you will find a bash script called `shell.sh`. Just execute this script and it will take you directly into the PHP docker container at the project root directory.
```shell
host> ./bash.sh
host> ./shell.sh
devilbox@php-7.0.19 in /shared/httpd $
```
@ -111,10 +111,11 @@ As you can see, the PS1 prompt will also show you the current configured PHP ver
#### 3.2 As root user
In case you need to perform some tasks that are only possible with root rights (such as installing or updating software), you can also use the `root_bash.sh` script.
In case you need to perform some tasks that are only possible with root rights (such as installing or updating software), you can do so via password-less `sudo`.
```shell
host> ./root_bash.sh
host> ./shell.sh
devilbox@php-7.0.19 in /shared/httpd $ sudo su -
root@php-7.0.19 in /shared/httpd $
```

View File

@ -1,4 +0,0 @@
#!/bin/sh
CWD="/shared/httpd"
docker-compose exec --user root php env TERM=xterm /bin/sh -c "cd ${CWD}; exec bash -l"

View File