[ckan-changes] commit/ckan-debs-public: 2 new changesets

Bitbucket commits-noreply at bitbucket.org
Wed Jun 22 16:53:20 UTC 2011


2 new changesets in ckan-debs-public:

http://bitbucket.org/okfn/ckan-debs-public/changeset/2e8012476b7c/
changeset:   2e8012476b7c
user:        jame... at okfn.org
date:        2011-06-22 18:52:28
summary:     Added a new line for here in the logging config
affected #:  1 file (62 bytes)

--- a/ckan-common/usr/lib/ckan/common.sh	Wed Jun 15 12:08:27 2011 +0100
+++ b/ckan-common/usr/lib/ckan/common.sh	Wed Jun 22 17:52:28 2011 +0100
@@ -75,7 +75,8 @@
         INSTANCE=$1
         if ! [ -f /etc/ckan/$0/who.ini ] ; then
             cp -n /usr/share/pyshared/ckan/config/who.ini /etc/ckan/${INSTANCE}/who.ini
-            sed -e "s,%(here)s,/var/lib/ckan/${INSTANCE}," \
+            sed -e "s,%%(here)s,/var/lib/ckan/${INSTANCE}," \
+                -e "s,%(here)s,/var/lib/ckan/${INSTANCE}," \
                 -i /etc/ckan/${INSTANCE}/who.ini
         fi
     fi


http://bitbucket.org/okfn/ckan-debs-public/changeset/0253ce2a4566/
changeset:   0253ce2a4566
user:        jame... at okfn.org
date:        2011-06-22 18:53:11
summary:     [merge]
affected #:  1 file (582 bytes)

--- a/ckan-common/usr/lib/ckan/common.sh	Wed Jun 22 17:52:28 2011 +0100
+++ b/ckan-common/usr/lib/ckan/common.sh	Wed Jun 22 17:53:11 2011 +0100
@@ -1,35 +1,43 @@
 #!/bin/bash
 
-log () {
-    echo "ckan: hello" $1
+ckan_log () {
+    echo "ckan: " $1
 }
 
 #_echo="echo"
 ckan_maintenance_on () {
     local INSTANCE
     INSTANCE=$1
-    $_echo a2dissite ${INSTANCE} &> /dev/null
-    $_echo a2ensite  ${INSTANCE}.maint &> /dev/null
-    $_echo service apache2 reload &> /dev/null
+    $_echo a2dissite ${INSTANCE}
+    $_echo a2ensite  ${INSTANCE}.maint
+    $_echo service apache2 reload
 }
 
 ckan_maintenance_off () {
     local INSTANCE
     INSTANCE=$1
-    $_echo a2dissite ${INSTANCE}.maint &> /dev/null
-    $_echo a2ensite  ${INSTANCE} &> /dev/null
-    $_echo service apache2 reload &> /dev/null
+    $_echo a2dissite ${INSTANCE}.maint
+    $_echo a2ensite  ${INSTANCE}
+    $_echo service apache2 reload
 }
 
 ckan_set_log_file_permissions () {
     local INSTANCE
     INSTANCE=$1
-    touch /var/log/ckan/${INSTANCE}/${INSTANCE}.log
-    touch /var/log/ckan/${INSTANCE}/${INSTANCE}[1-9].log
-    chmod g+w /var/log/ckan/${INSTANCE}/${INSTANCE}.log
-    chmod g+w /var/log/ckan/${INSTANCE}/${INSTANCE}[1-9].log
-    chown www-data:ckan${INSTANCE} /var/log/ckan/${INSTANCE}/${INSTANCE}.log
-    chown www-data:ckan${INSTANCE} /var/log/ckan/${INSTANCE}/${INSTANCE}[1-9].log
+    sudo chown www-data:ckan${INSTANCE} /var/log/ckan/${INSTANCE}
+    sudo chmod g+w /var/log/ckan/${INSTANCE}
+    sudo touch /var/log/ckan/${INSTANCE}/${INSTANCE}.log
+    sudo touch /var/log/ckan/${INSTANCE}/${INSTANCE}1.log
+    sudo touch /var/log/ckan/${INSTANCE}/${INSTANCE}2.log
+    sudo touch /var/log/ckan/${INSTANCE}/${INSTANCE}3.log
+    sudo touch /var/log/ckan/${INSTANCE}/${INSTANCE}4.log
+    sudo touch /var/log/ckan/${INSTANCE}/${INSTANCE}5.log
+    sudo touch /var/log/ckan/${INSTANCE}/${INSTANCE}6.log
+    sudo touch /var/log/ckan/${INSTANCE}/${INSTANCE}7.log
+    sudo touch /var/log/ckan/${INSTANCE}/${INSTANCE}8.log
+    sudo touch /var/log/ckan/${INSTANCE}/${INSTANCE}9.log
+    sudo chmod g+w /var/log/ckan/${INSTANCE}/${INSTANCE}*.log
+    sudo chown www-data:ckan${INSTANCE} /var/log/ckan/${INSTANCE}/${INSTANCE}*.log
 }
 
 ckan_ensure_users_and_groups () {
@@ -44,7 +52,6 @@
     if ! [[ "$COMMAND_OUTPUT" =~ "ckan${INSTANCE}:" ]] ; then
         echo "Crating the 'ckan${INSTANCE}' user ..." 
         sudo useradd  --system  --gid "ckan${INSTANCE}" --home /var/lib/ckan/${INSTANCE} -M  --shell /usr/sbin/nologin ckan${INSTANCE}
-        sudo usermod -a -G www-data ckan${INSTANCE}
     fi
 }
 
@@ -57,11 +64,11 @@
     else
         INSTANCE=$1
         mkdir -p -m 0755 /etc/ckan/${INSTANCE}
-        mkdir -p -m 2750 /var/lib/ckan/${INSTANCE}{,/static}
-        mkdir -p -m 2770 /var/{backup,log}/ckan/${INSTANCE} /var/lib/ckan/${INSTANCE}/{data,sstore,static/dump}
-        chgrp ckan${INSTANCE} /var/lib/ckan/${INSTANCE}
-        chgrp ckan${INSTANCE} /var/backup/ckan/${INSTANCE}
-        chgrp ckan${INSTANCE} /var/log/ckan/${INSTANCE}
+        mkdir -p -m 0750 /var/lib/ckan/${INSTANCE}{,/static}
+        mkdir -p -m 0770 /var/{backup,log}/ckan/${INSTANCE} /var/lib/ckan/${INSTANCE}/{data,sstore,static/dump}
+        sudo chown ckan${INSTANCE}:ckan${INSTANCE} /etc/ckan/${INSTANCE}
+        sudo chown www-data:ckan${INSTANCE} /var/{backup,log}/ckan/${INSTANCE} /var/lib/ckan/${INSTANCE} /var/lib/ckan/${INSTANCE}/{data,sstore,static/dump}
+        sudo chmod g+w /var/log/ckan/${INSTANCE} /var/lib/ckan/${INSTANCE}/{data,sstore,static/dump}
     fi
 }
 
