Author SHA1 Message Date
mrie04 a79e7a81f3 remove legacy java opt 2023-07-13 13:28:07 +02:00
mrie04 0183bd124e update to java 17 2023-03-13 15:08:18 +01:00
mrie04 d9610dd781 update to java 17 2023-03-13 15:04:26 +01:00
32 changed files with 289 additions and 688 deletions
-2
View File
@@ -1,2 +0,0 @@
# Legacy naming convention for docker containers
COMPOSE_COMPATIBILITY=true
-2
View File
@@ -3,5 +3,3 @@
**/*tar.gz
**/*.pgdump
**/*.swp
**/*.out
**/*.txt
+2
View File
@@ -1,3 +1,5 @@
[![Join the chat at https://gitter.im/metasfresh/metasfresh](https://badges.gitter.im/metasfresh/metasfresh.svg)](https://gitter.im/metasfresh/metasfresh?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
## About this repository: ##
This repository contains all necessary files in order to create metasfresh in a docker environment.
+1 -2
View File
@@ -1,5 +1,4 @@
ARG BASE_REGISTRY=metasfresh
FROM $BASE_REGISTRY/metasfresh-app:5.175
FROM metasfresh/metasfresh-app:5.174
COPY sources/configs/* /opt/metasfresh/
COPY sources/start_app.sh /opt/metasfresh/
@@ -27,11 +27,6 @@ spring.rabbitmq.port=5672
spring.rabbitmq.username=metasfresh
spring.rabbitmq.password=metasfresh
spring.rabbitmq.listener.direct.consumers-per-queue=1
spring.rabbitmq.listener.direct.prefetch=1
spring.rabbitmq.listener.simple.max-concurrency=1
spring.rabbitmq.listener.simple.prefetch=1
# --------------------------------------------------------------------------------
# Elasticsearch
# for more properties, see https://github.com/spring-projects/spring-boot/blob/v1.4.1.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchProperties.java
@@ -39,4 +34,3 @@ spring.rabbitmq.listener.simple.prefetch=1
# Elasticsearch cluster name.
spring.data.elasticsearch.cluster-name=metasfresh
spring.data.elasticsearch.cluster-nodes=search:9300
spring.data.elasticsearch.client.reactive.endpoints=search:9200
-9
View File
@@ -45,13 +45,6 @@ run_db_update()
cd /opt/metasfresh/dist/install/ && java -jar ./lib/de.metas.migration.cli.jar $@
}
# For Instances with Java8. Should have no effect on other java versions due to absolute paths used.
# Need to remove this file or we get "java.awt.AWTError: Assistive Technology not found: org.GNOME.Accessibility.AtkWrapper" when running jasper reports
remove_accessibility-properties(){
rm -fv /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/accessibility.properties
rm -fv /etc/java-8-openjdk/accessibility.properties
}
run_metasfresh()
{
@@ -89,8 +82,6 @@ wait_dbms
run_db_update
remove_accessibility-properties
run_metasfresh
exit 0
+1 -2
View File
@@ -1,5 +1,4 @@
ARG BASE_REGISTRY=metasfresh
FROM $BASE_REGISTRY/metasfresh-db:5.175
FROM metasfresh/metasfresh-db:5.174
RUN localedef -i de_DE -c -f UTF-8 -A /usr/share/locale/locale.alias de_DE.UTF-8
RUN localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
-1
View File
@@ -1,6 +1,5 @@
db:
build: db
shm_size: 256m
restart: always
volumes:
- ./volumes/db/data:/var/lib/postgresql/data
-137
View File
@@ -1,137 +0,0 @@
version: '3'
services:
db:
build: db
shm_size: 256m
restart: always
volumes:
- ./volumes/db/data:/var/lib/postgresql/data
- ./volumes/db/log:/var/log/postgresql
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
environment:
- METASFRESH_USERNAME=metasfresh
- METASFRESH_PASSWORD=metasfresh
- METASFRESH_DBNAME=metasfresh
- DB_SYSPASS=System
- POSTGRES_PASSWORD=ip2LmNzXX8p8iXg9lZTWEJ9524kQDbXFudB7LR03T-xK9fLweX3TLMkA2AYcEiaS
logging:
options:
max-size: '30m'
max-file: '3'
driver: json-file
app:
build: app
hostname: app
links:
- db:db
- rabbitmq:rabbitmq
- search:search
expose:
- "8282"
- "8788"
restart: always
volumes:
- ./volumes/app/log:/opt/metasfresh/log:rw
- ./volumes/app/heapdump:/opt/metasfresh/heapdump:rw
- ./volumes/app/external-lib:/opt/metasfresh/external-lib:rw
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
environment:
- METASFRESH_HOME=/opt/metasfresh
logging:
options:
max-size: '30m'
max-file: '3'
driver: json-file
webapi:
build: webapi
links:
- app:app
- db:db
- rabbitmq:rabbitmq
- search:search
expose:
- "8789"
# to access the webui-api directly
# (eg. for debugging or connecting your app to the metasfresh api)
# uncomment following port:
#ports:
#- "8080:8080"
restart: always
volumes:
- ./volumes/webapi/log:/opt/metasfresh-webui-api/log:rw
- ./volumes/webapi/heapdump:/opt/metasfresh-webui-api/heapdump:rw
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
logging:
options:
max-size: '30m'
max-file: '3'
driver: json-file
webui:
build: webui
links:
- webapi:webapi
ports:
- "80:80"
- "443:443"
restart: always
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
#uncomment and set to URL where metasfresh will be available from browsers
#environment:
#- WEBAPI_URL=http://example.com:8080
logging:
options:
max-size: '30m'
max-file: '3'
driver: json-file
rabbitmq:
build: rabbitmq
expose:
- "5672"
restart: always
volumes:
- ./volumes/rabbitmq/log:/var/log/rabbitmq/log
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
environment:
RABBITMQ_DEFAULT_USER: "metasfresh"
RABBITMQ_DEFAULT_PASS: "metasfresh"
RABBITMQ_DEFAULT_VHOST: "/"
logging:
options:
max-size: '30m'
max-file: '3'
driver: json-file
search:
build: search
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
cap_add:
- IPC_LOCK
# to access the search api directly
# (e.g. if you did docker-compose up search to have the deachboard with your locally running metasfresh services)
# uncomment following ports:
# ports:
# - "9200:9200"
# - "9300:9300"
volumes:
- ./volumes/search/data:/usr/share/elasticsearch/data
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
environment:
- "ES_JAVA_OPTS=-Xms128M -Xmx256m"
restart: always
logging:
options:
max-size: '30m'
max-file: '3'
driver: json-file
+2 -2
View File
@@ -6,13 +6,13 @@ RUN apt autoclean && apt update
RUN apt -y install netcat \
&& apt -y install curl \
&& apt -y install openjdk-8-jdk-headless \
&& apt -y install openjdk-17-jdk-headless \
&& apt -y install postgresql-client-12 \
&& apt -y autoremove \
&& apt -y autoclean
RUN mkdir -p /opt/metasfresh
RUN curl https://repo.metasfresh.com/repository/mvn-release-releases/de/metas/dist/metasfresh-dist-dist/5.174.2-461+release/metasfresh-dist-dist-5.174.2-461+release-dist.tar.gz \
RUN curl https://repo.metasfresh.com/repository/mvn-master_java14-releases/de/metas/dist/metasfresh-dist-dist/5.176.2-63+masterjava14/metasfresh-dist-dist-5.176.2-63+masterjava14-dist.tar.gz \
| tar -xzC /opt/metasfresh/
RUN mkdir -p /opt/metasfresh/heapdump
+2 -2
View File
@@ -6,7 +6,7 @@ RUN apt autoclean && apt update
RUN apt -y install netcat \
&& apt -y install curl \
&& apt -y install openjdk-8-jdk-headless \
&& apt -y install openjdk-17-jdk-headless \
&& apt -y install postgresql-client-12 \
&& apt -y autoremove \
&& apt -y autoclean
@@ -15,7 +15,7 @@ COPY sources/configs/local_settings.properties /root/
RUN mkdir -p /opt/metasfresh-webui-api/metasfresh-webui-api \
&& mkdir -p /opt/metasfresh-webui-api/log \
&& mkdir -p /opt/metasfresh-webui-api/heapdump
RUN curl https://repo.metasfresh.com/repository/mvn-release/de/metas/ui/web/metasfresh-webui-api/5.174.2-461+release/metasfresh-webui-api-5.174.2-461+release.jar \
RUN curl https://repo.metasfresh.com/repository/mvn-master_java14/de/metas/ui/web/metasfresh-webui-api/5.176.2-63+masterjava14/metasfresh-webui-api-5.176.2-63+masterjava14.jar \
--output /opt/metasfresh-webui-api/metasfresh-webui-api.jar \
&& chmod 750 /opt/metasfresh-webui-api/metasfresh-webui-api.jar
+1 -1
View File
@@ -28,7 +28,7 @@ wait_dbms()
run_metasfresh()
{
cd /opt/metasfresh-webui-api/ && java -Dsun.misc.URLClassPath.disableJarChecking=true \
-Xmx1024M -XX:MaxPermSize=512M \
-Xmx1024M \
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/metasfresh/heapdump \
-DPropertyFile=/opt/metasfresh-webui-api/metasfresh.properties \
-Dcom.sun.management.jmxremote.port=1618 \
-36
View File
@@ -1,36 +0,0 @@
#thx to https://github.com/tianon/docker-postgres-upgrade/tree/master/9.6-to-15
FROM postgres:15.1
RUN sed -i 's/$/ 9.5/' /etc/apt/sources.list.d/pgdg.list
RUN apt-get update && apt-get install -y --no-install-recommends \
postgresql-9.5=9.5.25-6.pgdg110+1 \
postgresql-contrib-9.5=9.5.25-6.pgdg110+1 \
&& rm -rf /var/lib/apt/lists/*
RUN localedef -i de_DE -c -f UTF-8 -A /usr/share/locale/locale.alias de_DE.UTF-8
RUN localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LANG=de_DE.UTF-8
ENV LANGUAGE=en_US.UTF-8
ENV LC_MESSAGES=en_US.UTF-8
ENV PGBINOLD /usr/lib/postgresql/9.5/bin
ENV PGBINNEW /usr/lib/postgresql/15/bin
ENV PGDATAOLD /var/lib/postgresql/9.5/data
ENV PGDATANEW /var/lib/postgresql/15/data
RUN mkdir -p "$PGDATAOLD" "$PGDATANEW" \
&& chown -R postgres:postgres /var/lib/postgresql
WORKDIR /var/lib/postgresql
COPY docker-upgrade /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-upgrade
ENTRYPOINT ["/usr/local/bin/docker-upgrade"]
# recommended: --link
CMD ["pg_upgrade"]
-25
View File
@@ -1,25 +0,0 @@
#!/bin/bash
# thx to https://github.com/tianon/docker-postgres-upgrade/tree/master/9.6-to-15
set -e
if [ "$#" -eq 0 -o "${1:0:1}" = '-' ]; then
set -- pg_upgrade "$@"
fi
if [ "$1" = 'pg_upgrade' -a "$(id -u)" = '0' ]; then
mkdir -p "$PGDATAOLD" "$PGDATANEW"
chmod 700 "$PGDATAOLD" "$PGDATANEW"
chown postgres .
chown -R postgres "$PGDATAOLD" "$PGDATANEW"
exec gosu postgres "$BASH_SOURCE" "$@"
fi
if [ "$1" = 'pg_upgrade' ]; then
if [ ! -s "$PGDATANEW/PG_VERSION" ]; then
PGDATA="$PGDATANEW" eval "initdb $POSTGRES_INITDB_ARGS"
fi
fi
exec "$@"
-12
View File
@@ -1,12 +0,0 @@
FROM postgres:15.1
RUN apt-get update
RUN localedef -i de_DE -c -f UTF-8 -A /usr/share/locale/locale.alias de_DE.UTF-8
RUN localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LANG=de_DE.UTF-8
ENV LANGUAGE=en_US.UTF-8
ENV LC_MESSAGES=en_US.UTF-8
CMD ["postgres"]
@@ -1,14 +0,0 @@
version: '3'
services:
afterdb:
build: db15
restart: unless-stopped
volumes:
- ./../volumes/newdb/data:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=ip2LmNzXX8p8iXg9lZTWEJ9524kQDbXFudB7LR03T-xK9fLweX3TLMkA2AYcEiaS
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U metasfresh", "-d", "metasfresh" ]
interval: 30s
timeout: 60s
retries: 5
@@ -1,21 +0,0 @@
version: '3'
services:
beforedb:
build: ./../db
restart: unless-stopped
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U metasfresh", "-d", "metasfresh" ]
interval: 30s
timeout: 60s
retries: 5
volumes:
- ./../volumes/db/data:/var/lib/postgresql/data
- ./../volumes/db/log:/var/log/postgresql
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
environment:
- METASFRESH_USERNAME=metasfresh
- METASFRESH_PASSWORD=metasfresh
- METASFRESH_DBNAME=metasfresh
- DB_SYSPASS=System
- POSTGRES_PASSWORD=ip2LmNzXX8p8iXg9lZTWEJ9524kQDbXFudB7LR03T-xK9fLweX3TLMkA2AYcEiaS
@@ -1,11 +0,0 @@
version: '3'
services:
upgradedb:
build: db-9.5-to-15
image: upgradedb
restart: unless-stopped
volumes:
- ./../volumes/newdb/data:/var/lib/postgresql/15/data
- ./../volumes/db/data:/var/lib/postgresql/9.5/data
environment:
- POSTGRES_PASSWORD=ip2LmNzXX8p8iXg9lZTWEJ9524kQDbXFudB7LR03T-xK9fLweX3TLMkA2AYcEiaS
-226
View File
@@ -1,226 +0,0 @@
#!/bin/bash
#title :upgrade_postgres.sh
#description :
#author :max.rieck@metasfresh.com
#date :2022-11-29
#usage :nohup bash ./upgrade_postgres.sh
#logs :tail -f nohup.out
#
# Prerequisites: Enough storage space to store a second db-volume
#
# unknown data-types aren't supported anymore, they should be altered before upgrade
# SELECT *
# FROM information_schema.columns
# WHERE data_type ILIKE 'unknown';
#
# before starting set POSTGRES_PASSWORD in docker-compose-before-upgrade-postgres.yml
# before starting set POSTGRES_PASSWORD in docker-compose-upgrade-postgres.yml
# before starting set POSTGRES_PASSWORD in docker-compose-after-upgrade-postgres.yml
#
# ATTENTION:
# this script generates and executes SQL to alternate Tables with oids
#======================================================================================================
start=$(date +%s)
instance=$(basename "${PWD%/*}")
echo "stopping metasfresh instance $instance"
docker-compose -p "$instance" stop
while [ "$(docker inspect -f '{{.State.Running}}' "${instance}"_db_1)" == "true" ] ; do
sleep 2
echo "waiting for $instance to stop..."
done
echo "waiting for $instance to stop... done"
echo ""
echo "docker-compose up -f docker-compose-before-upgrade-postgres.yml -p ${instance}-before-upgrade-postgres"
if ! docker-compose -f docker-compose-before-upgrade-postgres.yml -p "${instance}"-before-upgrade-postgres up -d; then
end=$(date +%s)
runtime=$((end-start))
echo "script failed after ${runtime}s"
exit 1
fi
echo "starting postgres beforedb for handling tables with oids"
while [ "$(docker inspect -f '{{.State.Health.Status}}' "${instance}"-before-upgrade-postgres-beforedb-1)" != "healthy" ]; do
echo "waiting for db..."
sleep 5
done
echo "waiting for db... done"
echo ""
echo "alter known oid-tables to without oids"
docker exec -i "${instance}"-before-upgrade-postgres-beforedb-1 psql -U metasfresh -d metasfresh -tAc "
ALTER TABLE de_metas_acct.accounting_docs_to_repost SET WITHOUT OIDS;
ALTER TABLE public.c_invoice_candidate_recompute SET WITHOUT OIDS;
ALTER TABLE public.fact_acct_log SET WITHOUT OIDS;
"
docker exec -i "${instance}"-before-upgrade-postgres-beforedb-1 psql -U metasfresh -d metasfresh -tAc "
SELECT quote_ident(nspname) || '.' || quote_ident(relname)
FROM pg_catalog.pg_class c
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE 1=1
AND c.relkind = 'r'
AND c.relhasoids = true
AND n.nspname <> 'pg_catalog'
order by n.nspname, c.relname;
" >tables_with_oids.txt
rm handle_tables_with_oids.sql 2> /dev/null
while read -ru 3 p; do
nextOID=$(docker exec -i "${instance}"-before-upgrade-postgres-beforedb-1 pg_controldata -D /var/lib/postgresql/data | grep OID)
nextOID=${nextOID#"Latest checkpoint's NextOID:"}
nextOID=${nextOID// /}
echo "
ALTER TABLE $p DISABLE TRIGGER ALL;
ALTER TABLE $p ADD newoid bigint NOT NULL;
UPDATE $p SET newoid = oid;
ALTER TABLE $p SET WITHOUT OIDS;
ALTER TABLE $p RENAME newoid TO oid;
CREATE SEQUENCE IF NOT EXISTS oid_seq;
ALTER TABLE $p ALTER oid SET DEFAULT nextval('oid_seq');
SELECT setval('oid_seq', $nextOID);
ALTER TABLE $p ENABLE TRIGGER ALL;
" >> handle_tables_with_oids.sql
done 3< tables_with_oids.txt
oidsql=$(cat handle_tables_with_oids.sql)
docker exec -i "${instance}"-before-upgrade-postgres-beforedb-1 psql -U metasfresh -d metasfresh -c "$oidsql"
echo "docker stop ${instance}-before-upgrade-postgres-beforedb-1"
docker stop "${instance}"-before-upgrade-postgres-beforedb-1
while [ "$(docker inspect -f '{{.State.Running}}' "${instance}"-before-upgrade-postgres-beforedb-1)" == "true" ]; do
sleep 2
echo "waiting for ${instance}-before-upgrade-postgres-beforedb-1 to stop..."
done
echo "waiting for ${instance}-before-upgrade-postgres-beforedb-1 to stop... done"
echo "docker rm ${instance}-before-upgrade-postgres-beforedb-1"
docker rm "${instance}"-before-upgrade-postgres-beforedb-1
echo "docker-compose up -f docker-compose-upgrade-postgres.yml -p ${instance}-upgrade-postgres"
docker-compose -f docker-compose-upgrade-postgres.yml -p "${instance}"-upgrade-postgres up
docker exec -i -u postgres "${instance}"-upgrade-postgres-upgradedb-1 cp ./update_extensions.sql /var/lib/postgresql/15/data/update_extensions.sql
upgradelogs=$(docker logs "${instance}"-upgrade-postgres-upgradedb-1 --tail 100)
grep -wq "Upgrade Complete" <<< "$upgradelogs"
upgradeComplete=$?
echo "docker stop ${instance}-upgrade-postgres-upgradedb-1"
docker stop "${instance}"-upgrade-postgres-upgradedb-1
while [ "$(docker inspect -f '{{.State.Running}}' "${instance}"-upgrade-postgres-upgradedb-1)" == "true" ]; do
sleep 2
echo "waiting for ${instance}-upgrade-postgres-upgradedb-1 to stop..."
done
echo "waiting for ${instance}-upgrade-postgres-upgradedb-1 to stop... done"
echo ""
echo "docker rm ${instance}-upgrade-postgres-upgradedb-1"
docker rm "${instance}"-upgrade-postgres-upgradedb-1
if [ $upgradeComplete -ne 0 ]; then
echo "upgrade failed removing newdb volume..."
rm -r ./../volumes/newdb
end=$(date +%s)
runtime=$((end-start))
echo "script failed after ${runtime}s"
exit 1
fi
echo "copying config files..."
cp ./../volumes/db/data/pg_hba.conf ./../volumes/newdb/data/pg_hba.conf
cp ./../volumes/db/data/postgresql.conf ./../volumes/newdb/data/postgresql.conf
cp ./../volumes/db/data/postgresql.auto.conf ./../volumes/newdb/data/postgresql.auto.conf
echo "copying config files... done"
echo ""
docker-compose -f docker-compose-after-upgrade-postgres.yml -p "${instance}"-after-upgrade-postgres up -d
echo "starting postgres afterdb for update extensions, vacuumdb and reindex"
while [ "$(docker inspect -f '{{.State.Health.Status}}' "${instance}"-after-upgrade-postgres-afterdb-1)" != "healthy" ]; do
echo "waiting for db..."
sleep 5
done
echo "waiting for db... done"
echo ""
echo "update extensions"
docker exec -i -u postgres "${instance}"-after-upgrade-postgres-afterdb-1 psql -U metasfresh -d metasfresh -f "/var/lib/postgresql/data/update_extensions.sql"
rm ./../volumes/newdb/data/update_extensions.sql
echo ""
start_vacuumdb=$(date +%s)
echo "vacuumdb -d metasfresh --analyze-in-stages -v"
docker exec -i -u postgres "${instance}"-after-upgrade-postgres-afterdb-1 vacuumdb -d metasfresh --analyze-in-stages -v
end_vacuumdb=$(date +%s)
runtime_vacuumdb=$((end_vacuumdb-start_vacuumdb))
echo "vacuumdb took ${runtime_vacuumdb}s"
echo ""
start_reindex=$(date +%s)
echo "REINDEX each table of metasfresh database"
docker exec -i -u postgres "${instance}"-after-upgrade-postgres-afterdb-1 psql -U metasfresh -d metasfresh -tAc "
SELECT 'REINDEX (VERBOSE, CONCURRENTLY) TABLE ' || quote_ident(nspname) || '.' || quote_ident(relname) || ' /*' || pg_size_pretty(pg_total_relation_size(C.oid)) || '*/;'
FROM pg_class C
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE nspname <> 'pg_catalog'
AND C.relkind = 'r'
AND nspname !~ '^pg_toast'
ORDER BY pg_total_relation_size(C.oid) ASC;
" > tables_to_reindex.txt
#ignore table if needed
#grep -v "tablename" tables_to_reindex.txt > tmpfile && mv tmpfile tables_to_reindex.txt
while read -ru 3 p; do
echo "$p"
docker exec -i -u postgres "${instance}"-after-upgrade-postgres-afterdb-1 psql -U metasfresh -d metasfresh -c "$p"
echo ""
done 3< tables_to_reindex.txt
end_reindex=$(date +%s)
runtime_reindex=$((end_reindex-start_reindex))
echo "REINDEX took ${runtime_reindex}s"
echo ""
echo "docker stop afterdb"
docker stop "${instance}"-after-upgrade-postgres-afterdb-1
while [ "$(docker inspect -f '{{.State.Running}}' "${instance}"-after-upgrade-postgres-afterdb-1)" == "true" ]; do
sleep 2
echo "waiting for ${instance}-after-upgrade-postgres-afterdb-1 to stop..."
done
echo "waiting for ${instance}-after-upgrade-postgres-afterdb-1 to stop... done"
echo "docker rm afterdb"
docker rm "${instance}"-after-upgrade-postgres-afterdb-1
mv ./../volumes/db ./../volumes/olddb
mv ./../volumes/newdb ./../volumes/db
echo ""
echo "upgrade done! You can now change db image and restart the instance"
echo ""
end=$(date +%s)
runtime=$((end-start))
echo "script finished in ${runtime}s"
-1
View File
@@ -1 +0,0 @@
FROM postgrest/postgrest:latest
+1 -2
View File
@@ -1,5 +1,4 @@
ARG BASE_REGISTRY=metasfresh
FROM $BASE_REGISTRY/metasfresh-webapi:5.175
FROM metasfresh/metasfresh-webapi:5.174
COPY sources/configs/* /opt/metasfresh-webui-api/
COPY sources/start_webapi.sh /opt/metasfresh-webui-api/
@@ -16,11 +16,6 @@ spring.rabbitmq.port=5672
spring.rabbitmq.username=metasfresh
spring.rabbitmq.password=metasfresh
spring.rabbitmq.listener.direct.consumers-per-queue=1
spring.rabbitmq.listener.direct.prefetch=1
spring.rabbitmq.listener.simple.max-concurrency=1
spring.rabbitmq.listener.simple.prefetch=1
# --------------------------------------------------------------------------------
# Elasticsearch
# for more properties, see https://github.com/spring-projects/spring-boot/blob/v1.4.1.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchProperties.java
@@ -28,7 +23,6 @@ spring.rabbitmq.listener.simple.prefetch=1
# Elasticsearch cluster name.
spring.data.elasticsearch.cluster-name=metasfresh
spring.data.elasticsearch.cluster-nodes=search:9300
spring.data.elasticsearch.client.reactive.endpoints=search:9200
# --------------------------------------------------------------------------------
# Logging
+1 -1
View File
@@ -25,7 +25,7 @@ wait_dbms()
run_metasfresh()
{
cd /opt/metasfresh-webui-api/ && java -Dsun.misc.URLClassPath.disableJarChecking=true \
-Xmx1024M \
-Xmx1024M -XX:MaxPermSize=512M \
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/metasfresh-webui-api/heapdump \
-DPropertyFile=/opt/metasfresh-webui-api/metasfresh.properties \
-Dcom.sun.management.jmxremote.port=1618 \
+23 -20
View File
@@ -1,24 +1,27 @@
ARG BASE_REGISTRY=metasfresh
ARG MF_VERSION=5.175
FROM metasfresh/metasfresh-webui:5.174
FROM ${BASE_REGISTRY}/metasfresh-webui:${MF_VERSION} AS bundle
# nginx:stable (Debian, not alpine) for GNU sed in the entrypoint.
FROM nginx:stable
RUN rm -f /etc/nginx/conf.d/default.conf
# openssl is used by the entrypoint to validate mounted certs.
RUN apt-get update \
&& apt-get install -y --no-install-recommends openssl \
&& rm -rf /var/lib/apt/lists/*
COPY conf.d/ /etc/nginx/conf.d/
COPY snippets/ /etc/nginx/snippets/
COPY docker-entrypoint.d/10-metasfresh.sh /docker-entrypoint.d/10-metasfresh.sh
RUN chmod +x /docker-entrypoint.d/10-metasfresh.sh
COPY --from=bundle /opt/metasfresh-webui-frontend/dist/ /opt/metasfresh-webui-frontend/dist/
COPY sources/configs/config.js /opt/metasfresh-webui-frontend/dist/
COPY sources/configs/config.js /opt/metasfresh-webui-frontend/dist/
COPY sources/configs/mobile/config.js /opt/metasfresh-webui-frontend/dist/mobile/
#add apache config
COPY sources/configs/metasfresh_webui.conf /etc/apache2/sites-available/
RUN mkdir -p /etc/apache2/certs/
COPY sources/certs /etc/apache2/certs
RUN a2ensite metasfresh_webui.conf
#set environment
RUN . /etc/apache2/envvars
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_PID_FILE /var/run/apache2.pid
ENV APACHE_RUN_DIR /var/run/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
ENV APACHE_LOG_DIR /var/log/apache2
RUN chown www-data:www-data -R /opt/metasfresh-webui-frontend/
EXPOSE 80 443
ENTRYPOINT ["/start_webui.sh"]
-11
View File
@@ -1,11 +0,0 @@
# WebSocket upgrade map.
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# Preserve X-Forwarded-Proto from the host proxy, fall back to $scheme.
map $http_x_forwarded_proto $forwarded_proto {
default $http_x_forwarded_proto;
'' $scheme;
}
-11
View File
@@ -1,11 +0,0 @@
# Enabled by the entrypoint (renamed to webui-ssl.conf) only when certs are mounted.
server {
listen 443 ssl;
server_name _;
ssl_certificate /etc/nginx/certs/fullchain.pem;
ssl_certificate_key /etc/nginx/certs/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
include /etc/nginx/snippets/metasfresh-locations.conf;
}
-5
View File
@@ -1,5 +0,0 @@
server {
listen 80;
server_name _;
include /etc/nginx/snippets/metasfresh-locations.conf;
}
@@ -1,49 +0,0 @@
#!/bin/sh
# Patch config.js, set the webapi upstream, and enable SSL if certs are mounted.
set -eu
DIST=/opt/metasfresh-webui-frontend/dist
CONF_D=/etc/nginx/conf.d
CERT_DIR=/etc/nginx/certs
if [ -n "${WEBAPI_URL:-}" ]; then
sed -i "s,http://MYDOCKERHOST:PORT,${WEBAPI_URL},g" "$DIST/config.js"
sed -i "s,http://MYDOCKERHOST:PORT,${WEBAPI_URL},g" "$DIST/mobile/config.js"
fi
# Default plain HTTP; override with WEBAPI_UPSTREAM (e.g. https://webapi:8443).
sed -i "s|__WEBAPI_UPSTREAM__|${WEBAPI_UPSTREAM:-http://webapi:8080}|g" \
/etc/nginx/snippets/metasfresh-locations.conf
CERT="$CERT_DIR/fullchain.pem"
KEY="$CERT_DIR/privkey.pem"
if [ ! -e "$CERT" ] && [ ! -e "$KEY" ]; then
rm -f "$CONF_D/webui-ssl.conf"
echo "[METASFRESH] Running Non-SSL!"
else
[ -e "$CERT" ] || { echo "[METASFRESH] FATAL: privkey.pem present but fullchain.pem missing"; exit 1; }
[ -e "$KEY" ] || { echo "[METASFRESH] FATAL: fullchain.pem present but privkey.pem missing"; exit 1; }
[ -s "$CERT" ] || { echo "[METASFRESH] FATAL: fullchain.pem is empty"; exit 1; }
[ -s "$KEY" ] || { echo "[METASFRESH] FATAL: privkey.pem is empty"; exit 1; }
# Match key and cert by public key (RSA and EC).
cert_pub=$(openssl x509 -in "$CERT" -noout -pubkey 2>/dev/null) \
|| { echo "[METASFRESH] FATAL: fullchain.pem is not a valid certificate"; exit 1; }
key_pub=$(openssl pkey -in "$KEY" -pubout 2>/dev/null) \
|| { echo "[METASFRESH] FATAL: privkey.pem is not a valid private key"; exit 1; }
[ "$cert_pub" = "$key_pub" ] \
|| { echo "[METASFRESH] FATAL: privkey.pem does not match fullchain.pem"; exit 1; }
# Expiry is a warning only; an expired cert still serves.
if ! openssl x509 -in "$CERT" -noout -checkend 0 >/dev/null 2>&1; then
echo "[METASFRESH] WARNING: fullchain.pem is EXPIRED"
elif ! openssl x509 -in "$CERT" -noout -checkend 2592000 >/dev/null 2>&1; then
echo "[METASFRESH] WARNING: fullchain.pem expires within 30 days"
fi
cp "$CONF_D/webui-ssl.conf.disabled" "$CONF_D/webui-ssl.conf"
sed -i 's/\bhttp\b/https/g' "$DIST/config.js" "$DIST/mobile/config.js"
nginx -t || { echo "[METASFRESH] FATAL: nginx config test failed"; exit 1; }
echo "[METASFRESH] Activated SSL!"
fi
-67
View File
@@ -1,67 +0,0 @@
# Shared locations for the HTTP and SSL servers.
# __WEBAPI_UPSTREAM__ is replaced by the entrypoint (default http://webapi:8080).
root /opt/metasfresh-webui-frontend/dist;
index index.html;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $forwarded_proto;
proxy_buffers 256 16k;
proxy_buffer_size 16k;
proxy_read_timeout 600s;
client_max_body_size 100M;
# webapi
location /rest { proxy_pass __WEBAPI_UPSTREAM__; }
location /info { proxy_pass __WEBAPI_UPSTREAM__; }
location /configuration { proxy_pass __WEBAPI_UPSTREAM__; }
location /oauth2 { proxy_pass __WEBAPI_UPSTREAM__; }
location /login/oauth2 { proxy_pass __WEBAPI_UPSTREAM__; }
location /swagger-ui.html { proxy_pass __WEBAPI_UPSTREAM__; }
location /swagger-ui/ { proxy_pass __WEBAPI_UPSTREAM__; }
location /swagger-resources { proxy_pass __WEBAPI_UPSTREAM__; }
location /v2/api-docs { proxy_pass __WEBAPI_UPSTREAM__; }
location /v3/api-docs { proxy_pass __WEBAPI_UPSTREAM__; }
location /webjars/springfox-swagger-ui { proxy_pass __WEBAPI_UPSTREAM__; }
location /stomp {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
client_max_body_size 50M;
proxy_pass __WEBAPI_UPSTREAM__;
}
# app
location = /app { return 308 /app/; }
location /app/ {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
client_max_body_size 50M;
proxy_pass http://app:8282/;
}
# static + SPA + mobile
location = /index.html {
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
expires -1;
}
location = /service-worker.js {
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
expires -1;
}
location /mobile/ {
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
expires -1;
try_files $uri /mobile/index.html;
}
location / {
try_files $uri /index.html;
}
+121
View File
@@ -0,0 +1,121 @@
<VirtualHost *:80>
ProxyRequests Off
DocumentRoot /opt/metasfresh-webui-frontend/dist/
# Logging
ErrorLog ${APACHE_LOG_DIR}/webui_error.log
CustomLog ${APACHE_LOG_DIR}/webui_access.log combined
# Debugging
# NOTE: pls comment the ErrorLog and CustomLog entries above
#ErrorLog /dev/stdout
#TransferLog /dev/stdout
#LogLevel alert rewrite:trace8
<Location /rest>
Order allow,deny
Allow from all
ProxyPass http://webapi:8080/rest/ retry=0 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse http://webapi:8080/rest/
</Location>
<Location /stomp>
Order allow,deny
Allow from all
RewriteEngine on
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
RewriteRule .* ws://webapi:8080%{REQUEST_URI} [P]
ProxyPass ws://webapi:8080/stomp/ retry=0 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse ws://webapi:8080/stomp/
ProxyPass http://webapi:8080/stomp/ retry=0 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse http://webapi:8080/stomp/
</Location>
<Location /info>
Order allow,deny
Allow from all
ProxyPass http://webapi:8080/info retry=0 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse http://webapi:8080/info
</Location>
<Location /swagger-ui.html>
Order allow,deny
Allow from all
ProxyPass http://webapi:8080/swagger-ui.html retry=0 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse http://webapi:8080/swagger-ui.html
</Location>
<Location /v2/api-docs>
Order allow,deny
Allow from all
ProxyPass http://webapi:8080/v2/api-docs/ retry=0 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse http://webapi:8080/v2/api-docs/
</Location>
<Location /swagger-resources>
Order allow,deny
Allow from all
ProxyPass http://webapi:8080/swagger-resources/ retry=0 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse http://webapi:8080/swagger-resources/
</Location>
<Location /webjars/springfox-swagger-ui>
Order allow,deny
Allow from all
ProxyPass http://webapi:8080/webjars/springfox-swagger-ui/ retry=0 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse http://webapi:8080/webjars/springfox-swagger-ui/
</Location>
<Location /configuration>
Order allow,deny
Allow from all
ProxyPass http://webapi:8080/configuration/ retry=0 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse http://webapi:8080/configuration/
</Location>
<Location /info>
Order allow,deny
Allow from all
ProxyPass http://webapi:8080/info retry=0 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse http://webapi:8080/info
</Location>
<Location /mobile>
Order allow,deny
Allow from all
FileETag None
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 21 Oct 2015 07:28:00 GMT"
</Location>
<Directory /opt/metasfresh-webui-frontend/dist/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
RewriteEngine On
# Existing file or directory
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]
# mobile UI
RewriteCond %{REQUEST_URI} ^/mobile
RewriteRule ^ /mobile/index.html [L]
# Fallback:
RewriteRule ^ /index.html
</Directory>
<Files index.html>
FileETag None
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 21 Oct 2015 07:28:00 GMT"
</Files>
</VirtualHost>
@@ -0,0 +1,133 @@
<IfModule mod_ssl.c>
<VirtualHost *:443>
ProxyRequests Off
DocumentRoot /opt/metasfresh-webui-frontend/dist/
# Logging
ErrorLog ${APACHE_LOG_DIR}/webui_error.log
CustomLog ${APACHE_LOG_DIR}/webui_access.log combined
# Debugging
# NOTE: pls comment the ErrorLog and CustomLog entries above
#ErrorLog /dev/stdout
#TransferLog /dev/stdout
#LogLevel alert rewrite:trace8
<Location /rest>
Order allow,deny
Allow from all
ProxyPass http://webapi:8080/rest/ retry=0 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse http://webapi:8080/rest/
</Location>
<Location /stomp>
Order allow,deny
Allow from all
RewriteEngine on
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
RewriteRule .* ws://webapi:8080%{REQUEST_URI} [P]
ProxyPass wss://webapi:8080/stomp/ retry=0 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse wss://webapi:8080/stomp/
ProxyPass http://webapi:8080/stomp/ retry=0 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse http://webapi:8080/stomp/
</Location>
<Location /info>
Order allow,deny
Allow from all
ProxyPass http://webapi:8080/info retry=0 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse http://webapi:8080/info
</Location>
<Location /swagger-ui.html>
Order allow,deny
Allow from all
ProxyPass http://webapi:8080/swagger-ui.html retry=0 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse http://webapi:8080/swagger-ui.html
</Location>
<Location /v2/api-docs>
Order allow,deny
Allow from all
ProxyPass http://webapi:8080/v2/api-docs/ retry=0 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse http://webapi:8080/v2/api-docs/
</Location>
<Location /swagger-resources>
Order allow,deny
Allow from all
ProxyPass http://webapi:8080/swagger-resources/ retry=0 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse http://webapi:8080/swagger-resources/
</Location>
<Location /webjars/springfox-swagger-ui>
Order allow,deny
Allow from all
ProxyPass http://webapi:8080/webjars/springfox-swagger-ui/ retry=0 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse http://webapi:8080/webjars/springfox-swagger-ui/
</Location>
<Location /configuration>
Order allow,deny
Allow from all
ProxyPass http://webapi:8080/configuration/ retry=0 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse http://webapi:8080/configuration/
</Location>
<Location /info>
Order allow,deny
Allow from all
ProxyPass http://webapi:8080/info retry=0 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse http://webapi:8080/info
</Location>
<Location /mobile>
Order allow,deny
Allow from all
FileETag None
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 21 Oct 2015 07:28:00 GMT"
</Location>
<Directory /opt/metasfresh-webui-frontend/dist/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
RewriteEngine On
# Existing file or directory
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]
# mobile UI
RewriteCond %{REQUEST_URI} ^/mobile
RewriteRule ^ /mobile/index.html [L]
# Fallback:
RewriteRule ^ /index.html
</Directory>
<Files index.html>
FileETag None
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 21 Oct 2015 07:28:00 GMT"
</Files>
<Files service-worker.js>
FileETag None
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 21 Oct 2015 07:28:00 GMT"
</Files>
SSLCertificateFile /etc/apache2/certs/fullchain.pem
SSLCertificateKeyFile /etc/apache2/certs/privkey.pem
</VirtualHost>
</IfModule>
+1 -4
View File
@@ -1,6 +1,3 @@
const config = {
SERVER_URL: 'http://MYDOCKERHOST:PORT/app'
};
window.config = {
SERVER_URL: 'http://MYDOCKERHOST:PORT/app'
SERVER_URL: 'http://MYDOCKERHOST:PORT/app',
};