Skip to content

Commit

Permalink
Update IdP setup process to run on a container
Browse files Browse the repository at this point in the history
  • Loading branch information
nadundesilva committed Jun 12, 2019
1 parent 74c02bb commit 2ad2d48
Show file tree
Hide file tree
Showing 15 changed files with 69 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ hs_err_pid*
deployment/mysql/mnt
deployment/docker-registry/mnt
deployment/docker-auth/extension-logs
docker/identity-server/files/idp-variables.sh
docker/deployment-init/files/idp-variables.sh

coverage.txt
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ docker:
docker build -t $(DOCKER_REPO)/cellery-hub-api:$(VERSION) -f ./docker/api/Dockerfile .
docker build -t $(DOCKER_REPO)/cellery-hub-portal:$(VERSION) -f ./docker/portal/Dockerfile .
mvn clean install -f docker/identity-server/pom.xml
docker build -t $(DOCKER_REPO)/cellery-hub-deployment-init:$(VERSION) -f ./docker/deployment-init/Dockerfile .

.PHONY: docker-push
docker-push: docker
Expand All @@ -81,6 +82,7 @@ docker-push: docker
docker push $(DOCKER_REPO)/cellery-hub-api:$(VERSION)
docker push $(DOCKER_REPO)/cellery-hub-portal:$(VERSION)
docker push $(DOCKER_REPO)/cellery-hub-idp:$(VERSION)
docker push $(DOCKER_REPO)/cellery-hub-deployment-init:$(VERSION)

.PHONY: deploy
deploy:
Expand All @@ -89,8 +91,6 @@ deploy:
mkdir -p deployment/docker-auth/extension-logs
cd deployment; \
docker-compose up -d
cd docker/identity-server/files; \
bash setup-is.sh

.PHONY: undeploy
undeploy:
Expand Down
5 changes: 5 additions & 0 deletions deployment/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,8 @@ services:
- ./mysql/mnt:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=root
deployment-init:
image: wso2cellery/cellery-hub-deployment-init:latest
restart: "no"
environment:
- CELLERY_HUB_IDP_URL=https://idp.hub.cellery.io:9443
30 changes: 30 additions & 0 deletions docker/deployment-init/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# ------------------------------------------------------------------------
#
# Copyright 2019 WSO2, Inc. (http://wso2.com)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
#
# ------------------------------------------------------------------------

FROM ubuntu:bionic
LABEL MAINTAINER="WSO2 Cellery Maintainers <[email protected]>"

COPY ./docker/deployment-init/files/ ./

RUN apt-get -y update;\
apt-get -y upgrade;\
apt-get -y install curl

ENV TERM=xterm-256color

ENTRYPOINT ["bash", "setup-is.sh"]
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
<xsd:displayOrder>0</xsd:displayOrder>
<xsd:name>callbackUrl</xsd:name>
<xsd:required>false</xsd:required>
<xsd:value>{CELLERY_HUB_FEDERATED_CALLBACL_URL}</xsd:value>
<xsd:value>{CELLERY_HUB_FEDERATED_CALLBACK_URL}</xsd:value>
</xsd:properties>
</xsd:federatedAuthenticatorConfigs>
<xsd:justInTimeProvisioningConfig>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<xsd:displayOrder>0</xsd:displayOrder>
<xsd:name>callbackUrl</xsd:name>
<xsd:required>false</xsd:required>
<xsd:value>{CELLERY_HUB_FEDERATED_CALLBACL_URL}</xsd:value>
<xsd:value>{CELLERY_HUB_FEDERATED_CALLBACK_URL}</xsd:value>
</xsd:properties>
</xsd:federatedAuthenticatorConfigs>
<xsd:justInTimeProvisioningConfig>
Expand Down
12 changes: 12 additions & 0 deletions docker/deployment-init/files/idp-variables.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

export CELLERY_HUB_IDP_URL=${CELLERY_HUB_IDP_URL:-https://localhost:9443}
export CELLERY_HUB_GOOGLE_CLIENT_ID=${CELLERY_HUB_GOOGLE_CLIENT_ID:-fillMe}
export CELLERY_HUB_GOOGLE_CLIENT_SECRET=${CELLERY_HUB_GOOGLE_CLIENT_SECRET:-fillMe}
export CELLERY_HUB_GITHUB_CLIENT_ID=${CELLERY_HUB_GITHUB_CLIENT_ID:-fillMe}
export CELLERY_HUB_GITHUB_CLIENT_SECRET=${CELLERY_HUB_GITHUB_CLIENT_SECRET:-fillMe}
export CELLERY_HUB_CLI_CALL_BACK_URL=regexp=http://localhost:[0-9]+/\(.*\)
export CELLERY_HUB_WEB_PORTAL_CALLBACK=regexp=https://hub.cellery.io:9000/\(.*\)
export CELLERY_HUB_FEDERATED_CALLBACK_URL=https://idp.hub.cellery.io:9443/commonauth
export CELLERY_HUB_IDP_ADMIN_USERNAME=admin
export CELLERY_HUB_IDP_ADMIN_PASSWORD=admin
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
#!/usr/bin/env bash
# ------------------------------------------------------------------------
#
# Copyright 2019 WSO2, Inc. (http://wso2.com)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
#
# ------------------------------------------------------------------------

source idp-variables.sh

echo
echo "Waiting for IdP to start"
while [[ true ]];
do
Expand Down
12 changes: 0 additions & 12 deletions docker/identity-server/files/idp-variables.sh

This file was deleted.

0 comments on commit 2ad2d48

Please sign in to comment.