Re: Deployment problem on OS X Server

Kieran Kelleher <[email protected]>
Newsgroups gmane.comp.web.webobjects.devel
Message-ID <[email protected]>
*Always* set permissions/ownership when you deploy on Mac/Linux/ 
Unix..... it is a fact of (secure) unix life. Think about it. WOLips  
built it and you were the user on your own machine. If you just copy  
over, how can you be sure that deployment server magically knows the  
user permissions needed for these files that will be used by some  
process to be launched by some other process on the server?

In my case, and I am sure many have this, I have a short deployment  
script that copies the app over to my dest host and sets the  
permissions. If you have SSH set up to log in using keys and not  
passwords, this is fully automatable. Others probably have ant  
scripts that deploy.... perhaps someone can post an ant deployment  
script example.

For example, here is a generic script that simply copies an app and  
sets permissions. This is usually called from other project specific  
scripts with the correct args supplied. (Again all assumes you have  
ssh key pair authorization between your machine and the server  
requiring no interaction from you)
<snip>
#!/bin/bash

## This app simply copies a webobjects app to a remote server and  
sets the permissions.
## It only copies the app to WebObjects apps dir and does not  
consider web server split install

# Argument passed in
## Example /Library/WebObjects/Applications/MyApp.woa
WOA_BUNDLE="$1"

## Example xmain2.remote (a ssh config alias in .ssh/config with key  
authentication)
## This ssh alias must have root access!!
SSH_CONFIG="$2"

## Example /Library/WebObjects/Applications
REMOTE_TARGET_DIR="$3"

## Target CHOWN, for example appserver:appserveradm
TARGET_CHOWN="$4"

## Target CHMOD, for example 550
TARGET_CHMOD="$5"

USAGE="Usage: $0 /path-to-woa/myapp.woa root@ssh-alias /app/dir/on/ 
remote appserver:appserverusr 550"

# The root user on this machine needs to have dsa key access to root  
on target
# and the ssh configuration named here must be defined in root's .ssh/ 
config file
#TARGET_PERMISSIONS="appserver:appserveradm"


# If arg not supplied, then error
if [ "$WOA_BUNDLE" = "" ]; then
	echo $USAGE
	exit 1
fi

# If arg not supplied, then error
if [ "$SSH_CONFIG" = "" ]; then
	echo $USAGE
	exit 1
fi

# If arg not supplied, then error
if [ "$REMOTE_TARGET_DIR" = "" ]; then
	echo $USAGE
	exit 1
fi


if [ ! -d $WOA_BUNDLE ]; then
	echo "$WOA_BUNDLE does not exist!"
	exit 3
fi

## Get bundle name itself
WOA_NAME=${WOA_BUNDLE##/*/}
echo WOA_NAME is $WOA_NAME
# ALL SYSTEMS GO...

# ====================================================================
# Copy deployment bundle to wo-app host and set ownership permissions

# SSH_CONFIG host
echo "scp -r $WOA_BUNDLE root@$SSH_CONFIG:$REMOTE_TARGET_DIR/"
scp -r $WOA_BUNDLE root@$SSH_CONFIG:$REMOTE_TARGET_DIR/

echo "$SSH_CONFIG chown -R $TARGET_CHOWN $REMOTE_TARGET_DIR/$WOA_NAME"
ssh root@$SSH_CONFIG "chown -R $TARGET_CHOWN $REMOTE_TARGET_DIR/ 
$WOA_NAME"

echo "$SSH_CONFIG chmod -R $TARGET_CHMOD $REMOTE_TARGET_DIR/$WOA_NAME"
ssh root@$SSH_CONFIG "chmod -R $TARGET_CHMOD $REMOTE_TARGET_DIR/ 
$WOA_NAME"


echo "Done deploying $WOA_NAME"

</snip>


On May 25, 2007, at 1:08 PM, Anders Peterson wrote:

> Is this something everyone always have to do when they deploy on Mac.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.