Skip to content

Commit

Permalink
Merge pull request #50 from RADAR-base/release-1.3.0
Browse files Browse the repository at this point in the history
Release 1.3.0
  • Loading branch information
nivemaham authored Jun 3, 2020
2 parents 470677c + 81764fa commit d1e0350
Show file tree
Hide file tree
Showing 64 changed files with 3,112 additions and 2,153 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ out
.gradle
.git
authorizer-app/*
docker/
RADAR-Rest-Source-Auth.iml
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ FROM openjdk:8-jre-alpine

# Add the war and changelogs files from build stage
COPY --from=builder app/build/libs/*.jar /app.jar
COPY --from=builder app/src/main/docker/ /app-includes

EXPOSE 8080
CMD echo "The application will start in ${APP_SLEEP}s..." && \
Expand Down
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ To run this application from source:
./gradlew build assemble
java -jar radar-rest-sources-authorizer*.jar
```

To build and run this application from Docker:
```$cmd
docker build -t radarbase/radar-rest-source-auth-backend:1.0.1 .
docker run -p 8080:8080 radarbase/radar-rest-source-auth-backend:latest
## Installation
To install functional RADAR-base Rest-Sources Authorizer application with minimal dependencies from source, please use the `docker-compose.yml` under the root directory
1. Copy the `docker/etc/rest-sources-authorizer/rest_source_clients_configs.yml.template` into `docker/etc/rest-sources-authorizer/rest_source_clients_configs.yml` and modify the `client_id` and `client_secret` with your Fitbit client application credentials.
```bash
docker-compose up -d --build
```

## Validation
Expand All @@ -55,6 +53,10 @@ Add the `REST_SOURCE_AUTHORIZER_VALIDATOR` env var to your docker-compose servic

#### First Create a new oAuth client in Management Portal
To add new OAuth clients, you can add at runtime through the UI on Management Portal, or you can add them to the OAuth clients file referenced by the MANAGEMENTPORTAL_OAUTH_CLIENTS_FILE configuration option. For more info, see [officail docs](https://github.com/RADAR-base/ManagementPortal#oauth-clients)
The OAuth client should have the following properties-

1. scope - `PROJECT.READ, SUBJECT.READ`
2. grant_type - `client_credentials`

#### Then add the following to your rest authoriser service
Add the following env vars to your docker-compose service-
Expand Down
1 change: 1 addition & 0 deletions authorizer-app/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
/e2e
dist/
11 changes: 8 additions & 3 deletions authorizer-app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
FROM node:8.12.0-alpine as builder
FROM node:10.16.3-alpine as builder

ARG BASE_HREF="/rest-sources/authorizer/"
ARG BASE_HREF="BASE_HREF"
ARG PROFILE="--prod"

RUN mkdir /app
WORKDIR /app

COPY package*.json /app/
Expand All @@ -13,7 +14,7 @@ COPY ./ /app/
RUN $(npm bin)/ng build ${PROFILE} --base-href=${BASE_HREF}


FROM nginx:1.15.5-alpine
FROM nginx:1.17.3-alpine

# add init script
COPY ./docker/nginx.conf /etc/nginx/nginx.conf
Expand All @@ -22,5 +23,9 @@ WORKDIR /usr/share/nginx/html

COPY --from=builder /app/dist/authorizer-app/ .

COPY ./docker/entrypoint.sh /entrypoint.sh
# expose internal port:80 and run init.sh
EXPOSE 80

ENTRYPOINT ["/entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]
22 changes: 22 additions & 0 deletions authorizer-app/docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

ROOT_DIR=/usr/share/nginx/html
# Replace env vars in JavaScript files
echo "Replacing env vars in JS"
# So far, the main.*.js is the only file where the app is compiled into
for file in $ROOT_DIR/main.*.js* $ROOT_DIR/index.html
do
echo "Processing $file ...";

sed -i 's|/\?BASE_HREF|'${BASE_HREF}'|g' $ROOT_DIR/index.html
sed -i 's|BACKEND_BASE_URL|'${BACKEND_BASE_URL}'|g' $file
sed -i 's|VALIDATE|'${VALIDATE}'|g' $file
sed -i 's|AUTH_GRANT_TYPE|'${AUTH_GRANT_TYPE}'|g' $file
sed -i 's|AUTH_CLIENT_ID|'${AUTH_CLIENT_ID}'|g' $file
sed -i 's|AUTH_CLIENT_SECRET|'${AUTH_CLIENT_SECRET}'|g' $file
sed -i 's|AUTH_CALLBACK_URL|'${AUTH_CALLBACK_URL}'|g' $file
sed -i 's|AUTH_URI|'${AUTH_URI}'|g' $file
done

echo "Static files ready"
exec "$@"
Loading

0 comments on commit d1e0350

Please sign in to comment.