@@ -99,7 +106,7 @@
                 -e "s,^\(error_email_from\)[ =].*,\1 = ckan-${INSTANCE}@`hostname`," \
                 -e "s,^\(cache_dir\)[ =].*,\1 = /var/lib/ckan/${INSTANCE}/data," \
                 -e "s,^\(who.config_file\)[ =].*,\1 = /etc/ckan/${INSTANCE}/who.ini," \
-                -e "s,%(here)s,/var/lib/ckan/${INSTANCE}," \
+                -e "s,%(here)s/ckan.log,/var/log/ckan/${INSTANCE}/${INSTANCE}.log," \
                 -e "s,^\(sqlalchemy.url\)[ =].*,\1 = postgresql://${INSTANCE}:${password}@localhost/${INSTANCE}," \
                 -i /etc/ckan/${INSTANCE}/${INSTANCE}.ini
         fi
@@ -117,11 +124,13 @@
     else
         INSTANCE=$1
         password=$2
-        COMMAND_OUTPUT=`sudo -u postgres psql -c "SELECT 'True' FROM pg_user WHERE usename='${INSTANCE}'" 2> /dev/null`
+        COMMAND_OUTPUT=`sudo -u postgres psql -c "SELECT 'True' FROM pg_user WHERE usename='${INSTANCE}'"`
         if ! [[ "$COMMAND_OUTPUT" =~ True ]] ; then
-            sudo -u postgres -c "psql -c \"CREATE USER \"${INSTANCE}\" WITH PASSWORD '${password}'\""
+            echo "Creating the ${INSTANCE} user ..."
+            sudo -u postgres psql -c "CREATE USER \"${INSTANCE}\" WITH PASSWORD '${password}'"
         else
-            sudo -u postgres -c "psql -c \"ALTER USER \"${INSTANCE}\" WITH PASSWORD '${password}'\""
+            echo "Setting the ${INSTANCE} user password ..."
+            sudo -u postgres psql -c "ALTER USER \"${INSTANCE}\" WITH PASSWORD '${password}'"
         fi
     fi
 }
@@ -134,7 +143,7 @@
         exit 1
     else
         INSTANCE=$1
-        COMMAND_OUTPUT=`sudo -u postgres psql -l 2> /dev/null`
+        COMMAND_OUTPUT=`sudo -u postgres psql -l`
         if ! [[ "$COMMAND_OUTPUT" =~ ${INSTANCE} ]] ; then
             echo "Creating the database ..."
             su postgres -c "createdb -O ${INSTANCE} ${INSTANCE}"
@@ -168,7 +177,7 @@
         INSTANCE=$1
         ServerName=$2
         ServerAlias=$3
-        rm /etc/apache2/sites-available/${INSTANCE}.common
+        #rm /etc/apache2/sites-available/${INSTANCE}.common
         cat <<EOF > /etc/apache2/sites-available/${INSTANCE}.common
 
     # WARNING: Do not manually edit this file, it is desgined to be 
@@ -210,7 +219,7 @@
     ErrorLog /var/log/apache2/${INSTANCE}.error.log
     CustomLog /var/log/apache2/${INSTANCE}.custom.log combined
 EOF
-        rm /etc/apache2/sites-available/${INSTANCE}
+        #rm /etc/apache2/sites-available/${INSTANCE}
         cat <<EOF > /etc/apache2/sites-available/${INSTANCE} 
 <VirtualHost *:80>
     # WARNING: Do not manually edit this file, it is desgined to be 
@@ -219,7 +228,7 @@
     Include /etc/apache2/sites-available/${INSTANCE}.common
 </VirtualHost>
 EOF
-        rm /etc/apache2/sites-available/${INSTANCE}.maint
+        #rm /etc/apache2/sites-available/${INSTANCE}.maint
         cat <<EOF > /etc/apache2/sites-available/${INSTANCE}.maint
 <VirtualHost *:80>
     # WARNING: Do not manually edit this file, it is desgined to be

Repository URL: https://bitbucket.org/okfn/ckan-debs-public/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list