Browse Source
* correctly pass secrets to workspace-containers
* correctly pass secrets to workspace-containers
* update README * helper-scripts with create symlinks helper and get composer auth github token helpermaster
Alexander Demidov
4 years ago
11 changed files with 177 additions and 22 deletions
-
89README.md
-
17bash/enter-to-workspace.sh
-
10bash/quit-xdebug.sh
-
10bash/start-xdebug.sh
-
14config/nginx/conf.d/vhosts.conf.example
-
8create-symlinks.sh
-
12docker-compose.base.yml
-
10dockerfiles/php-fpm/xdebug.sh
-
8dockerfiles/workspace/xdebug.sh
-
15get-composer-auth.sh
-
6uncreate-symlinks.sh
@ -1,8 +1,89 @@ |
|||
## Run docker build |
|||
## First |
|||
Create alias for `docker-compose` command. |
|||
|
|||
First. You need export environment variable |
|||
`export DOCKER_BUILDKIT=1` (more info https://github.com/edrevo/dockerfile-plus) |
|||
`echo 'alias dc="docker-compose"' >> ~/.bash_aliases` |
|||
|
|||
Also, you have might be needed include `~/.bash_aliases` in your `~/.bashrc` file. |
|||
|
|||
Build all |
|||
|
|||
`dc build` |
|||
|
|||
## Second |
|||
|
|||
Create usefully symlinks |
|||
|
|||
`./create-symlinks.sh` |
|||
|
|||
## Get composer auth token |
|||
|
|||
If you do not have composer github auth.json file in `~/.composer` dir. You will need launch the helper-script: |
|||
|
|||
`./get-composer-auth.sh` |
|||
|
|||
## Before use and launch |
|||
|
|||
You need copy `vhosts.conf.example` and edit this file - remove unused roots (or change to existing dirs). |
|||
Setup correctly nginx config. |
|||
|
|||
You ready for up containers. |
|||
|
|||
`dc up -d` |
|||
|
|||
## Database dumps |
|||
|
|||
Database dumps must be serve on `./hostfiles` directory. |
|||
Database dumps must be placement on `./hostfiles` directory. |
|||
|
|||
## Bash scripts |
|||
|
|||
After execute created symlinks, you have some enter-points for vulnerable popular tasks. |
|||
|
|||
### Xdebug |
|||
For start debugging in php-fpm, also in workspace |
|||
|
|||
`./start-xdebug.sh [74|73]` - `74` by default |
|||
|
|||
For start debugging in php-fpm, also in workspace |
|||
|
|||
`./stop-xdebug.sh` or `./stop-xdebug.sh 73` if you launch start with php-version 73 |
|||
|
|||
### Mysql |
|||
|
|||
For import dumps from `hostfiles` directory you might be enter to mysql console: |
|||
|
|||
`./mysql.sh` |
|||
|
|||
Change you needed database and source to the `*.sql` dump. |
|||
|
|||
`use mydatabase` |
|||
|
|||
`source /hostfiles/mydatabase.sql` |
|||
|
|||
Dump must be extracted before source in mysql-cli |
|||
|
|||
### Workspace |
|||
|
|||
For execute composer update|install or nodejs operations, also yarn, npm and all node-builds. |
|||
You might use `workspace`-container |
|||
|
|||
For the enter to workspace container with php 7.4 you need launch usefully helper script in your home directory: |
|||
|
|||
`./enter-to-workspace.sh` |
|||
|
|||
For enter to `workspace` with php7.3 you need pass `73` container name suffix |
|||
|
|||
`./enter-to-workspace.sh 73` |
|||
|
|||
### Nginx |
|||
|
|||
For restart `nginx` after some changes in nginx configuration, you might: |
|||
|
|||
`./restart-nginx.sh` |
|||
|
|||
## Src build need DOCKER_BUILDKIT |
|||
|
|||
If you want build own workspace image. You need export environment variable |
|||
|
|||
`export DOCKER_BUILDKIT=1` |
|||
|
|||
more info https://github.com/edrevo/dockerfile-plus |
@ -1,3 +1,16 @@ |
|||
#!/bin/bash |
|||
cd $HOME/structure |
|||
docker-compose exec workspace su laradock |
|||
DIR="$(realpath $(dirname "$(readlink -f "$0")")/..)" |
|||
|
|||
PHP_VERSION=$1 # Without dot |
|||
|
|||
if [[ -z "${PHP_VERSION}" ]]; then PHP_VERSION=74; fi |
|||
|
|||
# Grab full name of php-fpm container |
|||
WORKSPACE_CONTAINER=$(docker ps | grep workspace${PHP_VERSION} | awk '{print $1}') |
|||
|
|||
if [[ -z "${WORKSPACE_CONTAINER}" ]]; then |
|||
echo "Unable to find workspace container: workspace${PHP_VERSION}" |
|||
exit 1 |
|||
fi |
|||
|
|||
docker exec -ti ${WORKSPACE_CONTAINER} su laradock |
@ -1,3 +1,9 @@ |
|||
#!/bin/bash |
|||
cd $HOME/structure |
|||
./dockerfiles/php$1-fpm/xdebug.sh stop && cd |
|||
DIR="$(realpath $(dirname "$(readlink -f "$0")")/..)" |
|||
|
|||
PHP_VERSION=$1 # Without dot |
|||
|
|||
if [[ -z "${PHP_VERSION}" ]]; then PHP_VERSION=74; fi |
|||
|
|||
${DIR}/dockerfiles/php-fpm/xdebug.sh stop ${PHP_VERSION} |
|||
${DIR}/dockerfiles/workspace/xdebug.sh stop ${PHP_VERSION} |
@ -1,3 +1,9 @@ |
|||
#!/bin/bash |
|||
cd $HOME/structure |
|||
./dockerfiles/php$1-fpm/xdebug.sh start && cd |
|||
DIR="$(realpath $(dirname "$(readlink -f "$0")")/..)" |
|||
|
|||
PHP_VERSION=$1 # Without dot |
|||
|
|||
if [[ -z "${PHP_VERSION}" ]]; then PHP_VERSION=74; fi |
|||
|
|||
${DIR}/dockerfiles/php-fpm/xdebug.sh start ${PHP_VERSION} |
|||
${DIR}/dockerfiles/workspace/xdebug.sh start ${PHP_VERSION} |
@ -0,0 +1,8 @@ |
|||
#!/bin/bash |
|||
DIR="$(realpath $(dirname "$(readlink -f "$0")"))" |
|||
|
|||
ln -s ${DIR}/bash/start-xdebug.sh ${HOME}/ |
|||
ln -s ${DIR}/bash/quit-xdebug.sh ${HOME}/ |
|||
ln -s ${DIR}/bash/restart-nginx.sh ${HOME}/ |
|||
ln -s ${DIR}/bash/mysql.sh ${HOME}/ |
|||
ln -s ${DIR}/bash/enter-to-workspace.sh ${HOME}/ |
@ -0,0 +1,15 @@ |
|||
#!/bin/bash |
|||
FILE=${HOME}/.composer/auth.json |
|||
|
|||
if [[ -f "${FILE}" ]]; then |
|||
if [[ ! -z "$(cat $FILE | grep github)" ]]; then |
|||
exit 0 |
|||
fi |
|||
fi |
|||
|
|||
echo "Get token: https://github.com/settings/tokens/new?scopes=repo&description=Composer" |
|||
|
|||
# user="USER INPUT" |
|||
read -p "Enter token: " TOKEN |
|||
|
|||
composer config -g github-oauth.github.com ${TOKEN} |
@ -0,0 +1,6 @@ |
|||
#!/bin/bash |
|||
rm ${HOME}/start-xdebug.sh |
|||
rm ${HOME}/quit-xdebug.sh |
|||
rm ${HOME}/restart-nginx.sh |
|||
rm ${HOME}/mysql.sh |
|||
rm ${HOME}/enter-to-workspace.sh |
Write
Preview
Loading…
Cancel
Save
Reference in new issue