Skip to content
This repository has been archived by the owner on Dec 2, 2019. It is now read-only.

Commit

Permalink
Merge pull request #41 from gerhard/php-strategy
Browse files Browse the repository at this point in the history
Deliver PHP code (or just a static site) to a shared environment.
  • Loading branch information
gerhard committed Aug 20, 2012
2 parents cbb8ac0 + 6612e53 commit 339f7c1
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,8 @@
### What's new in deliver 0.7.0

* **shared** strategy with file permissions support (think www-data,
php-fpm, etc.)

### What's new in deliver 0.6.0

* **generated** strategy with built-in support for ROCCO. Other
Expand Down
15 changes: 14 additions & 1 deletion libexec/common
Expand Up @@ -117,7 +117,7 @@ git_submodules() {
touch ~/.ssh/known_hosts
fi
cat .gitmodules | awk -F '://|@|:|/' '
/url/ {
/url =/ {
command=\"test \$(ssh-keygen -F \" \$2 \" | grep -c found) = 0 && ssh-keyscan \" \$2 \" >> ~/.ssh/known_hosts $SILENCE\"
system(command)
close(command)
Expand Down Expand Up @@ -236,3 +236,16 @@ upstart() {
launch
__exec_if_defined "post_upstart"
}

permissions() {
__exec_if_defined "pre_permissions"

status "Setting file permissions"
__remote "
[ -n \"$OWNER\" ] && sudo chown -fR $OWNER.$GROUP $DELIVER_TO
[ -n \"$PERMISSIONS\" ] && sudo chmod -fR $PERMISSIONS $DELIVER_TO
exit 0
" "$HOSTS"

__exec_if_defined "post_permissions"
}
6 changes: 1 addition & 5 deletions libexec/defaults
Expand Up @@ -14,14 +14,10 @@ GIT_REMOTE="deliver"

SSH_TIMEOUT=3

# Sincer deliver leverages foreman,
# it supports all the supervisors that foreman does
SUPERVISOR="upstart"

AUTHORIZED_REMOTE_HOSTS=()

REQUIRED_CONFIGS=("ORIGIN_DIR" "STRATEGY")
OPTIONAL_CONFIGS=("APP" "APP_USER" "DELIVER_TO" "BRANCH" "SUPERVISOR" "FOREMAN_EXTRAS" "PORT" "AUTHORIZED_REMOTE_HOSTS")
OPTIONAL_CONFIGS=("APP" "APP_USER" "DELIVER_TO" "BRANCH" "FOREMAN_EXTRAS" "PORT" "AUTHORIZED_REMOTE_HOSTS")

MODE="compact"

Expand Down
8 changes: 8 additions & 0 deletions strategies/nodejs
@@ -1,6 +1,14 @@
#!/usr/bin/env bash

REQUIRED_CONFIGS+=("HOSTS")
OPTIONAL_CONFIGS+=("SUPERVISOR")

# Sincer deliver leverages foreman,
# it supports all the supervisors that foreman does
if [ -z "$SUPERVISOR" ]
then
SUPERVISOR="upstart"
fi

run() {
authorize_hosts
Expand Down
8 changes: 8 additions & 0 deletions strategies/ruby
Expand Up @@ -4,6 +4,14 @@
# It uses git push, rvm & foreman to generate upstart jobs

REQUIRED_CONFIGS+=("HOSTS")
OPTIONAL_CONFIGS+=("SUPERVISOR")

# Sincer deliver leverages foreman,
# it supports all the supervisors that foreman does
if [ -z "$SUPERVISOR" ]
then
SUPERVISOR="upstart"
fi

# This function must be present since deliver will call it directly
# Everything inside it or around it are only limited by your imagination : )
Expand Down
14 changes: 14 additions & 0 deletions strategies/shared
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

REQUIRED_CONFIGS+=("HOSTS")
OPTIONAL_CONFIGS+=("OWNER" "GROUP" "PERMISSIONS")

run() {
authorize_hosts
init_app_remotely
git_push
git_reset_remote
authorize_remote_hosts
git_submodules
permissions
}

0 comments on commit 339f7c1

Please sign in to comment.