Browse Source

new: added ``rsted`` charm.

postgres
Valentin Lab 11 years ago
committed by root
parent
commit
56359cce27
  1. 51
      precise/rsted/hooks/install
  2. 3
      precise/rsted/hooks/start
  3. 3
      precise/rsted/hooks/stop
  4. 8
      precise/rsted/metadata.yaml
  5. 1
      precise/rsted/revision
  6. 18
      precise/rsted/src/etc/init/rsted.conf
  7. 13
      precise/rsted/src/etc/logrotate.d/rsted
  8. 14
      precise/rsted/src/etc/rsted/settings.py

51
precise/rsted/hooks/install

@ -0,0 +1,51 @@
#!/bin/bash
RSTED_USER=${RSTED_USER:-rsted}
RSTED_GROUP=${RSTED_GROUP:-rsted}
##
## Installation code
##
source /srv/virtualenv/default/bin/activate
set -eux # -x for verbose logging to juju debug-log
mkdir -p /opt/apps
(
cd /opt/apps &&
git clone https://github.com/anru/rsted.git &&
adduser --system --home=/home/"$RSTED_USER" --group "$RSTED_GROUP" &&
#chown "$RSTED_USER":"$RSTED_GROUP" /opt/apps/rsted -R &&
## -H is to force HOME environment variable to change to etherpad one.
cd rsted &&
pip install -r pip-requirements.txt
)
##
## Config file
##
config_file="/etc/rsted/settings.py"
[ -e "$config_file" ] || cp "src/etc/rsted/settings.py" "$config_file"
ln -sf "$config_file" /opt/apps/rsted/settings_local.py
##
## Startup file
##
cp src/etc/init/rsted.conf /etc/init/rsted.conf
##
## Logrotate
##
cp src/etc/logrotate.d/rsted /etc/logrotate.d/rsted

3
precise/rsted/hooks/start

@ -0,0 +1,3 @@
#!/bin/bash
juju-log "Nothing to Start for base."

3
precise/rsted/hooks/stop

@ -0,0 +1,3 @@
#!/bin/bash
juju-log "Nothing to stop for base."

8
precise/rsted/metadata.yaml

@ -0,0 +1,8 @@
name: rsted
summary: "Rest server"
maintainer: "Valentin Lab <valentin.lab@kalysto.org>"
inherit: python-venv
description: |
Restructured only editor
config-resources:
- /etc/rsted

1
precise/rsted/revision

@ -0,0 +1 @@
0

18
precise/rsted/src/etc/init/rsted.conf

@ -0,0 +1,18 @@
# Rsted upstart
# this script will start/stop Rsted
description "Rsted Server"
version "1.0"
author "Valentin Lab"
start on started networking
stop on runlevel [!2345]
env LOG_FILE=/var/log/rsted.log
env USER=rsted
script
chdir /opt/apps/rsted
exec sudo -u "$USER" /srv/virtualenv/default/bin/python ./application.py >> "$LOG_FILE" 2>&1
end script

13
precise/rsted/src/etc/logrotate.d/rsted

@ -0,0 +1,13 @@
/var/log/rsted.log
{
rotate 4
weekly
missingok
notifempty
compress
delaycompress
sharedscripts
postrotate
restart rsted >/dev/null 2>&1 || true
endscript
}

14
precise/rsted/src/etc/rsted/settings.py

@ -0,0 +1,14 @@
# configuration
DEBUG = True
PYTHON_PATH='/srv/virtualenv/default/bin/python'
#RUN_AS='rsted'
RUN_PATH = '/var/run/rsted'
PID_FILE = 'fastcgi.pid'
SOCKET_FILE = 'rsted.sock'
FCGI_UMASK = '000' # you can override this in settings_local.py if you wish
HOST = "0.0.0.0" ## Listen IP
## 0.0.0.0 is open to everyone,
## 127.0.0.1 is localhost only.
PORT = 5000
Loading…
Cancel
Save