aboutsummaryrefslogtreecommitdiffstats
path: root/moonv4/templates/docker
diff options
context:
space:
mode:
authorasteroide <thomas.duval@orange.com>2017-05-17 10:09:16 +0200
committerasteroide <thomas.duval@orange.com>2017-05-17 10:09:16 +0200
commit725e85c2b8515126845cdbf8ece1f32e612a7687 (patch)
treeeb5d8aec88a98654372d35c19890ec2152ae06c5 /moonv4/templates/docker
parent934a83a28818f3f5f51d1666e22af075ce3b096a (diff)
Add CORS to Keystone
Change-Id: Ie705bf519d880fa3a20ce61ca75f501f2fa93a62
Diffstat (limited to 'moonv4/templates/docker')
-rw-r--r--moonv4/templates/docker/keystone/Dockerfile3
-rw-r--r--moonv4/templates/docker/keystone/run.sh10
2 files changed, 12 insertions, 1 deletions
diff --git a/moonv4/templates/docker/keystone/Dockerfile b/moonv4/templates/docker/keystone/Dockerfile
index b8ba8212..a0be0fa2 100644
--- a/moonv4/templates/docker/keystone/Dockerfile
+++ b/moonv4/templates/docker/keystone/Dockerfile
@@ -3,7 +3,7 @@ FROM ubuntu:latest
ENV ADMIN_TOKEN=p4ssw0rd
ENV ADMIN_PASSWORD=p4ssw0rd
-ENV DB_CONNECTION=mysql+pymysql
+ENV DB_CONNECTION="mysql+pymysql"
ENV DB_DRIVER=sql
ENV DB_HOST=localhost
ENV DB_DATABASE=keystonedb
@@ -12,6 +12,7 @@ ENV DB_PASSWORD=p4ssw0rd
ENV DB_USER_ROOT=root
ENV DB_PASSWORD_ROOT=p4sswOrd1
ENV RABBIT_NODE=server
+ENV INTERFACE_HOST="http://localhost:3001"
RUN apt-get update && apt-get install apache2 rabbitmq-server keystone python-openstackclient libapache2-mod-wsgi mysql-client -y
diff --git a/moonv4/templates/docker/keystone/run.sh b/moonv4/templates/docker/keystone/run.sh
index 7c9a1a43..1442807b 100644
--- a/moonv4/templates/docker/keystone/run.sh
+++ b/moonv4/templates/docker/keystone/run.sh
@@ -6,11 +6,21 @@ echo DB_HOST=$DB_HOST
echo DB_DATABASE=$DB_DATABASE
echo RABBIT_NODE=$RABBIT_NODE
echo RABBIT_NODE=$[RABBIT_NODE]
+echo INTERFACE_HOST=$INTERFACE_HOST
sed "s/#admin_token = <None>/admin_token=$ADMIN_TOKEN/g" -i /etc/keystone/keystone.conf
sed "s/connection = sqlite:\/\/\/\/var\/lib\/keystone\/keystone.db/connection = $DB_CONNECTION:\/\/$DB_USER:$DB_PASSWORD@$DB_HOST\/$DB_DATABASE/g" -i /etc/keystone/keystone.conf
sed "s/#driver = sql/driver = $DB_DRIVER/g" -i /etc/keystone/keystone.conf
+cat << EOF | tee -a /etc/keystone/keystone.conf
+[cors]
+allowed_origin = $INTERFACE_HOST
+max_age = 3600
+allow_methods = GET,POST,PUT,DELETE
+allow_headers = Content-Type,Cache-Control,Content-Language,Expires,Last-Modified,Pragma,X-Custom-Header
+expose_headers = Content-Type,Cache-Control,Content-Language,Expires,Last-Modified,Pragma,X-Custom-Header
+EOF
+
mysql -h $DB_HOST -u$DB_USER_ROOT -p$DB_PASSWORD_ROOT <<EOF
CREATE DATABASE $DB_DATABASE DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON $DB_DATABASE.* TO '$DB_USER'@'%' IDENTIFIED BY '$DB_PASSWORD';