diff --git a/dbrepo-authentication-service/Dockerfile b/dbrepo-authentication-service/Dockerfile index 12cc75bde91d0b0c2a9652be3052debe1c18b9c6..21a4e3ac452ccc8d3d126c634896cbcec9a62b03 100644 --- a/dbrepo-authentication-service/Dockerfile +++ b/dbrepo-authentication-service/Dockerfile @@ -46,7 +46,7 @@ ENV KC_DB_USERNAME=${AUTH_USERNAME} ENV KC_DB_PASSWORD=${AUTH_PASSWORD} ENV KC_HOSTNAME_STRICT_HTTPS=false ENV KC_HOSTNAME_PATH=/api/auth -ENV KC_HOSTNAME_ADMIN_URL=http://localhost/api/auth +ENV KC_HOSTNAME_ADMIN_URL=http://localhost/auth ENV KEYCLOAK_IMPORT=/opt/keycloak/data/import/dbrepo-realm.json ENV KEYCLOAK_ADMIN=fda diff --git a/dbrepo-broker-service/Dockerfile b/dbrepo-broker-service/Dockerfile index 2025bab24eeeac6c036dc0fa2dc4f4a11e9f08b4..caef7401ec51119dd66b94c4ae0a3cf184021fed 100644 --- a/dbrepo-broker-service/Dockerfile +++ b/dbrepo-broker-service/Dockerfile @@ -11,4 +11,7 @@ COPY ./pubkey.pem ./pubkey.pem RUN rabbitmq-plugins enable --offline rabbitmq_prometheus rabbitmq_mqtt rabbitmq_auth_backend_oauth2 rabbitmq_auth_mechanism_ssl +EXPOSE 5672 +EXPOSE 15672 + HEALTHCHECK --interval=10s --timeout=5s --retries=12 CMD wget --spider http://localhost:15672/broker/ diff --git a/dbrepo-gateway-service/dbrepo.conf b/dbrepo-gateway-service/dbrepo.conf index c84c22f970eafe6c721cc9896626feaae0b47279..b5f706fced78f9438ef7d9de98f2c321f92bfed2 100644 --- a/dbrepo-gateway-service/dbrepo.conf +++ b/dbrepo-gateway-service/dbrepo.conf @@ -34,16 +34,6 @@ server { listen 80 default_server; server_name _; - location /api/auth { - rewrite /api/auth/(.*) /$1 break; - 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 $scheme; - proxy_pass http://authentication; - proxy_read_timeout 90; - } - location /api/broker { rewrite /api/broker/(.*) /api/$1 break; proxy_set_header Host $host; @@ -91,6 +81,16 @@ server { proxy_read_timeout 90; } + location /api/auth { + rewrite /api/auth/(.*) /$1 break; + 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 $scheme; + proxy_pass http://authentication; + proxy_read_timeout 90; + } + location /retrieve { rewrite /retrieve/(.*) /$1 break; proxy_set_header Host $host; diff --git a/dbrepo-ui/Dockerfile b/dbrepo-ui/Dockerfile index edc21168501d5ff359a273c1964227415a1aaaf0..468f8d5f8cdf3bc41ded69ea3ef5e4408bb9f061 100644 --- a/dbrepo-ui/Dockerfile +++ b/dbrepo-ui/Dockerfile @@ -42,6 +42,8 @@ EXPOSE 9100 ENV BROKER_USERNAME="fda" ENV BROKER_PASSWORD="fda" +ENV BROKER_LOGIN_URL="/broker/" +ENV KEYCLOAK_LOGIN_URL="/api/auth/" ENV SHARED_FILESYSTEM="/tmp" ENV LOGO="/logo.png" ENV SEARCH_USERNAME="admin" diff --git a/dbrepo-ui/config.js b/dbrepo-ui/config.js index 79d165bd32f3952e59a540a83e03b53df0a9a791..1ccca7b563eec4b1a6cf57d9325cb53b30fb229c 100644 --- a/dbrepo-ui/config.js +++ b/dbrepo-ui/config.js @@ -1,19 +1,21 @@ const config = {} -config.title = process.env.TITLE || 'Database Repository' -config.icon = process.env.ICON || '/favicon.ico' -config.brokerUsername = process.env.BROKER_USERNAME || 'fda' -config.brokerPassword = process.env.BROKER_PASSWORD || 'fda' -config.sharedFilesystem = process.env.SHARED_FILESYSTEM || '/tmp' -config.version = process.env.VERSION || 'latest' -config.logo = process.env.LOGO || '/logo.png' -config.tokenMax = process.env.TOKEN_MAX || 5 -config.searchUsername = process.env.SEARCH_USERNAME || 'admin' -config.searchPassword = process.env.SEARCH_PASSWORD || 'admin' -config.clientId = process.env.DBREPO_CLIENT_ID || 'dbrepo-client' -config.clientSecret = process.env.DBREPO_CLIENT_SECRET || 'MUwRc7yfXSJwX8AdRMWaQC3Nep1VjwgG' -config.defaultPublisher = process.env.DEFAULT_PID_PUBLISHER || 'Example University' -config.doiUrl = process.env.DOI_URL || 'https://doi.org' -config.uploadPath = process.env.UPLOAD_PATH || '/tmp/' +config.title = process.env.TITLE || null +config.icon = process.env.ICON || null +config.brokerUsername = process.env.BROKER_USERNAME || null +config.brokerPassword = process.env.BROKER_PASSWORD || null +config.brokerLoginUrl = process.env.BROKER_LOGIN_URL || null +config.keycloakLoginUrl = process.env.KEYCLOAK_LOGIN_URL || null +config.sharedFilesystem = process.env.SHARED_FILESYSTEM || null +config.version = process.env.VERSION || null +config.logo = process.env.LOGO || null +config.tokenMax = process.env.TOKEN_MAX || null +config.searchUsername = process.env.SEARCH_USERNAME || null +config.searchPassword = process.env.SEARCH_PASSWORD || null +config.clientId = process.env.DBREPO_CLIENT_ID || null +config.clientSecret = process.env.DBREPO_CLIENT_SECRET || null +config.defaultPublisher = process.env.DEFAULT_PID_PUBLISHER || null +config.doiUrl = process.env.DOI_URL || null +config.uploadPath = process.env.UPLOAD_PATH || null module.exports = config diff --git a/dbrepo-ui/layouts/default.vue b/dbrepo-ui/layouts/default.vue index 42b68860142796d2b9943507aa0e5cf682bf9887..f8c56d4a3d134d3593ff9b6c93ca87e30a122a32 100644 --- a/dbrepo-ui/layouts/default.vue +++ b/dbrepo-ui/layouts/default.vue @@ -9,12 +9,8 @@ </div> <v-list-item class="mt-2"> <v-list-item-content> - <v-list-item-subtitle> - {{ version }} - </v-list-item-subtitle> - <v-list-item-title class="text-h6"> - Database Repository - </v-list-item-title> + <v-list-item-subtitle v-text="version" /> + <v-list-item-title class="text-h6" v-text="title" /> </v-list-item-content> </v-list-item> <v-list nav> @@ -182,6 +178,9 @@ export default { version () { return this.$config.version }, + title () { + return this.$config.title + }, canListOntologies () { if (!this.roles) { return false @@ -310,6 +309,8 @@ export default { this.$router.push({ path: '/search', query: { q: this.search } }) }, initEnvironment () { + this.$store.commit('SET_TITLE', this.$config.title) + this.$store.commit('SET_ICON', this.$config.icon) this.$store.commit('SET_CLIENT_ID', this.$config.clientId) this.$store.commit('SET_CLIENT_SECRET', this.$config.clientSecret) this.$store.commit('SET_BROKER_USERNAME', this.$config.brokerUsername) @@ -317,6 +318,7 @@ export default { this.$store.commit('SET_SEARCH_USERNAME', this.$config.searchUsername) this.$store.commit('SET_SEARCH_PASSWORD', this.$config.searchPassword) this.$store.commit('SET_UPLOAD_PATH', this.$config.uploadPath) + console.debug('runtime config', this.$config) } } } diff --git a/dbrepo-ui/nuxt.config.js b/dbrepo-ui/nuxt.config.js index 915fef8e63ed0357c3356c5a71d722f7eaade8b8..16fe0e4cc2da1efbd991df6718403674e9f5de12 100644 --- a/dbrepo-ui/nuxt.config.js +++ b/dbrepo-ui/nuxt.config.js @@ -1,6 +1,6 @@ import path from 'path' import colors from 'vuetify/es5/util/colors' -import { icon, clientSecret, title, logo, version, defaultPublisher, doiUrl, clientId, uploadPath, brokerUsername, brokerPassword, searchUsername, searchPassword } from './config' +import { icon, clientSecret, title, logo, version, defaultPublisher, doiUrl, clientId, uploadPath, brokerUsername, brokerPassword, searchUsername, searchPassword, brokerLoginUrl, keycloakLoginUrl } from './config' const proxy = {} @@ -98,6 +98,7 @@ export default { proxy, publicRuntimeConfig: { + title, version, logo, clientId, @@ -105,6 +106,8 @@ export default { defaultPublisher, brokerUsername, brokerPassword, + brokerLoginUrl, + keycloakLoginUrl, searchUsername, searchPassword, doiUrl, diff --git a/dbrepo-ui/pages/login.vue b/dbrepo-ui/pages/login.vue index 95c25af89843f5e31ef859634167f92cf440abf3..4ffb24e8e72363cb563a02d83745a175b48612c0 100644 --- a/dbrepo-ui/pages/login.vue +++ b/dbrepo-ui/pages/login.vue @@ -51,11 +51,19 @@ Login </v-btn> </v-card-actions> - <v-card-text class="text-right"> - <a href="/api/auth/">Admin Login</a> - </v-card-text> </v-card> </v-form> + <v-toolbar v-if="!token" flat> + <v-spacer /> + <v-toolbar-title> + <v-btn v-if="rabbitMqUrl" color="orange" plain :href="rabbitMqUrl"> + <v-icon left>mdi-rabbit</v-icon> RabbitMQ + </v-btn> + <v-btn v-if="keycloakUrl" color="secondary" plain :href="keycloakUrl"> + <v-icon left>mdi-key</v-icon> Keycloak + </v-btn> + </v-toolbar-title> + </v-toolbar> </div> </template> @@ -82,6 +90,12 @@ export default { }, user () { return this.$store.state.user + }, + keycloakUrl () { + return this.$config.keycloakLoginUrl + }, + rabbitMqUrl () { + return this.$config.brokerLoginUrl } }, mounted () { diff --git a/dbrepo-ui/static/favicon_alt.ico b/dbrepo-ui/static/favicon_alt.ico new file mode 100644 index 0000000000000000000000000000000000000000..f8f591a5acbf4973a3626032997b322386ed2217 Binary files /dev/null and b/dbrepo-ui/static/favicon_alt.ico differ diff --git a/dbrepo-ui/static/favicon_alt.png b/dbrepo-ui/static/favicon_alt.png new file mode 100644 index 0000000000000000000000000000000000000000..32cfe969126f93df5632cbfb72a14845b840a3c7 Binary files /dev/null and b/dbrepo-ui/static/favicon_alt.png differ diff --git a/dbrepo-ui/store/index.js b/dbrepo-ui/store/index.js index 8fad6b2d54e2a4ec328b1e15268b8d6b80176e18..7cfa08e424fd0b42dc0b7b00d6202c923616e8a2 100644 --- a/dbrepo-ui/store/index.js +++ b/dbrepo-ui/store/index.js @@ -11,6 +11,8 @@ Vue.use(Vuex) // https://github.com/hua1995116/webchat/blob/7c6544d3defd41cb7cf68306accea97800858bc3/client/src/store/index.js#L293 const store = new Store({ state: { + title: null, + icon: null, token: null, refreshToken: null, roles: [], @@ -30,6 +32,8 @@ const store = new Store({ uploadPath: null }, getters: { + getTitle: state => state.title, + getIcon: state => state.icon, getToken: state => state.token, getRefreshToken: state => state.refreshToken, getRoles: state => state.roles, @@ -49,6 +53,12 @@ const store = new Store({ getUploadPath: state => state.uploadPath }, mutations: { + SET_TITLE (state, title) { + state.title = title + }, + SET_ICON (state, icon) { + state.icon = icon + }, SET_TOKEN (state, token) { state.token = token }, diff --git a/install.sh b/install.sh new file mode 100644 index 0000000000000000000000000000000000000000..627a55974e8db2ca4808936f54a9f54b49564824 --- /dev/null +++ b/install.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +if [ `whoami` -neq "root" ]; then + echo "This script needs sudo privileges!" + exit 1 +fi + +docker info > /dev/null +if [ $? -ne 0 ]; then + echo "Docker is not installed (or accessible in bash) on your system:" + echo "" + echo " - install docker from https://docs.docker.com/desktop/install/linux-install/" + echo " - make sure the docker executable is in \$PATH" + exit 2 +fi + +echo "Gathering environment ..." +curl -sSL -o .env https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/raw/dev/.env.unix.example +curl -sSL -o docker-compose.yml https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/raw/dev/docker-compose.prod.yml +curl -sSL -o dbrepo.conf https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/raw/master/dbrepo.conf +curl -sSL -o setup-schema_local.sql https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/raw/dev/dbrepo-metadata-db/setup-schema_local.sql + +echo "Pulling images ..." +docker compose pull + +MAX_MAP_COUNT=$(cat /proc/sys/vm/max_map_count) +if [ "$MAX_MAP_COUNT" -lt 262144 ]; then + echo "Preparing environment ..." + echo "vm.max_map_count=262144" >> /etc/sysctl.conf + sysctl -p +fi + +echo "Starting DBRepo ..." +docker compose up -d + +if [ $? -eq 0 ]; then + echo "Successfully started. You can now inspect the logs with:" + echo "" + echo "docker compose logs -f" +fi \ No newline at end of file