Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions deployment/tz-single-server-deployment/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
OL_REFERENCE_UI_VERSION=5.2.9
OL_REQUISITION_VERSION=8.3.9
#OL_REQUISITION_VERSION=8.3.7-RC1
OL_REFERENCEDATA_VERSION=15.2.7
OL_AUTH_VERSION=4.3.4
OL_NOTIFICATION_VERSION=4.3.4
OL_FULFILLMENT_VERSION=9.0.6-SNAPSHOT
OL_CCE_VERSION=1.3.4
OL_STOCKMANAGEMENT_VERSION=5.1.11
OL_REPORT_VERSION=1.2.3
OL_BUQ_VERSION=1.0.1-SNAPSHOT
OL_DHIS2_INTEGRATION=1.0.0
OL_HAPIFHIR_VERSION=2.0.3
OL_ONE_NETWORK_INTEGRATION_VERSION=0.0.1
OL_ONE_NETWORK_INTEGRATION_REFERENCEDATA_EXTENSION_VERSION=0.0.1
OL_ONE_NETWORK_INTEGRATION_STOCKMANAGEMENT_EXTENSION_VERSION=0.0.1
OL_DIAGNOSTICS_VERSION=1.1.3

OL_NGINX_VERSION=5
OL_RSYSLOG_VERSION=1

OL_POSTGRES_VERSION=12-debezium
TZ_UI_VERSION=1.0.0-SNAPSHOT

OL_EQUIPMENT_VERSION=1.0.0-SNAPSHOT
TZ_COMMON_VERSION=1.0.0-SNAPSHOT
TZ_POST_EXTENSION_VERSION=1.0.2-SNAPSHOT
30 changes: 30 additions & 0 deletions deployment/tz-single-server-deployment/cleanDb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

set -e

# ensure some environment variables are set
: "${DATABASE_URL:?DATABASE_URL not set in environment}"
: "${POSTGRES_USER:?POSTGRES_USER not set in environment}"
: "${POSTGRES_PASSWORD:?POSTGRES_PASSWORD not set in environment}"

# pull apart some of those pieces stuck together in DATABASE_URL

URL=`echo ${DATABASE_URL} | sed -E 's/^jdbc\:(.+)/\1/'` # jdbc:<url>
: "${URL:?URL not parsed}"

HOST=`echo ${DATABASE_URL} | sed -E 's/^.*\/{2}(.+):.*$/\1/'` # //<host>:
: "${HOST:?HOST not parsed}"

PORT=`echo ${DATABASE_URL} | sed -E 's/^.*\:([0-9]+)\/.*$/\1/'` # :<port>/
: "${PORT:?Port not parsed}"

DB=`echo ${DATABASE_URL} | sed -E 's/^.*\/(.+)\?*$/\1/'` # /<db>?
: "${DB:?DB not set}"

# pgpassfile makes it easy and safe to login
echo "${HOST}:${PORT}:${DB}:${POSTGRES_USER}:${POSTGRES_PASSWORD}" > pgpassfile
chmod 600 pgpassfile

# hasta la vista, schema
export PGPASSFILE='pgpassfile'
psql "${URL}" -U ${POSTGRES_USER} -t -c "select 'drop schema if exists \"' || schemaname || '\" cascade;' from (select n.nspname as schemaname from pg_catalog.pg_namespace n where n.nspname !~ '^pg_' AND n.nspname <> 'information_schema') as schemaname;" | psql "${URL}" -U ${POSTGRES_USER} 2>&1
7 changes: 7 additions & 0 deletions deployment/tz-single-server-deployment/config/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM gliderlabs/alpine:3.4

COPY log/logback.xml /config/log/logback.xml
COPY scalyr/agent.json /config/scalyr/agent.json

CMD /bin/true

54 changes: 54 additions & 0 deletions deployment/tz-single-server-deployment/config/log/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<configuration>
<include resource="org/springframework/boot/logging/logback/base.xml" />

<appender name="SYSLOG" class="ch.qos.logback.classic.net.SyslogAppender">
<syslogHost>log</syslogHost>
<facility>LOCAL0</facility>
<suffixPattern>[%15.15thread] %level %logger %msg</suffixPattern>
</appender>

<logger name="org.javers.core.Javers" level="INFO" additivity="false">
<appender-ref ref="SYSLOG"/>
</logger>

<logger name="org.openlmis.auth" level="DEBUG" additivity="false">
<appender-ref ref="SYSLOG"/>
</logger>

<logger name="org.openlmis.cce" level="DEBUG" additivity="false">
<appender-ref ref="SYSLOG"/>
</logger>

<logger name="org.openlmis.fulfillment" level="DEBUG" additivity="false">
<appender-ref ref="SYSLOG"/>
</logger>

<logger name="org.openlmis.notification" level="DEBUG" additivity="false">
<appender-ref ref="SYSLOG"/>
</logger>

<logger name="org.openlmis.referencedata" level="DEBUG" additivity="false">
<appender-ref ref="SYSLOG"/>
</logger>

<logger name="org.openlmis.report" level="DEBUG" additivity="false">
<appender-ref ref="SYSLOG"/>
</logger>

<logger name="org.openlmis.requisition" level="DEBUG" additivity="false">
<appender-ref ref="SYSLOG"/>
</logger>

<logger name="org.openlmis.stockmanagement" level="DEBUG" additivity="false">
<appender-ref ref="SYSLOG"/>
</logger>

<logger name="org.openlmis.buq" level="DEBUG" additivity="false">
<appender-ref ref="SYSLOG"/>
</logger>

<!-- Define the root logger log level -->
<root level="INFO">
<appender-ref ref="SYSLOG"/>
</root>
</configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER ROLE postgres SUPERUSER;
37 changes: 37 additions & 0 deletions deployment/tz-single-server-deployment/config/scalyr/agent.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Configuration for the Scalyr Agent. For help:
//
// https://www.scalyr.com/help/scalyr-agent-2

{
import_vars: [ "SCALYR_API_KEY", "VIRTUAL_HOST"],

// Enter a "Write Logs" api key for your account. These are available at https://www.scalyr.com/keys
api_key: "$SCALYR_API_KEY",

// Fields describing this server. These fields are attached to each log message, and
// can be used to filter data from a particular server or group of servers.
server_attributes: {
// Fill in this field if you'd like to override the server's hostname.
serverHost: "$VIRTUAL_HOST",
org: "OpenLMIS",

// You can add whatever additional fields you'd like.
// tier: "production"
}

// Log files to upload to Scalyr. You can use '*' wildcards here.
logs: [
{ path: "/var/log/nginx/log/access.log", attributes: {parser: "accessLog"} },
{ path: "/var/log/nginx/log/error.log" } ,
{ path: "/var/log/auth-tomcat/access_log.log", attributes: {parser: "accessLog"} },
{ path: "/var/log/messages", attributes: {parser: "systemLog"} },
],

global_monitor_sample_interval: "5",

monitors: [
{
module: "scalyr_agent.builtin_monitors.docker_monitor"
}
]
}
9 changes: 9 additions & 0 deletions deployment/tz-single-server-deployment/deploy_to_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env sh

export KEEP_OR_WIPE="keep"

../shared/init_env_gh.sh
cat $settings_training > settings.env
../shared/pull_images.sh $1

../shared/restart.sh $1
Loading