Skip to content

Commit

Permalink
Merge branch 'release/0.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Szymanski committed Jul 3, 2019
2 parents 192a9e5 + 65d1588 commit 19a523e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 16 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

Things change, people change, everything changes.

## [0.5.0](https://github.com/elfacht/craft-deploy/compare/0.4.1...0.5.0) - 2019-07-03
### Added
- Added `ROOT_PATH` constant for absolute server paths. **REQUIRED! PLEASE UPDATE!**
- Added `RESTART_PHP` constant for optional PHP restart command, in case symlinks are cached.

## [0.4.1](https://github.com/elfacht/craft-deploy/compare/0.4.0...0.4.1) - 2019-06-23
### Added
- Added bug warning.
Expand Down Expand Up @@ -44,4 +49,4 @@ Things change, people change, everything changes.

## 0.1.0 - 2019-06-18
### Added
- Initial release
- Initial release
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@

A bash script for zero-downtime Craft CMS deployment to run on production servers. Inspired by the Capistrano routine. **This script is still beta! Please use it very carefully!**

---

**WARNING: There might be a bug where the current Craft installation stucks in an old release until this folder will be deleted.**

---

## Usage

- Copy the files to your project folde on the server.
- Replace `[GIT_REPO_URL]` and `[ASSETS_DIR]` in [deploy.sh](deploy.sh) with your credentials.
- Add `ROOT_PATH` for server root path to project. **REQUIRED!**
- Add optional `PHP_RESTART` command, in case symlinks are cached.
- Run `chmod +x deploy.sh setup.sh` to set execution permissions.
- Run `./setup.sh` to create the initial folders.
- Upload `.env` into `shared/`.
Expand Down Expand Up @@ -72,4 +68,4 @@ When you don't want to spend money on deployment services and tools like Capistr

## License

Itsa [MIT](LICENSE.md)!
Itsa [MIT](LICENSE.md)!
36 changes: 28 additions & 8 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
# - Git repo URL
# - Assets directory name (web/[ASSETS_DIR])
#######################################
GIT_REPO="[GIT_REPO_URL]"
ASSETS_DIR="[ASSETS_DIR]"
GIT_REPO="[GIT_REPO_URL]" # required
ROOT_PATH="[ROOT/PATH/TO/PROJECT/]" # Server root path – required
ASSETS_DIR="[ASSETS_DIR]" # Assets folder – required
RESTART_PHP="" # Restart PHP if symlinks are cached – optional

#######################################
# Exit if any command fails
Expand Down Expand Up @@ -83,19 +85,19 @@ fi
# Run composer install and
# create symlinks
#######################################
if composer install; then
if composer install --no-interaction --prefer-dist --optimize-autoloader; then
#######################################
# Create symlinks of shared files
# and folders.
#######################################
printf -- "- Create symlinks .."
DONE=0;
while [ $DONE -eq 0 ]; do
ln -sfn "../../shared/.env"
ln -sfn "../../shared/storage" .
cd web && ln -sfn "../../../shared/web/.htaccess"
ln -sfn "../../../shared/web/$ASSETS_DIR"
ln -sfn "../../../shared/web/cpresources"
ln -sfn "$ROOT_PATH/shared/.env"
ln -sfn "$ROOT_PATH/shared/storage" .
cd web && ln -sfn "$ROOT_PATH/shared/web/.htaccess"
ln -sfn "$ROOT_PATH/shared/web/$ASSETS_DIR"
ln -sfn "$ROOT_PATH/shared/web/cpresources"

if [ "$?" = "0" ]; then DONE=1; fi;
printf -- '.';
Expand Down Expand Up @@ -147,6 +149,24 @@ if composer install; then

printf -- ' DONE!\n';
fi

#######################################
# Restart PHP
#######################################
if ${RESTART_PHP}; then
printf -- "- Restart PHP .."

DONE=0;
while [ $DONE -eq 0 ]; do
${RESTART_PHP}

if [ "$?" = "0" ]; then DONE=1; fi;
printf -- '.';
sleep 1;
done

printf -- ' DONE!\n';
fi
else

#######################################
Expand Down

0 comments on commit 19a523e

Please sign in to comment.