Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(docker):Update couchdb3.1 ubuntu20.04 liferay7.3.4 postgresql12 #1323

Merged
merged 2 commits into from
Aug 18, 2021
Merged
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
14 changes: 8 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,29 @@ RUN ./scripts/docker-config/install_scripts/build_couchdb_lucene.sh
RUN ./scripts/docker-config/install_scripts/download_liferay_and_dependencies.sh


FROM ubuntu:18.04
FROM ubuntu:20.04

WORKDIR /app/

USER root

COPY ./scripts/install-thrift.sh .

COPY --from=builder /app/build/sw360/liferay-ce-portal-7.3.3-ga4 /app/liferay-ce-portal-7.3.3-ga4
COPY --from=builder /app/build/sw360/liferay-ce-portal-7.3.4-ga5 /app/liferay-ce-portal-7.3.4-ga5

COPY --from=builder /app/build/sw360/deployables/webapps /app/liferay-ce-portal-7.3.3-ga4/tomcat-9.0.33/webapps
COPY --from=builder /app/build/sw360/deployables/webapps /app/liferay-ce-portal-7.3.4-ga5/tomcat-9.0.33/webapps

COPY --from=builder /app/build/sw360/deployables/deploy /app/liferay-ce-portal-7.3.3-ga4/deploy
COPY --from=builder /app/build/sw360/deployables/deploy /app/liferay-ce-portal-7.3.4-ga5/deploy

COPY ./scripts/docker-config/portal-ext.properties /app/liferay-ce-portal-7.3.3-ga4
COPY ./scripts/docker-config/portal-ext.properties /app/liferay-ce-portal-7.3.4-ga5

COPY ./scripts/docker-config/etc_sw360 /etc/sw360/

COPY ./scripts/docker-config/install_scripts .

COPY ./scripts/docker-config/setenv.sh /app/liferay-ce-portal-7.3.3-ga4/tomcat-9.0.33/bin
COPY ./scripts/docker-config/setenv.sh /app/liferay-ce-portal-7.3.4-ga5/tomcat-9.0.33/bin

RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install tzdata -y --no-install-recommends

RUN ./install-thrift.sh

Expand Down
57 changes: 57 additions & 0 deletions scripts/docker-config/etc_sw360/authorization/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#
# Copyright Siemens AG, 2017, 2019. Part of the SW360 Portal Project.
#
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#

# Port to open in standalone mode
server:
port: 8090

# Connection to the couch databases. Will be used to store client credentials
couchdb:
url: http://localhost:5984
database: sw360oauthclients
# if your couchdb does not use authentication, pls just don't use the settings for username and password
username: admin
password: password

jwt:
secretkey: sw360SecretKey

spring:
jackson:
serialization:
indent_output: true

