Permalink
Browse files

PostgreSQL extension has been moved to a new postgresql extension set.

  • Loading branch information...
1 parent f0b0294 commit 2d1e94124da942564ab9e7ded2d8c17aeda9bd2c @wayneeseguin wayneeseguin committed Dec 1, 2011
No changes.
View
@@ -1,13 +0,0 @@
-Copyright (c) 2009-2011 Wayne E. Seguin
-
-Licensed under the Apache License, Version 2.0 (the \"License\");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an \"AS IS\" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
View
@@ -1,26 +0,0 @@
-# SM Framework Postgresql Extension
-
-In order to install the latest version of postgresql known to the component do:
-
- sm postgresql install
-
-Next we configure the sytem to run postgresql:
-
- sm postgresql configure
-
-To start postgresql:
-
- sm postgresql start
-
-To stop postgresql:
-
- sm postgresql stop
-
-To restart postgresql:
-
- sm postgresql restart
-
-To obtain the status of the postgresql process:
-
- sm postgresql status
-
View
No changes.
View
@@ -1 +0,0 @@
-0.0.1
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-# TODO:
-# Ability to backup either:
-# - A given listed database
-
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-# TODO:
-# Ability to backup
-# - A list of one or more tables for a given database
-
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-if command_exists vim
-then
- ${EDITOR:=vim}
-else
- ${EDITOR:=vi}
-fi
-
-${EDITOR} "${service_config_path}/${extension}.conf"
-
@@ -1,67 +0,0 @@
-#!/bin/sh
-
-user is root || log error "'postgresql configure' may only be run as root."
-
-paths create "/etc/postgresql/" "/var/log/postgresql" "/var/run/postgresql" \
- "/var/db/postgresql"
-
-json get \
- string "postgresql/bind" default 0.0.0.0 \
- string "postgresql/port" default 5432 \
- string "postgresql/syslog/facility" default "local0" \
- string "postgresql/databases" default 24 \
- string "postgresql/max/clients" default 128 \
- string "postgresql/max/memory" default "128mb" \
- string "postgresql/max/slow" default 1024 \
- string "postgresql/append/fsync" default "everysec" \
- string "postgresql/append/only" default "yes" \
- string "postgresql/append/file" default "appendonly.aof" \
- string "postgresql/log/slow" default 10000
-
-template install "postgresql/postgresql.conf" \
- to "/etc/postgresql/postgresql.conf" \
- mode 0644 \
- with \
- bind "${postgresql_bind}" \
- port "${postgresql_port}" \
- syslog_facility "${postgresql_syslog_facility}" \
- databases "${postgresql_databases}" \
- max_clients "${postgresql_max_clients}" \
- max_memory "${postgresql_max_memory}" \
- max_slow "${postgresql_max_slow}" \
- append_fsync "${postgresql_append_fsync}" \
- append_only "${postgresql_append_only}" \
- append_file "${postgresql_append_file}" \
- log_slow "${postgresql_log_slow}"
-
-template install "postgresql/init.d" \
- to "/etc/init.d/postgresql" \
- mode 0755 \
- with \
- service_bin_path "${sm_path}/pkg/active/bin"
-
-template install "postgresql/conf.d" \
- to "/etc/conf.d/postgresql.conf" \
- mode 0755 \
- with \
- service_bin_path "${sm_path}/pkg/active/bin" \
- service_pid_file "/var/run/postgresql/postgresql.pid" \
- service_config_file "/etc/postgresql/postgresql.conf" \
- service_log_file "/var/log/postgresql/postgresql.log" \
- service_data_path "${service_data_path}" \
- port 5432 \
-
-template install "postgresql/monitrc" \
- to "/etc/monit.d/postgresql.monitrc" \
- mode 0644 \
- with \
- service_bin_path "${sm_path}/pkg/active/bin" \
- service_pid_file "/var/run/postgresql/postgresql.pid" \
- service_config_file "/etc/postgresql/postgresql.conf" \
- service_log_file "/var/log/postgresql/postgresql.log" \
- start_timeout 30 \
- port 5432 \
- bind 127.00.1
-
-monit reload
-
@@ -1,4 +0,0 @@
-#!/bin/sh
-
-exec su - "${service_user}" -c "$control reload -D '${service_data_path}' -s"
-
@@ -1,33 +0,0 @@
-#!/bin/sh
-
-NIY "replication setup"
-
-#json get \
-# string "postgresql/replication/master" \
-# string "postgresql/replication/slaves"
-
-/etc/init.d/postgresql stop
-
-su - ${service_user} \
- -c "ssh -o StrictHostKeyChecking=no postgres@${postgresql_replication_master} 'ssh -o StrictHostKeyChecking=no postgres@${hostname} uname'"
-
-files remove /var/db/postgresql/active/wal/*
-
-psql -U ${service_user} -h ${postgresql_replication_master} \
- -c"select pg_start_backup('`date`');"
-
-su - ${service_user} \
- -c "touch /var/db/postgresql/active/wal/00000001.history"
-
-su - ${service_user} \
- -c "rsync -avPz --delete --exclude .svn --exclude recovery.conf --exclude recovery.py --exclude postgresql.conf --exclude pg_log --exclude pg_xlog ${postgresql_replication_master}:/var/db/postgresql/active/data/ /var/db/postgres/active/data/"
-
-find /var/db/postgres/active/data/pg_xlog -type f | xargs rm -f
-
-psql -U ${service_user} -h ${postgresql_replication_master} \
- -c"select pg_stop_backup();"
-
-/etc/init.d/postgresql start
-
-
-
@@ -1,4 +0,0 @@
-#!/bin/sh
-
-exec su - "${service_user}" -c "$control restart -D '${service_data_path}' -s"
-
@@ -1,4 +0,0 @@
-#!/bin/sh
-
-exec su - "${service_user}" -c "$control start -D '${service_data_path}' -s"
-
View
@@ -1,4 +0,0 @@
-#!/bin/sh
-
-exec su - "${service_user}" -c "$control start -D '${service_data_path}' -s"
-
@@ -1,3 +0,0 @@
-version=9.1.1
-user=postgres
-archive_format=tar.bz2
@@ -1,4 +0,0 @@
-postgresql-9.1.1.tar.bz2=061a9f17323117c9358ed60f33ecff78
-postgresql-9.0.4.tar.bz2=80390514d568a7af5ab61db1cda27e29
-postgresql-9.0.3.tar.bz2=928df8c40bb012ad10756e58b70516fb
-postgresql-9.0.2.tar.bz2=fc79ef32b602f75f2ccd37647bc008e9
View
@@ -1,15 +0,0 @@
-backup/database=backup/database
-backup/tables=backup/tables
-conf/edit=conf/edit
-conf/help=conf/help
-package/help=package/help
-package/install=package/package_install()
-package/uninstall=package/package_uninstall()
-package/update=package/package_update()
-service/help=service/help
-service/restart=service/service_restart()
-service/start=service/service_start()
-service/status=service/service_status()
-service/stop=service/service_stop()
-database/setup=postgresql_database_setup()
-database/init=postgresql_database_setup()
@@ -1,153 +0,0 @@
-#!/bin/sh
-
-typeset -ga configure_flags >/dev/null 2>&1 # Don't care if declared already.
-
-postgresql_initialize()
-{
- true \
- ${service_port:=5432} \
- ${service_bind_interface:="127.0.0.1"} \
- ${service_user:=${package_user:="postgres"}}
-
- service_binary="${service_bin_path}/pg_ctl"
- service_cli_binary="${service_bin_path}/psql"
-
- local _action
-
- if array is empty service_flags
- then
- _action="${action//\(*}"
- service_flags+=(${_action//*_} -D "$service_data_path/data" -s )
- service_stop_flags+=( -m fast -w )
- fi
-
- export PGDATA="${service_data_path}/data"
-
- service_pid_file="${service_data_path}/data/postmaster.pid"
-}
-
-postgresql_prefetch()
-{
- package define \
- base_url "http://ftp9.us.postgresql.org/pub/mirrors/postgresql/source/v${package_version}"
-}
-
-postgresql_database_setup()
-{
- local _file _command _initdb_flags
-
- log "Initializing postgresql data directory in $service_data_path"
-
- path create "${service_data_path}"
-
- if [[ ${service_user} == "postgresql" ]]
- then service_user="postgres" ; fi
-
- path chown "$service_user:$service_user" recursively "${service_data_path}"
-
- for file in "${install_path}"/share/*.sample
- do
- _file=${file%%.sample}
- file copy force \
- from "$file"
- to "${service_data_path}/${_file##*/}"
- done
-
- if ! path exists "${service_data_path}/data"
- then
- _initdb_flags=(
- --pgdata="'${service_data_path}/data'"
- --encoding=utf8
- --locale=C
- --username=$service_user
- )
- _command="'$install_path/bin/initdb ${_initdb_flags[*]}'"
-
- if user is root
- then
- if ! su - "${service_user}" -c "${_command}"
- then
- __sm.log.warn "initdb failed, command:\n${_command}"
- fi
- else
- if ! "${_command}"
- then
- __sm.log.warn "initdb failed, command:\n${_command}"
- fi
- fi
- fi
-
- path chown "$service_user:$service_user" recursively "${service_data_path}"
- path chmod 0700 recursively "${service_data_path}"
-}
-
-postgresql_service_setup()
-{
- local file _entries
- log "Configuring postgresql server."
-
- paths create "${service_data_path}" "${log_path}"
-
- postgresql_database_setup
-
- log "service_data_path: ${service_data_path}"
- for file in postgresql pg_hba pg_ident recovery
- do
- if ! file is nonempty "${service_data_path}/${file}.conf"
- then
- if ! file exists "$service_data_path/${file}.conf.sample"
- then
- log "Missing $service_data_path/${file}.conf.sample, skipping."
- continue
- fi
- log "Installing ${file}.conf to ${service_data_path}/"
-
- files copy force \
- from "$service_data_path/${file}.conf.sample" \
- to "$service_data_path/${file}.conf"
-
- if file is missing "${service_config_path}/${file}.conf"
- then
- file link force \
- from "${service_data_path}/${file}.conf" \
- to "${service_config_path}/${file}.conf"
- fi
- fi
- done
-
- path chown "$service_user:$service_user" recursively "${service_data_path}"
-
- find "${service_data_path}" -type f -print0 | xargs -0 chmod 0600
- find "${service_data_path}" -type d -print0 | xargs -0 chmod 0700
-}
-
-postgresql_preconfigure()
-{
- if [[ "$action" = *install ]]
- then
- configure_flags=(
- --prefix="${install_base_path}/${package_version}"
- --datadir="${install_base_path}/${package_version}/data"
- --with-openssl
- --enable-shared
- )
- export CFLAGS='-O2'
- fi
-}
-
-
-postgresql_uninstall() {
- paths remove \
- "${prefix_path}/${package_name}" \
- "${prefix_path}/${package_name}-${package_version}"
-
- remove_files \
- /etc/profile.d/postgresql.sh \
- /etc/ld.so.conf.d/postgresql.conf \
- "${init_scripts_path}/postgresql"
-
- user delete "${package_user}"
-
- log "Removal of ${package_name} complete."
-}
-
@@ -1,5 +0,0 @@
-api/package
-api/service
-api/database
-api/user
-api/json
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-typeset -g json_file
-
-json_file="/etc/system.json"
-
Oops, something went wrong.

0 comments on commit 2d1e941

Please sign in to comment.