Giter VIP home page Giter VIP logo

keystone-docker's Introduction

Keystone Docker

Docker Hub

This repo is used to host a bunldle to create a docker container (based on Python 2.7.12) running Keystone.

Keystone is an OpenStack service that provides API client authentication, service discovery, and distributed multi-tenant authorization by implementing OpenStack’s Identity API.

What can this docker image do ?

  • Running Keystone with http (default) or https (by passing -e TLS_ENABLED=true, see more in Environment Variables Explanations) enabled;
  • Uses the Apache Web Server with mod_wsgi to serve Identity service requests on port 5000 and 35357;
  • Supports remote mysql database;
  • Utilizes Memcached to store tokens, reducing the burden of MySQL database;
  • Customizes/Builds your own Keystone docker image by editing the value of KEYSTONE_VERSION in Dockerfile;

How to get the image ?

  • just pull it from Dockerhub

    $ docker pull stephenhsu/keystone
  • Build your own Keystone version using Dockerfile

    You can find more Keystone release version.

    $ git clone https://github.com/dixudx/keystone-docker
    $ cd keystone-docker
    $ # edit the value of KEYSTONE_VERSION to your favorite Keystone
    $ # release version
    $ vim Dockerfile
    $ docker build -t keystone:your_version ./

    WARNING: Pay attention to the dependencies. You may need to specify dependency versions explicitly.

How to run the container

Quick Start

Just run

$ docker run -d -p 5000:5000 -p 35357:35357 --name my_keystone stephenhsu/keystone

Now you can access http://localhost:5000 and http://localhost:35357.

Login into Keystone container

After the container is up,

$ docker exec -it my_keystone bash
$ # Inside the container
root@26bd2b8a8a60 /root # source openrc
root@26bd2b8a8a60 /root # openstack user list
+----------------------------------+-------+
| ID                               | Name  |
+----------------------------------+-------+
| 609170cf45f64de68c4815c1f6e337b2 | admin |
+----------------------------------+-------+

Note: You can also copy the /root/openrc to your other servers. After replacing OS_AUTH_URL to the corresponding url, you can access the keystone service from other servers after sourcing it.

Environment Variables Explanations

Environment Variables Default Value Editable when starting a container Description
KEYSTONE_VERSION 9.1.0 False. Built in Dockerfile unless rebuilding the image. The release version of Keystone.You can find more at https://github.com/openstack/keystone/tags.
KEYSTONE_ADMIN_PASSWORD passw0rd True The Keystone admin user password;
KEYSTONE_DB_ROOT_PASSWD passw0rd False. Built in Dockerfile unless rebuilding the image. Keystone MySQL (default localhost) database root user password;
KEYSTONE_DB_PASSWD passw0rd True Keystone MySQL (default localhost) database keystone user password;
TLS_ENABLED false True Whether to enable tls/https;
KEYSTONE_DB_HOST True MySQL remote database host; Combined with KEYSTONE_DB_ROOT_PASSWD_IF_REMOTED
KEYSTONE_DB_ROOT_PASSWD_IF_REMOTED True MySQL remote database root user password; Combined with KEYSTONE_DB_HOST

CSR (Certificate Signing Request) Environment Variables

If you've enabled TLS_ENABLED (with -e TLS_ENABLED=true), below environment variables have to be noticed. You can just ignore them if you don't want to make any further customizations.

Environment Name Default Value Meaning Example
CONUTRY NULL Country GB
STATE NULL State London
LOCALITY NULL Location London
ORG NULL Organization Global Security
ORG_UNIT NULL Organizational Unit IT Department
CN The Hostname Common Name example.com

Note: Be aware of CN (the default value is $hostname). You'd better not change it to other value.

Example 1: Running with TLS enabled

$ docker run -d -p 5000:5000 -p 35357:35357 -e TLS_ENABLED=true \
    -h mykeystone.com --name my_keystone_tls stephenhsu/keystone

Example 2: Running with remote MySQL database

$ docker run -d -p 5000:5000 -p 35357:35357 -e KEYSTONE_DB_HOST=192.168.100.202 \
    -e KEYSTONE_DB_ROOT_PASSWD_IF_REMOTED=your_password \
    -h mykeystone.com --name my_keystone_db stephenhsu/keystone

Example 3: Accessing the Apache Certificate File

$ mkdir -p ./apache/
$ docker run -d -p 5000:5000 -p 35357:35357 -v `pwd`/apache/:/etc/apache2 \
    -h mykeystone.com --name my_keystone_ca stephenhsu/keystone

Example 4: Customize your Keystone configuration

$ git clone https://github.com/dixudx/keystone-docker.git
$ cd keystone-docker
# then modify all related configurations in folder ./etc
# especially ./etc/keystone.conf
$ docker run -d -p 5000:5000 -p 35357:35357 -v `pwd`/etc/:/etc/keystone/ \
    -h mykeystone.com --name my_keystone_ca stephenhsu/keystone

You can copy /root/openrc in your container to your host server, and replace OS_CACERT to this $pwd/apache/ssl/apache.crt (replace $pwd with your real directory path). So that you access the keystone services using openstack python client ( pip install python-openstackclient ) from outer of the the container.

Note: On your host server, you may also need to add mykeystone.com to /etc/hosts.

Reference

keystone-docker's People

Contributors

dixudx avatar professordegraw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

keystone-docker's Issues

MySQL does not start with overlay2 on docker for OSX

On docker for OSX sometimes there is a problem with the SQL server failing to start.
I look like it is because the OverlayFS only implements a subset of the POSIX standards.

A workaround is to touch the mysql files before starting mysql

find /var/lib/mysql -type f -exec touch {} ; && service mysql start

docker/for-linux#72

# cat /var/log/mysql/error.log
[ERROR] Fatal error: Can't open and lock privilege tables: Got error 140 from storage engine

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.