Docker in name is no longer needed
This commit is contained in:
8
keystone/.gitignore
vendored
Normal file
8
keystone/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
# ---> Vim
|
||||
[._]*.s[a-w][a-z]
|
||||
[._]s[a-w][a-z]
|
||||
*.un~
|
||||
Session.vim
|
||||
.netrwhist
|
||||
*~
|
||||
|
28
keystone/Dockerfile
Normal file
28
keystone/Dockerfile
Normal file
@ -0,0 +1,28 @@
|
||||
# Build keystone. It needs to be run with
|
||||
# --add-host=mariadb:<ip mariadb listens tp>
|
||||
# Wen starting with an initialized db,
|
||||
# run keystone-manage db_sync from this docker first:
|
||||
# $ docker run hpc/keystone --add-host=mariadb:<ip mariadb> "keystone-manage db_sync"
|
||||
|
||||
FROM ubuntu:16.04
|
||||
|
||||
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 5EDB1B62EC4926EA
|
||||
|
||||
RUN set -x \
|
||||
&& echo "deb http://ubuntu-cloud.archive.canonical.com/ubuntu xenial-updates/ocata main" > /etc/apt/sources.list.d/ocata.list \
|
||||
&& apt-get -y update \
|
||||
&& apt-get -y install \
|
||||
&& apt-get -y install keystone python-openstackclient \
|
||||
&& apt-get -y clean
|
||||
|
||||
# set admin token TODO: make this a secret
|
||||
# in volume of met env
|
||||
COPY keystone.conf /etc/keystone/keystone.conf
|
||||
|
||||
RUN mkdir /etc/keystone/fernet-keys
|
||||
|
||||
RUN chown keystone: /etc/keystone/fernet-keys
|
||||
|
||||
COPY bootstrap.sh /etc/bootstrap.sh
|
||||
|
||||
CMD apachectl -DFOREGROUND
|
9
keystone/README.md
Normal file
9
keystone/README.md
Normal file
@ -0,0 +1,9 @@
|
||||
# ubuntu 16.04 openstack ocata keystone
|
||||
|
||||
## How to build the docker image.
|
||||
```
|
||||
docker build . -t hpc/openstack-keystone
|
||||
```
|
||||
|
||||
## Notes
|
||||
This image is designed to be deployed from the [hpc-cloud repo](https://git.webhosting.rug.nl/HPC/hpc-cloud)
|
46
keystone/bootstrap.sh
Executable file
46
keystone/bootstrap.sh
Executable file
@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Create admin-openrc.sh from secrets that are in the environment during bootstrap.
|
||||
cat << EOF > /root/admin-openrc.sh
|
||||
#!/bin/bash
|
||||
export OS_TENANT_NAME=admin
|
||||
export OS_USERNAME=admin
|
||||
export OS_PASSWORD=${OS_PASSWORD}
|
||||
export OS_AUTH_URL=http://${KEYSTONE_HOST}:35357/v3
|
||||
export OS_IDENTITY_API_VERSION=3
|
||||
EOF
|
||||
|
||||
# Create demo-openrc.sh
|
||||
cat << EOF > /root/demo-openrc.sh
|
||||
#!/bin/bash
|
||||
export OS_TENANT_NAME=demo
|
||||
export OS_USERNAME=demo
|
||||
export OS_PASSWORD=${OS_DEMO_PASSWORD}
|
||||
export OS_AUTH_URL=http://${KEYSTONE_HOST}:35357/v3
|
||||
export OS_IDENTITY_API_VERSION=3
|
||||
EOF
|
||||
|
||||
source /root/admin-openrc.sh
|
||||
|
||||
sleep 3
|
||||
|
||||
openstack project create --domain default \
|
||||
--description "Service Project" service
|
||||
|
||||
sleep 3
|
||||
|
||||
openstack project create --domain default \
|
||||
--description "Demo Project" demo
|
||||
|
||||
sleep 3
|
||||
|
||||
openstack user create --domain default \
|
||||
--password "$OS_DEMO_PASSWORD" demo
|
||||
|
||||
sleep 3
|
||||
|
||||
openstack role create user
|
||||
|
||||
sleep 3
|
||||
|
||||
openstack role add --project demo --user demo user
|
12
keystone/keystone.conf
Normal file
12
keystone/keystone.conf
Normal file
@ -0,0 +1,12 @@
|
||||
[DEFAULT]
|
||||
|
||||
verbose = true
|
||||
|
||||
[database]
|
||||
connection = mysql+pymysql://keystone:keystone@mariadb/keystone
|
||||
|
||||
[token]
|
||||
provider = fernet
|
||||
|
||||
[identity]
|
||||
default_domain_id = default
|
17
keystone/keystone.service
Normal file
17
keystone/keystone.service
Normal file
@ -0,0 +1,17 @@
|
||||
[Unit]
|
||||
Description=Openstack Keystone Container
|
||||
After=docker.service
|
||||
Requires=docker.service
|
||||
|
||||
[Service]
|
||||
TimeoutStartSec=0
|
||||
Restart=always
|
||||
ExecStartPre=-/usr/bin/docker rm -f %n
|
||||
ExecStart=/usr/bin/docker run --name %n \
|
||||
--add-host=mariadb:{{ hostvars[groups['databases'][0]]['ansible_default_ipv4']['address'] }} \
|
||||
-p 5000:5000 -p 35357:35357 \
|
||||
-v /srv/keystone/fernet-keys:/etc/keystone/fernet-keys \
|
||||
hpc/keystone
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Reference in New Issue
Block a user