Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
Fix up/down/restart server
  • Loading branch information
MatthewPattell committed Aug 20, 2018
1 parent 0b3da0b commit f07269e
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 9 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ to the require section of your `composer.json` file.
- [Linux](docs/LINUX.md)
- [Mac OS](docs/MACOS.md)

## Environments
## Environments && Commands
- [See all available environments](docs/ENVIRONMENTS.md)
- [See console commands](docs/COMMANDS.md)

**FEATURES**
---
Expand Down
12 changes: 7 additions & 5 deletions bin/site-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ VENDOR_DIR=$(getVendorPath "${BASH_SOURCE[0]}")
ACTION=$1
DETACHED_MODE=$DEFAULT_DETACHED_MODE

if [[ "${ACTION}" = "down" || "${ACTION}" = "restart" ]] && [ "$DETACHED_MODE" = "-d" ]; then
if [[ "${ACTION}" != "up" ]] && [ "$DETACHED_MODE" = "-d" ]; then
DETACHED_MODE=""
fi

Expand Down Expand Up @@ -51,8 +51,10 @@ else
"${COMMAND[@]}"
fi

# Auto update hosts file for host
. "${VENDOR_DIR}/helpers/update-hosts.sh" "$ACTION"
if [ "$ACTION" = "up" ] || [ "$ACTION" = "down" ] || [ "$ACTION" = "restart" ]; then
# Auto update hosts file for host
. "${VENDOR_DIR}/helpers/update-hosts.sh" "$ACTION"

# Create/delete nginx proxies configs for host
. "${VENDOR_DIR}/helpers/create-nginx-proxy.sh" "$ACTION"
# Create/delete nginx proxies configs for host
. "${VENDOR_DIR}/helpers/create-nginx-proxy.sh" "$ACTION"
fi
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "matthew-p/docker-server",
"description": "Universal docker server, Nginx, PHP-FPM, MySql, Redis",
"type": "package",
"keywords": ["docker","server","php","fpm","nginx","mysql","redis","docker-compose"],
"keywords": ["docker","server","php","fpm","nginx","mysql","redis","docker-compose","universal","dynamic"],
"license": "BSD-3-Clause",
"authors": [
{
Expand Down
14 changes: 14 additions & 0 deletions docs/COMMANDS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Available console commands
===========================

List simple commands run in project root.

- `composer server init` create project docker folder, prepare docker env
- `composer server up` run server [see more](https://docs.docker.com/compose/reference/up/)
- `composer server down` stop server [see more](https://docs.docker.com/compose/reference/down/)
- `composer server restart` sequential execution of commands `down` and `up`
- `composer server "logs server"` shown logs service `server`
- `composer server-run server "ls -l"` create service `server`, run command `ls -l` inside container and remove service
- `composer server-exec server "ls -l"` run command inside exist running service `server`

[See AWS commands](ENVIRONMENTS.md#auto-update-hosts-envs)
5 changes: 4 additions & 1 deletion helpers/create-nginx-proxy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ NGINX_CONF_PATH="${HOST_NGINX_CONF_DIR}/universal-${PROJECT_NAME}.conf"

if [[ "$ACTION" = "down" && "$HOST_NGINX_KEEP_CONF" = "no" ]]; then
# Delete previous config if exist
[ -e $NGINX_CONF_PATH ] && rm $NGINX_CONF_PATH
if [ -e $NGINX_CONF_PATH ]; then
rm $NGINX_CONF_PATH
fi

return
fi

Expand Down
2 changes: 1 addition & 1 deletion sample/.env-sample
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ RUN_SERVER_COMPOSER=0
# DOMAINS
DOMAIN_COMMON=sample.io

SERVICES="$SERVICES -f docker/docker-compose.common.yml -f docker/docker-compose.local.yml"
SERVICES="${SERVICES} -f docker/docker-compose.common.yml -f docker/docker-compose.local.yml"

# Auto update /etc/hosts (save copy your hosts just in case before enable this option)
HOST_ETC_HOSTS_UPDATE=no
Expand Down

0 comments on commit f07269e

Please sign in to comment.