Docker in name is no longer needed
This commit is contained in:
8
heat/.gitignore
vendored
Normal file
8
heat/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
# ---> Vim
|
||||
[._]*.s[a-w][a-z]
|
||||
[._]s[a-w][a-z]
|
||||
*.un~
|
||||
Session.vim
|
||||
.netrwhist
|
||||
*~
|
||||
|
34
heat/Dockerfile
Normal file
34
heat/Dockerfile
Normal file
@ -0,0 +1,34 @@
|
||||
FROM ubuntu:16.04
|
||||
# install packages
|
||||
|
||||
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 ubuntu-cloud-keyring \
|
||||
&& apt-get -y update \
|
||||
&& apt-get -y install \
|
||||
mysql-client \
|
||||
python-mysqldb \
|
||||
python-openstackclient \
|
||||
python-oslo.cache \
|
||||
heat-api \
|
||||
heat-api-cfn \
|
||||
heat-engine \
|
||||
&& apt-get -y clean
|
||||
|
||||
EXPOSE 8000
|
||||
EXPOSE 8004
|
||||
|
||||
#file that writes configs
|
||||
COPY write_conf.sh /etc/write_conf.sh
|
||||
# add bootstrap script and make it executable
|
||||
COPY bootstrap.sh /etc/bootstrap.sh
|
||||
|
||||
COPY run.sh /etc/run.sh
|
||||
|
||||
RUN chown root.root /etc/bootstrap.sh && chmod a+x /etc/bootstrap.sh
|
||||
RUN chown root.root /etc/run.sh && chmod a+x /etc/run.sh
|
||||
|
||||
CMD ["/etc/run.sh"]
|
8
heat/README.md
Normal file
8
heat/README.md
Normal file
@ -0,0 +1,8 @@
|
||||
# Openstack heat
|
||||
This docker image provides [Openstack Heat](https://wiki.openstack.org/wiki/Heat). It is meant to be run as part of the [HPC Cloud](https://git.webhosting.rug.nl/HPC/hpc-cloud).
|
||||
|
||||
## How to build
|
||||
```
|
||||
docker build . -t hpc/openstack-heat
|
||||
|
||||
```
|
13
heat/admin-openrc.sh
Normal file
13
heat/admin-openrc.sh
Normal file
@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
# To create the Identity service credentials
|
||||
export OS_IDENTITY_API_VERSION=3
|
||||
export OS_USERNAME=admin
|
||||
export OS_PASSWORD=geheim
|
||||
export OS_TENANT_NAME=admin
|
||||
export OS_AUTH_URL=http://${KEYSTONE_HOST}:35357/v3
|
||||
|
||||
export OS_PROJECT_DOMAIN_NAME=default
|
||||
export OS_USER_DOMAIN_NAME=default
|
||||
export OS_PROJECT_NAME=admin
|
||||
export OS_IMAGE_API_VERSION=2
|
57
heat/bootstrap.sh
Executable file
57
heat/bootstrap.sh
Executable file
@ -0,0 +1,57 @@
|
||||
#!/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
|
||||
|
||||
export HEAT_USER=heat
|
||||
export HEAT_PASSWORD=${HEAT_PASSWORD}
|
||||
export OS_PROJECT_DOMAIN_NAME=default
|
||||
export OS_USER_DOMAIN_NAME=default
|
||||
export OS_PROJECT_NAME=admin
|
||||
export OS_IMAGE_API_VERSION=2
|
||||
EOF
|
||||
|
||||
source /root/admin-openrc.sh
|
||||
|
||||
# Write the config files
|
||||
/etc/write_conf.sh
|
||||
|
||||
# create database for heat
|
||||
mysql -uroot -p"$MYSQL_ROOT_PASSWORD" -h "$MYSQL_HOST" << EOF
|
||||
drop database if exists heat;
|
||||
create database heat;
|
||||
GRANT ALL PRIVILEGES ON heat.* TO 'heat'@'localhost' IDENTIFIED BY "$HEAT_PASSWORD";
|
||||
GRANT ALL PRIVILEGES ON heat.* TO 'heat'@'%' IDENTIFIED BY "$HEAT_PASSWORD";
|
||||
EOF
|
||||
|
||||
openstack user create "$HEAT_USER" --domain Default --password "$HEAT_PASSWORD"
|
||||
openstack role add --project service --user heat admin
|
||||
|
||||
openstack service create --name heat --description "Orchestration" orchestration
|
||||
openstack service create --name heat-cfn --description "Orchestration" cloudformation
|
||||
|
||||
openstack endpoint create orchestration public http://"${HEAT_HOST}":8004/v1/%\(tenant_id\)s --region RegionOne
|
||||
openstack endpoint create orchestration internal http://"${HEAT_HOST}":8004/v1/%\(tenant_id\)s --region RegionOne
|
||||
openstack endpoint create orchestration admin http://"${HEAT_HOST}":8004/v1/%\(tenant_id\)s --region RegionOne
|
||||
|
||||
openstack endpoint create cloudformation public http://"${HEAT_HOST}":8000/v1 --region RegionOne
|
||||
openstack endpoint create cloudformation internal http://"${HEAT_HOST}":8000/v1 --region RegionOne
|
||||
openstack endpoint create cloudformation admin http://"${HEAT_HOST}":8000/v1 --region RegionOne
|
||||
|
||||
openstack domain create --description "Stack projects and users" heat
|
||||
|
||||
openstack user create --domain heat --password "$HEAT_PASSWORD" heat_domain_admin
|
||||
openstack role add --domain heat --user-domain heat --user heat_domain_admin admin
|
||||
|
||||
openstack role create heat_stack_owner
|
||||
openstack role add --project demo --user demo heat_stack_owner
|
||||
openstack role create heat_stack_user
|
||||
|
||||
# sync the database
|
||||
su -s /bin/sh -c "heat-manage db_sync" heat
|
15
heat/run.sh
Executable file
15
heat/run.sh
Executable file
@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Write the config files
|
||||
/etc/write_conf.sh
|
||||
|
||||
heat-api -v -d &
|
||||
sleep 5
|
||||
heat-api-cfn -v -d &
|
||||
sleep 5
|
||||
heat-engine -v -d &
|
||||
# If any process fails, kill the rest.
|
||||
# This insures the container stops and systemd will restart it.
|
||||
|
||||
wait -n
|
||||
pkill -P $$
|
35
heat/write_conf.sh
Executable file
35
heat/write_conf.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Generate config files from environments values.
|
||||
# These are to be passed to the docker container using -e
|
||||
|
||||
cat << EOF > /etc/heat/heat.conf
|
||||
|
||||
[database]
|
||||
connection = mysql+pymysql://heat:$HEAT_PASSWORD@$MYSQL_HOST/heat
|
||||
|
||||
[DEFAULT]
|
||||
transport_url = rabbit://$RABBIT_USER:$RABBIT_PASSWORD@$RABBIT_HOST
|
||||
heat_metadata_server_url = http://$HEAT_HOST:8000
|
||||
heat_waitcondition_server_url = http://$HEAT_HOST:8000/v1/waitcondition
|
||||
|
||||
|
||||
[keystone_authtoken]
|
||||
auth_uri = http://$KEYSTONE_HOST:5000
|
||||
auth_url = http://$KEYSTONE_HOST:35357
|
||||
memcached_servers = $MEMCACHED_HOST:11211
|
||||
auth_type = password
|
||||
project_domain_name = Default
|
||||
user_domain_name = Default
|
||||
project_name = service
|
||||
username = $HEAT_USER
|
||||
password = $HEAT_PASSWORD
|
||||
|
||||
[trustee]
|
||||
auth_plugin = password
|
||||
auth_url = http://$KEYSTONE_HOST:35357
|
||||
username = $HEAT_USER
|
||||
password = $HEAT_PASSWORD
|
||||
user_domain_name = Default
|
||||
|
||||
EOF
|
Reference in New Issue
Block a user