Add election_logdir support
This commit is contained in:
parent
5940efda1a
commit
62dbe1740a
16
Dockerfile
16
Dockerfile
|
@ -5,14 +5,16 @@ LABEL \
|
|||
Project="https://github.com/jenkins-infra/account-app" \
|
||||
Maintainer="infra@lists.jenkins-ci.org"
|
||||
|
||||
ENV ELECTION_LOGDIR=/var/log/accountapp/elections
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ENV CIRCUIT_BREAKER_FILE /etc/accountapp/circuitBreaker.txt
|
||||
|
||||
# /home/jetty/.app is apparently needed by Stapler for some weird reason. O_O
|
||||
RUN \
|
||||
mkdir -p /home/jetty/.app &&\
|
||||
mkdir -p /etc/accountapp
|
||||
RUN mkdir -p /home/jetty/.app &&\
|
||||
mkdir -p /etc/accountapp &&\
|
||||
mkdir -p $ELECTION_LOGDIR
|
||||
|
||||
COPY config.properties.example /etc/accountapp/config.properties.example
|
||||
COPY circuitBreaker.txt /etc/accountapp/circuitBreaker.txt
|
||||
|
@ -20,10 +22,10 @@ COPY entrypoint.sh /entrypoint.sh
|
|||
|
||||
COPY build/libs/accountapp*.war /var/lib/jetty/webapps/ROOT.war
|
||||
|
||||
RUN \
|
||||
chmod 0755 /entrypoint.sh &&\
|
||||
chown -R jetty:root /etc/accountapp &&\
|
||||
chown -R jetty:root /var/lib/jetty
|
||||
RUN chmod 0755 /entrypoint.sh &&\
|
||||
chown -R jetty:root /etc/accountapp &&\
|
||||
chown -R jetty:root /var/lib/jetty &&\
|
||||
chown -R jetty:root $ELECTION_LOGDIR
|
||||
|
||||
USER jetty
|
||||
|
||||
|
|
|
@ -22,6 +22,6 @@ circuitBreakerFile=CIRCUIT_BREAKER_FILE
|
|||
electionCandidates=ELECTION_CANDIDATES
|
||||
electionClose=ELECTION_CLOSE
|
||||
electionOpen= ELECTION_OPEN
|
||||
electionLogfile=ELECTION_LOGFILE
|
||||
electionLogDir=ELECTION_LOGDIR
|
||||
|
||||
# vim: ft=conf
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
version: '3'
|
||||
services:
|
||||
app:
|
||||
run:
|
||||
build: .
|
||||
image: accountapp:latest
|
||||
env_file: .env
|
||||
|
|
|
@ -22,7 +22,14 @@ init_config_properties() {
|
|||
: "${ELECTION_CANDIDATES:? Required coma separated list of candidates}"
|
||||
: "${ELECTION_CLOSE:? Required date election will close. yyyy/MM/dd}"
|
||||
: "${ELECTION_OPEN:? date election will open. yyyy/MM/dd }"
|
||||
: "${ELECTION_LOGFILE:? path to store collected votes. assume this path is well persisted/backup }"
|
||||
: "${ELECTION_LOGDIR:? Require election log directory }"
|
||||
|
||||
#Directory to store collected votes. assume this path is well persisted/backup
|
||||
|
||||
if [ ! -d "${ELECTION_LOGDIR}" ]; then
|
||||
mkdir -p "${ELECTION_LOGDIR}"
|
||||
chown jetty: "$ELECTION_LOGDIR"
|
||||
fi
|
||||
|
||||
cp /etc/accountapp/config.properties.example /etc/accountapp/config.properties
|
||||
|
||||
|
@ -39,7 +46,7 @@ init_config_properties() {
|
|||
sed -i "s#ELECTION_CANDIDATES#$ELECTION_CANDIDATES#" /etc/accountapp/config.properties
|
||||
sed -i "s#ELECTION_OPEN#$ELECTION_OPEN#" /etc/accountapp/config.properties
|
||||
sed -i "s#ELECTION_CLOSE#$ELECTION_CLOSE#" /etc/accountapp/config.properties
|
||||
sed -i "s#ELECTION_LOGFILE#$ELECTION_LOGFILE#" /etc/accountapp/config.properties
|
||||
sed -i "s#ELECTION_LOGDIR#$ELECTION_LOGDIR#" /etc/accountapp/config.properties
|
||||
}
|
||||
|
||||
if [ ! -f /etc/accountapp/config.properties ]; then
|
||||
|
|
Loading…
Reference in New Issue