# Common SW360 properties
sw360:
# The url of the Liferay instance
sw360-portal-server-url: ${SW360_PORTAL_SERVER_URL:http://127.0.0.1:8080}
# The id of the company in Liferay that sw360 is run for
sw360-liferay-company-id: ${SW360_LIFERAY_COMPANY_ID:20101}
# Allowed origins that should be set in the header
cors:
allowed-origin: ${SW360_CORS_ALLOWED_ORIGIN:#{null}}

security:
# Configuration for enabling authorization via headers, e.g. when using SSO
# in combination with a reverse proxy server
customheader:
headername:
# You have to enable authorization by headers explicitly here
enabled: false
# Attention: please make sure that the proxy is removing there headers
# if they are coming from anywhere else then the authentication server
intermediateauthstore: custom-header-auth-marker
email: authenticated-email
extid: authenticated-extid
# also available - at least in saml pre auth - are "givenname", "surname" and "department"

oauth2:
resource:
id: sw360-REST-API
4 changes: 2 additions & 2 deletions scripts/docker-config/etc_sw360/couchdb.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#

couchdb.url = http://localhost:5984
couchdb.user =
couchdb.password =
couchdb.user = admin
couchdb.password = password
couchdb.database = sw360db
couchdb.usersdb = sw360users
couchdb.attachments = sw360attachments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ build_couchdb_lucene() {
tar -xzf couchdb-lucene.tar.gz
cd couchdb-lucene-2.1.0
sed -i "s/allowLeadingWildcard=false/allowLeadingWildcard=true/" ./src/main/resources/couchdb-lucene.ini
sed -i "s/localhost:5984/admin:password@localhost:5984/" ./src/main/resources/couchdb-lucene.ini
wget https://raw.githubusercontent.com/sw360/sw360vagrant/master/shared/couchdb-lucene.patch
patch -p1 < couchdb-lucene.patch
mvn -s /app/build/sw360/scripts/docker-config/mvn-proxy-settings.xml clean install war:war
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# -----------------------------------------------------------------------------

download_liferay_and_dependencies() {
wget https://sourceforge.net/projects/lportal/files/Liferay%20Portal/7.3.3%20GA4/liferay-ce-portal-tomcat-7.3.3-ga4-20200701015330959.tar.gz/download -O liferay-ce-portal-tomcat-7.3.3-ga4.tar.gz
tar -xzf liferay-ce-portal-tomcat-7.3.3-ga4.tar.gz
cd /app/build/sw360/liferay-ce-portal-7.3.3-ga4/deploy
wget https://sourceforge.net/projects/lportal/files/Liferay%20Portal/7.3.4%20GA5/liferay-ce-portal-tomcat-7.3.4-ga5-20200811154319029.tar.gz/download -O liferay-ce-portal-tomcat-7.3.4-ga5.tar.gz
tar -xzf liferay-ce-portal-tomcat-7.3.4-ga5.tar.gz
cd /app/build/sw360/liferay-ce-portal-7.3.4-ga5/deploy
wget https://search.maven.org/remotecontent?filepath=commons-codec/commons-codec/1.12/commons-codec-1.12.jar -O commons-codec-1.12.jar
wget https://search.maven.org/remotecontent?filepath=org/apache/commons/commons-collections4/4.4/commons-collections4-4.4.jar -O commons-collections4-4.4.jar
wget https://search.maven.org/remotecontent?filepath=org/apache/commons/commons-csv/1.4/commons-csv-1.4.jar -O commons-csv-1.4.jar
Expand Down
10 changes: 5 additions & 5 deletions scripts/docker-config/install_scripts/entry_point.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
start_sw360() {
/etc/init.d/couchdb restart
/etc/init.d/postgresql restart
cd /app/liferay-ce-portal-7.3.3-ga4/tomcat-9.0.33/bin/
cd /app/liferay-ce-portal-7.3.4-ga5/tomcat-9.0.33/bin/
rm -rf ./indexes/*
./startup.sh
tail_logs
}

stop_sw360() {
/app/liferay-ce-portal-7.3.3-ga4/tomcat-9.0.33/bin/shutdown.sh
tail -f --lines=500 /app/liferay-ce-portal-7.3.3-ga4/tomcat-9.0.33/logs/catalina.out &
/app/liferay-ce-portal-7.3.4-ga5/tomcat-9.0.33/bin/shutdown.sh
tail -f --lines=500 /app/liferay-ce-portal-7.3.4-ga5/tomcat-9.0.33/logs/catalina.out &
sleep 20
pkill -9 -f tail
pkill -9 -f tomcat
cd /app/liferay-ce-portal-7.3.3-ga4/tomcat-9.0.33/webapps/
cd /app/liferay-ce-portal-7.3.4-ga5/tomcat-9.0.33/webapps/
rm -rf *.war
/etc/init.d/couchdb stop
/etc/init.d/postgresql stop
Expand All @@ -42,7 +42,7 @@ stop_sw360() {

tail_logs()
{
tail -f --lines=500 /app/liferay-ce-portal-7.3.3-ga4/tomcat-9.0.33/logs/catalina.out &
tail -f --lines=500 /app/liferay-ce-portal-7.3.4-ga5/tomcat-9.0.33/logs/catalina.out &
read -r user_input
pkill -9 -f tail
}
Expand Down
17 changes: 14 additions & 3 deletions scripts/docker-config/install_scripts/install_configure_couchdb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,21 @@ install_configure_couchdb() {

install_couchdb() {
apt-get install curl -y --no-install-recommends
curl -L https://couchdb.apache.org/repo/bintray-pubkey.asc | apt-key add
echo "deb https://apache.bintray.com/couchdb-deb bionic main" | tee -a /etc/apt/sources.list
curl https://couchdb.apache.org/repo/keys.asc | gpg --dearmor | tee /usr/share/keyrings/couchdb-archive-keyring.gpg >/dev/null 2>&1
source /etc/os-release
echo "deb [signed-by=/usr/share/keyrings/couchdb-archive-keyring.gpg] https://apache.jfrog.io/artifactory/couchdb-deb/ ${VERSION_CODENAME} main" \
| tee /etc/apt/sources.list.d/couchdb.list >/dev/null
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y couchdb=2.1.2~bionic
COUCHDB_PASSWORD=password
echo "couchdb couchdb/mode select standalone
couchdb couchdb/mode seen true
couchdb couchdb/bindaddress string 127.0.0.1
couchdb couchdb/bindaddress seen true
couchdb couchdb/adminpass password ${COUCHDB_PASSWORD}
couchdb couchdb/adminpass seen true
couchdb couchdb/adminpass_again password ${COUCHDB_PASSWORD}
couchdb couchdb/adminpass_again seen true" | debconf-set-selections
DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes couchdb
}

configure_couchdb_db() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,18 @@ init_db_and_user() {
}

configure_postgres() {
sed -i "s/local all postgres peer/local all postgres trust/" /etc/postgresql/10/main/pg_hba.conf
sed -i "s/host all all 127.0.0.1\/32 md5/host all all 0.0.0.0\/0 md5/" /etc/postgresql/10/main/pg_hba.conf
sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/" /etc/postgresql/10/main/postgresql.conf
sed -i "s/local all postgres peer/local all postgres trust/" /etc/postgresql/12/main/pg_hba.conf
sed -i "s/host all all 127.0.0.1\/32 md5/host all all 0.0.0.0\/0 md5/" /etc/postgresql/12/main/pg_hba.conf
sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/" /etc/postgresql/12/main/postgresql.conf
/etc/init.d/postgresql restart
}

install_postgres() {
DEBIAN_FRONTEND=noninteractive apt-get install postgresql-10 -y --no-install-recommends
apt-get install curl -y --no-install-recommends
curl -L https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt focal-pgdg main" | tee -a /etc/apt/sources.list
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install postgresql-12 -y --no-install-recommends
}

install_init_postgres