diff --git a/fda-authentication-service/Dockerfile b/fda-authentication-service/Dockerfile index f687467497b42f78b264aa986e77ae7fdf47da92..205f73033be7643ad45a55be544abb2d73a48809 100644 --- a/fda-authentication-service/Dockerfile +++ b/fda-authentication-service/Dockerfile @@ -29,8 +29,12 @@ COPY --from=binary /usr/bin/curl /usr/bin/curl USER root COPY ./dbrepo-realm.json /opt/keycloak/data/import/dbrepo-realm.json -COPY ./service-register.sh /app/service-register.sh -COPY ./docker-entrypoint.sh /app/docker-entrypoint.sh + +WORKDIR /app + +COPY ./service-register.sh ./service-register.sh +COPY ./docker-entrypoint.sh ./docker-entrypoint.sh +COPY ./healthcheck.sh ./healthcheck.sh ENV METADATA_USERNAME=root ENV METADATA_PASSWORD=dbrepo @@ -45,4 +49,6 @@ ENV KEYCLOAK_IMPORT=/opt/keycloak/data/import/dbrepo-realm.json ENV KEYCLOAK_ADMIN=keycloak ENV KEYCLOAK_ADMIN_PASSWORD=keycloak +HEALTHCHECK --interval=10s --timeout=5s --retries=12 CMD ["bash", "/app/healthcheck.sh"] + ENTRYPOINT ["bash", "/app/docker-entrypoint.sh"] diff --git a/fda-authentication-service/healthcheck.sh b/fda-authentication-service/healthcheck.sh new file mode 100755 index 0000000000000000000000000000000000000000..e7842c9278cfe22d1f8d6963c79ac2a4f2c5ea3d --- /dev/null +++ b/fda-authentication-service/healthcheck.sh @@ -0,0 +1,5 @@ +#!/bin/bash +HTTP_CODE=$(curl --silent --output /dev/stderr --write-out "%{http_code}" 'http://0.0.0.0:8080/realms/dbrepo') +if test $HTTP_CODE -ne 200; then + exit 1 +fi \ No newline at end of file diff --git a/fda-ui/layouts/default.vue b/fda-ui/layouts/default.vue index 9ba45c2b7351add71e11c935a0e89af64b1ae0d3..5116d0397fb34a6a4150e097496f7a3eac23b0a0 100644 --- a/fda-ui/layouts/default.vue +++ b/fda-ui/layouts/default.vue @@ -123,7 +123,6 @@ <script> import { isDeveloper } from '@/utils' - export default { name: 'DefaultLayout', data () { @@ -250,7 +249,7 @@ export default { } try { this.loadingUser = true - const res = await this.$axios.put('/api/auth', {}, this.config) + const res = await this.$axios.get('/api/auth/realms/dbrepo/protocol/openid-connect/userinfo', this.keycloakConfig) this.$store.commit('SET_USER', res.data) console.debug('user information', this.user) this.$vuetify.theme.dark = this.user.theme_dark @@ -315,7 +314,7 @@ export default { } try { this.loading = true - const res = await this.$axios.get(`/api/container/${this.$route.params.container_id}/database/${this.$route.params.database_id}/access`, this.silentConfig) + const res = await this.$axios.get(`/api/container/${this.$route.params.container_id}/database/${this.$route.params.database_id}/access`, this.config) this.access = res.data this.$store.commit('SET_ACCESS', res.data) console.debug('access', this.access)