-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
212 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
data/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
function run { | ||
echo "undefined function run" | ||
} | ||
|
||
function usage { | ||
echo "undefined function usage" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env bash | ||
|
||
# this entrypoint come from : https://hub.docker.com/r/mgodlewski/diacamma | ||
# thanks. | ||
|
||
set -e | ||
|
||
trap "exit 1" TERM | ||
export TOP_PID=$$ | ||
|
||
export CURRENT_ORGANISATION=${DIACAMMA_ORGANISATION:-asso} | ||
export CURRENT_DIACAMMA_TYPE=${DIACAMMA_TYPE:-asso} | ||
|
||
export BIN_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
source "${BIN_DIR}/common.sh" | ||
pushd ${BIN_DIR} > /dev/null | ||
|
||
COMMAND="$1" | ||
if [ "${COMMAND}" == "" ]; then | ||
COMMAND="usage" | ||
else | ||
# shift off first parameter to cascade remaining to sub command | ||
shift 1 | ||
fi | ||
|
||
if [ ! -f sub_command/${COMMAND}.sh ]; then | ||
echo "Undefined command \"${COMMAND}\". See usage below:" | ||
echo "" | ||
COMMAND="usage" | ||
fi | ||
source "sub_command/${COMMAND}.sh" | ||
|
||
run $@ | ||
RETURN_CODE=$? | ||
popd > /dev/null | ||
exit ${RETURN_CODE} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
function run { | ||
pushd /var/lucterios2 > /dev/null | ||
now=$(date "+%Y%m%d_%H_%M_%S") | ||
/bin/bash launch_lucterios.sh archive --name=${CURRENT_ORGANISATION} --file=/backups/backup_${now}.lbkf | ||
popd > /dev/null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
function run { | ||
pushd /var/lucterios2 > /dev/null | ||
filename="/backups/${1}" | ||
if [ -f ${filename} ] | ||
then | ||
/bin/bash launch_lucterios.sh restore --name=${CURRENT_ORGANISATION} --file=${filename} | ||
else | ||
echo "File ${filename} not found : cannot restore instance ${CURRENT_ORGANISATION}" | ||
fi | ||
popd > /dev/null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
#!/usr/bin/env bash | ||
|
||
function wait_database { | ||
# Wait for DB to be ready before starting this | ||
if [ "${DIACAMMA_DATABASE}" != "" ] | ||
then | ||
sleep 10 | ||
fi | ||
} | ||
|
||
function get_database_param { | ||
if [ "${DIACAMMA_DATABASE}" != "" ] | ||
then | ||
echo "-d ${DIACAMMA_DATABASE}" | ||
else | ||
echo "" | ||
fi | ||
} | ||
|
||
function get_module_list { | ||
case "${CURRENT_DIACAMMA_TYPE}" in | ||
asso) | ||
echo "lucterios.contacts,lucterios.documents,lucterios.mailing,diacamma.accounting,diacamma.payoff,diacamma.event,diacamma.member,diacamma.invoice" | ||
return 0 | ||
;; | ||
syndic) | ||
echo "lucterios.contacts,lucterios.documents,lucterios.mailing,diacamma.accounting,diacamma.payoff,diacamma.condominium" | ||
return 0 | ||
;; | ||
*) | ||
kill -s TERM ${TOP_PID} | ||
;; | ||
esac | ||
} | ||
|
||
function init_database { | ||
if [ "${DIACAMMA_DATABASE}" != "" ] | ||
then | ||
pushd /var/lucterios2 > /dev/null | ||
/bin/bash launch_lucterios.sh refreshall | ||
popd > /dev/null | ||
fi | ||
} | ||
|
||
function run { | ||
echo Organisation: ${CURRENT_ORGANISATION} | ||
echo Type: ${CURRENT_DIACAMMA_TYPE} | ||
|
||
wait_database | ||
|
||
pushd /var/lucterios2 > /dev/null | ||
if [ ! -f ${CURRENT_ORGANISATION}/settings.py ] | ||
then | ||
modules=$(get_module_list) | ||
database_parameter=$(get_database_param) | ||
|
||
/bin/bash launch_lucterios.sh add -n ${CURRENT_ORGANISATION} -m "${modules}" -p diacamma.${CURRENT_DIACAMMA_TYPE} ${database_parameter} | ||
|
||
echo "LANGUAGE_CODE = 'fr'" >> ${CURRENT_ORGANISATION}/settings.py | ||
echo "ALLOWED_HOSTS = [ '*' ]" >> ${CURRENT_ORGANISATION}/settings.py | ||
fi | ||
|
||
source virtual_for_lucterios/bin/activate | ||
export DJANGO_SETTINGS_MODULE="${CURRENT_ORGANISATION}.settings" | ||
|
||
init_database | ||
|
||
exec gunicorn lucterios.framework.wsgi --bind=0.0.0.0:8100 --access-logfile - --error-logfile - | ||
popd > /dev/null | ||
} | ||
|
||
function usage { | ||
echo "Usage:" | ||
echo " entrypoint.sh run" | ||
echo "" | ||
echo " Run the Diacamma instance" | ||
echo "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env bash | ||
|
||
function run { | ||
COMMAND="${1}" | ||
if [ "${COMMAND}" != "" ]; then | ||
if [ ! -f sub_command/${COMMAND}.sh ]; then | ||
display_error "Undefined command \"${COMMAND}\". See usage below:" | ||
echo "" | ||
else | ||
source "sub_command/${COMMAND}.sh" | ||
# shift off first parameter to cascade remaining to sub command | ||
shift 1 | ||
usage $@ | ||
return 0 | ||
fi | ||
fi | ||
|
||
usage | ||
} | ||
|
||
function usage { | ||
echo "Usage:" | ||
echo " entrypoint.sh [<command_name>]" | ||
echo "" | ||
echo "Available commands:" | ||
echo "" | ||
echo " Action:" | ||
echo " run Run Diacamma instance" | ||
echo "" | ||
echo " Admin:" | ||
echo " backup Backup Diacamma instance to a backup file" | ||
echo " restore <file-to-restore> Restore Diacamma instance from the provided backup file" | ||
echo "" | ||
echo " Help:" | ||
echo " version Show the Diacamma version running" | ||
echo " usage This help screen" | ||
echo " usage <command_name> Help for the given command" | ||
echo "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
function run { | ||
pushd /var/lucterios2 > /dev/null | ||
/bin/bash launch_lucterios.sh check | grep '=>' | cut -f2 | sort | tail -1 | ||
popd > /dev/null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters