aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/docker/backend
diff options
context:
space:
mode:
authoreschcam <cameron.scholes@est.tech>2022-12-14 11:34:25 +0000
committerVasyl Razinkov <vasyl.razinkov@est.tech>2022-12-15 17:45:55 +0000
commitd07e109271bacc8363458d4cd04397afec79596e (patch)
treec8a67f70580c1aba921aed6394c5846d6997d23a /catalog-be/src/main/docker/backend
parent5f55d127357f0aa9d985343ee4dd431f6a3aa207 (diff)
Add link to Swagger UI in Readme & Redirect root
Turns out the default URL of http://localhost:8080/ only loads the index.html and not the other assets. Going to http://localhost:8080/swagger-ui/index.html loads everything correctly Also added a redirect for the root URL to the correct address for the Swagger UI Issue-ID: SDC-4292 Signed-off-by: eschcam <cameron.scholes@est.tech> Change-Id: Ibca5956d1d2f5e18ba41e623329b199c8e9db9a5
Diffstat (limited to 'catalog-be/src/main/docker/backend')
-rw-r--r--catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_jetty_Modules.rb12
-rw-r--r--catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-jetty-rewrite.yaml.erb20
-rw-r--r--catalog-be/src/main/docker/backend/startup.sh3
3 files changed, 32 insertions, 3 deletions
diff --git a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_jetty_Modules.rb b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_jetty_Modules.rb
index 9e57212176..5655d0fd6f 100644
--- a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_jetty_Modules.rb
+++ b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_jetty_Modules.rb
@@ -6,7 +6,7 @@ else
end
execute "create-jetty-modules" do
- command "java -jar #{ENV['JETTY_HOME']}/start.jar --add-to-start=deploy && java -jar #{ENV['JETTY_HOME']}/start.jar --create-startd --add-to-start=http,https,setuid"
+ command "java -jar #{ENV['JETTY_HOME']}/start.jar --add-to-start=deploy && java -jar #{ENV['JETTY_HOME']}/start.jar --create-startd --add-to-start=http,https,setuid,rewrite"
cwd "#{ENV['JETTY_BASE']}"
action :run
end
@@ -21,7 +21,15 @@ template "http-ini" do
:http_option => http_option ,
:http_port => "#{node['BE'][:http_port]}"
})
-
+
+end
+
+template "jetty-rewrite" do
+ path "#{ENV['JETTY_BASE']}/etc/rewrite-root-to-swagger-ui.xml"
+ source "BE-jetty-rewrite.yaml.erb"
+ owner "#{ENV['JETTY_USER']}"
+ group "#{ENV['JETTY_GROUP']}"
+ mode "0644"
end
diff --git a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-jetty-rewrite.yaml.erb b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-jetty-rewrite.yaml.erb
new file mode 100644
index 0000000000..ea0e9aa57c
--- /dev/null
+++ b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-jetty-rewrite.yaml.erb
@@ -0,0 +1,20 @@
+<?xml version="1.0"?><!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
+<Configure id="Server" class="org.eclipse.jetty.server.Server">
+ <Ref refid="Rewrite">
+ <Call name="addRule">
+ <Arg>
+ <New class="org.eclipse.jetty.rewrite.handler.RedirectPatternRule">
+ <Set name="pattern" type="String"/>
+ <Set name="location">/swagger-ui/index.html</Set>
+ </New>
+ </Arg>
+ </Call>
+ </Ref>
+
+ <!-- ===================== -->
+ <!-- DefaultHandler config -->
+ <!-- ===================== -->
+ <Ref id="DefaultHandler">
+ <Set name="showContexts">false</Set>
+ </Ref>
+</Configure>
diff --git a/catalog-be/src/main/docker/backend/startup.sh b/catalog-be/src/main/docker/backend/startup.sh
index c64e4ac200..0f778a315e 100644
--- a/catalog-be/src/main/docker/backend/startup.sh
+++ b/catalog-be/src/main/docker/backend/startup.sh
@@ -8,7 +8,7 @@ export JAVA_OPTIONS="$JAVA_OPTIONS -Dconfig.home=$JETTY_BASE/config \
-Dartifactgenerator.config=$JETTY_BASE/config/catalog-be/Artifact-Generator.properties \
-Donboarding_configuration.yaml=$JETTY_BASE/config/onboarding-be/onboarding_configuration.yaml \
-Djavax.net.ssl.trustStore=$JETTY_BASE/etc/org.onap.sdc.trust.jks \
- -Djavax.net.ssl.trustStorePassword=z+KEj;t+,KN^iimSiS89e#p0"
+ -Djavax.net.ssl.trustStorePassword=z+KEj;t+,KN^iimSiS89e#p0"
cd $JETTY_BASE/chef-solo
chef-solo -c solo.rb -E ${ENVNAME}
@@ -16,5 +16,6 @@ chef-solo -c solo.rb -E ${ENVNAME}
# Execute Jetty
cd $JETTY_HOME
echo "jetty.httpConfig.sendServerVersion=false" >> $JETTY_HOME/start.d/start.ini
+echo "$JETTY_BASE/etc/rewrite-root-to-swagger-ui.xml" >> $JETTY_HOME/start.d/rewrite.ini
java $JAVA_OPTIONS -jar "$JETTY_HOME/start.jar"