From 318d09234dbecfee27787b9e6d5097d29c7cbd4b Mon Sep 17 00:00:00 2001 From: Kouki Hama Date: Wed, 28 Jul 2021 22:38:03 +0900 Subject: [PATCH 1/2] fix(docker):Update couchdb3.1 ubuntu20.04 liferay7.3.4 postgresql12 Signed-off-by: Kouki Hama --- Dockerfile | 14 +++-- .../etc_sw360/authorization/application.yml | 57 +++++++++++++++++++ .../etc_sw360/couchdb.properties | 4 +- .../download_liferay_and_dependencies.sh | 6 +- .../install_scripts/entry_point.sh | 10 ++-- .../install_configure_couchdb.sh | 17 +++++- .../install_init_postgres_script.sh | 12 ++-- 7 files changed, 97 insertions(+), 23 deletions(-) create mode 100644 scripts/docker-config/etc_sw360/authorization/application.yml diff --git a/Dockerfile b/Dockerfile index 31ded715fa..479c7e9f24 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,7 +26,7 @@ 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/ @@ -34,19 +34,21 @@ 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 diff --git a/scripts/docker-config/etc_sw360/authorization/application.yml b/scripts/docker-config/etc_sw360/authorization/application.yml new file mode 100644 index 0000000000..d510156fa3 --- /dev/null +++ b/scripts/docker-config/etc_sw360/authorization/application.yml @@ -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 diff --git a/scripts/docker-config/etc_sw360/couchdb.properties b/scripts/docker-config/etc_sw360/couchdb.properties index 058bc59652..a2a9927a00 100644 --- a/scripts/docker-config/etc_sw360/couchdb.properties +++ b/scripts/docker-config/etc_sw360/couchdb.properties @@ -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 diff --git a/scripts/docker-config/install_scripts/download_liferay_and_dependencies.sh b/scripts/docker-config/install_scripts/download_liferay_and_dependencies.sh index 65d6d7edd4..48b6107b62 100755 --- a/scripts/docker-config/install_scripts/download_liferay_and_dependencies.sh +++ b/scripts/docker-config/install_scripts/download_liferay_and_dependencies.sh @@ -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 diff --git a/scripts/docker-config/install_scripts/entry_point.sh b/scripts/docker-config/install_scripts/entry_point.sh index a3621416da..315ea6ca74 100755 --- a/scripts/docker-config/install_scripts/entry_point.sh +++ b/scripts/docker-config/install_scripts/entry_point.sh @@ -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 @@ -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 } diff --git a/scripts/docker-config/install_scripts/install_configure_couchdb.sh b/scripts/docker-config/install_scripts/install_configure_couchdb.sh index de20114c7f..7a2590182c 100755 --- a/scripts/docker-config/install_scripts/install_configure_couchdb.sh +++ b/scripts/docker-config/install_scripts/install_configure_couchdb.sh @@ -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() { diff --git a/scripts/docker-config/install_scripts/install_init_postgres_script.sh b/scripts/docker-config/install_scripts/install_init_postgres_script.sh index 237c4250e3..bf4bed14c0 100755 --- a/scripts/docker-config/install_scripts/install_init_postgres_script.sh +++ b/scripts/docker-config/install_scripts/install_init_postgres_script.sh @@ -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 From af443442a7c65e88a30e9df82fe89436f5a2c525 Mon Sep 17 00:00:00 2001 From: Kouki Hama Date: Wed, 28 Jul 2021 23:32:51 +0900 Subject: [PATCH 2/2] fix(script): add password and user in couchdb-lucene.ini Signed-off-by: Kouki Hama --- scripts/docker-config/install_scripts/build_couchdb_lucene.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/docker-config/install_scripts/build_couchdb_lucene.sh b/scripts/docker-config/install_scripts/build_couchdb_lucene.sh index cec5dc0cd8..a8be1f8243 100755 --- a/scripts/docker-config/install_scripts/build_couchdb_lucene.sh +++ b/scripts/docker-config/install_scripts/build_couchdb_lucene.sh @@ -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