Add Dockerfile and docker-compose.yml to run searchlight
in docker containers Change-Id: I2144d6925ecb13762707120213f50f36a26d9c59
This commit is contained in:
parent
79745f2636
commit
7038886a8b
|
@ -0,0 +1,30 @@
|
|||
FROM ubuntu:18.04
|
||||
MAINTAINER saphi070@gmail.com
|
||||
|
||||
RUN apt update
|
||||
RUN apt install -y python-dev libssl-dev python-pip libxml2-dev \
|
||||
libxslt-dev git git-review libffi-dev gettext \
|
||||
python-tox python-memcache crudini
|
||||
|
||||
### Clone searchlight source code
|
||||
RUN apt install wget -y
|
||||
WORKDIR /home
|
||||
RUN git clone https://git.openstack.org/openstack/searchlight
|
||||
WORKDIR /home/searchlight
|
||||
|
||||
### Install Searchlight
|
||||
RUN pip install -r requirements.txt
|
||||
RUN pip install -r elasticsearch5.txt
|
||||
RUN python setup.py install
|
||||
RUN oslo-config-generator --config-file etc/oslo-config-generator/searchlight.conf
|
||||
RUN cp etc/searchlight.conf.sample /etc/searchlight/searchlight.conf
|
||||
RUN mkdir /etc/searchlight/
|
||||
|
||||
### Copy Configure files
|
||||
RUN cp etc/api-paste.ini /etc/searchlight/
|
||||
# COPY searchlight.conf /etc/searchlight/
|
||||
COPY entrypoint.sh /home/
|
||||
RUN chmod 775 /home/entrypoint.sh
|
||||
EXPOSE 9393
|
||||
WORKDIR /home
|
||||
ENTRYPOINT ["./entrypoint.sh"]
|
|
@ -0,0 +1,76 @@
|
|||
Running Searchlight in containers
|
||||
=================================
|
||||
|
||||
This contrib includes Dockerfile, docker-compose file and some configurations to run
|
||||
Searchlight in Docker containers.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Follow guides in [1], [2] to install docker and docker-compose
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
- Build docker image
|
||||
|
||||
::
|
||||
|
||||
docker-compose -f docker-compose.example.yml build
|
||||
|
||||
- Adjust the authentication variables in your `docker-compose.example.yml`.
|
||||
|
||||
Example
|
||||
|
||||
::
|
||||
|
||||
version: "3"
|
||||
services:
|
||||
searchlight-api:
|
||||
build: .
|
||||
ports:
|
||||
- 9393:9393
|
||||
environment:
|
||||
PROCESS: api
|
||||
AUTH_URL: http://192.168.53.31:5000/v3
|
||||
TRANSPORT_URL: rabbitmq://openstack:openstack@192.168.53.31
|
||||
SEARCHLIGHT_PASS: openstack
|
||||
ELASTICSEARCH_HOST: elasticsearch:9200
|
||||
|
||||
searchlight-listener:
|
||||
build: .
|
||||
environment:
|
||||
PROCESS: listener
|
||||
AUTH_URL: http://192.168.53.31:5000/v3
|
||||
TRANSPORT_URL: rabbitmq://openstack:openstack@192.168.53.31
|
||||
SEARCHLIGHT_PASS: openstack
|
||||
ELASTICSEARCH_HOST: elasticsearch:9200
|
||||
|
||||
elasticsearch:
|
||||
image: elasticsearch:5.6
|
||||
|
||||
|
||||
- Running
|
||||
|
||||
::
|
||||
|
||||
docker-compose -f docker-compose.example.yml up -
|
||||
|
||||
Environment Variables
|
||||
---------------------
|
||||
|
||||
- TRANSPORT_URL: RabbitMQ URL. Example: rabbitmq://openstack:openstack@192.168.53.31
|
||||
- REGION_NAME: Openstack Region Name. Example: RegionOne
|
||||
- AUTH_URL: Keystone Auth URL. Example: http://192.168.53.31:5000
|
||||
- SEARCHLIGHT_USER: Username of searchlight. Example: searchlight
|
||||
- SEARCHLIGHT_PASS: Password of searchlight. Example: openstack
|
||||
- PROJECT_NAME: Name of project for searchlight. Example: service
|
||||
- DOMAIN_NAME: Name of domain for searchlight user and project: Example: default
|
||||
- ELASTICSEARCH_HOST: Host and port of Elasticsearch. Example: 192.168.53.31:9200
|
||||
|
||||
|
||||
References
|
||||
----------
|
||||
|
||||
- [1] Install docker on Ubuntu: https://docs.docker.com/install/linux/docker-ce/ubuntu/
|
||||
- [2] Install docker-compose: https://docs.docker.com/compose/install/
|
|
@ -0,0 +1,24 @@
|
|||
version: "3"
|
||||
services:
|
||||
searchlight-api:
|
||||
build: .
|
||||
ports:
|
||||
- 9393:9393
|
||||
environment:
|
||||
PROCESS: api
|
||||
AUTH_URL: http://192.168.53.31:5000/v3
|
||||
TRANSPORT_URL: rabbitmq://openstack:openstack@192.168.53.31
|
||||
SEARCHLIGHT_PASS: openstack
|
||||
ELASTICSEARCH_HOST: elasticsearch:9200
|
||||
|
||||
searchlight-listener:
|
||||
build: .
|
||||
environment:
|
||||
PROCESS: listener
|
||||
AUTH_URL: http://192.168.53.31:5000/v3
|
||||
TRANSPORT_URL: rabbitmq://openstack:openstack@192.168.53.31
|
||||
SEARCHLIGHT_PASS: openstack
|
||||
ELASTICSEARCH_HOST: elasticsearch:9200
|
||||
|
||||
elasticsearch:
|
||||
image: elasticsearch:5.6
|
|
@ -0,0 +1,52 @@
|
|||
#!/bin/bash
|
||||
echo "Configure Searhclight"
|
||||
|
||||
searchlight_conf=/etc/searchlight/searchlight.conf
|
||||
|
||||
DOMAIN_NAME=${DOMAIN_NAME:-default}
|
||||
PROJECT_NAME=${PROJECT_NAME:-service}
|
||||
SEARCHLIGHT_USER=${SEARCHLIGHT_USER:-searchlight}
|
||||
SEARCHLIGHT_PASS=${SEARCHLIGHT_PASS:-openstack}
|
||||
|
||||
|
||||
crudini --set $searchlight_conf DEFAULT transport_url $TRANSPORT_URL
|
||||
|
||||
crudini --set $searchlight_conf service_credentials os_region_name $REGION_NAME
|
||||
crudini --set $searchlight_conf service_credentials auth_url $AUTH_URL
|
||||
crudini --set $searchlight_conf service_credentials username $SEARCHLIGHT_USER
|
||||
crudini --set $searchlight_conf service_credentials password $SEARCHLIGHT_PASS
|
||||
crudini --set $searchlight_conf service_credentials project_name $PROJECT_NAME
|
||||
crudini --set $searchlight_conf service_credentials user_domain_name $DOMAIN_NAME
|
||||
crudini --set $searchlight_conf service_credentials project_domain_name $DOMAIN_NAME
|
||||
|
||||
crudini --set $searchlight_conf keystone_authtoken auth_url $AUTH_URL
|
||||
crudini --set $searchlight_conf keystone_authtoken auth_type password
|
||||
crudini --set $searchlight_conf keystone_authtoken project_domain_name $DOMAIN_NAME
|
||||
crudini --set $searchlight_conf keystone_authtoken user_domain_name $DOMAIN_NAME
|
||||
crudini --set $searchlight_conf keystone_authtoken project_name $PROJECT_NAME
|
||||
crudini --set $searchlight_conf keystone_authtoken username $SEARCHLIGHT_USER
|
||||
crudini --set $searchlight_conf keystone_authtoken password $SEARCHLIGHT_PASS
|
||||
|
||||
crudini --set $searchlight_conf elasticsearch hosts $ELASTICSEARCH_HOST
|
||||
|
||||
|
||||
if [ ! -f /opt/searchlight-synced ];then
|
||||
echo "Sync index to elasticsearch"
|
||||
while true;
|
||||
do
|
||||
curl -s $ELASTICSEARCH_HOST > /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Starting sync index to elasticsearch"
|
||||
searchlight-manage index sync --force
|
||||
break
|
||||
fi
|
||||
done
|
||||
touch /opt/searchlight-synced
|
||||
fi
|
||||
|
||||
echo "Starting searchlight"
|
||||
|
||||
if [ ! -d /var/log/searchlight ]; then
|
||||
mkdir /var/log/searchlight
|
||||
fi
|
||||
searchlight-$PROCESS --log-file=/var/log/searchlight/searchlight-$PROCESS --config-file $searchlight_conf
|
|
@ -0,0 +1,70 @@
|
|||
[DEFAULT]
|
||||
verbose = true
|
||||
transport_url = rabbit://openstack:openstack@rabbitmq
|
||||
|
||||
[service_credentials]
|
||||
os_region_name = RegionOne
|
||||
auth_url = https://keystone:35357
|
||||
password = openstack
|
||||
project_name = service
|
||||
user_domain_name = Default
|
||||
project_domain_name = Default
|
||||
username = searchlight
|
||||
auth_type = password
|
||||
|
||||
[paste_deploy]
|
||||
flavor = keystone
|
||||
|
||||
[keystone_authtoken]
|
||||
auth_version = 3
|
||||
auth_url = https://keystone:5000
|
||||
auth_type = password
|
||||
project_domain_name = default
|
||||
user_domain_name = default
|
||||
project_name = service
|
||||
username = searchlight
|
||||
password = openstack
|
||||
|
||||
[elasticsearch]
|
||||
index_settings = number_of_shards:1,number_of_replicas:0
|
||||
hosts = elasticsearch:9200
|
||||
|
||||
[service_credentials:nova]
|
||||
compute_api_version = 2.1
|
||||
|
||||
[resource_plugin:os_nova_server]
|
||||
enabled = True
|
||||
|
||||
[resource_plugin:os_nova_hypervisor]
|
||||
enabled = True
|
||||
|
||||
[resource_plugin:os_nova_flavor]
|
||||
notifications_topics_exchanges = versioned_notifications,nova
|
||||
enabled = True
|
||||
|
||||
[resource_plugin:os_nova_servergroup]
|
||||
enabled = True
|
||||
|
||||
[resource_plugin:os_glance_image]
|
||||
enabled = True
|
||||
|
||||
[resource_plugin:os_glance_metadef]
|
||||
enabled = True
|
||||
|
||||
[resource_plugin:os_searchlight_volume]
|
||||
enabled = True
|
||||
|
||||
[resource_plugin:os_searchlight_snapshot]
|
||||
enabled = True
|
||||
|
||||
[resource_plugin:os_neutron_net]
|
||||
enabled = True
|
||||
|
||||
[resource_plugin:os_neutron_port]
|
||||
enabled = True
|
||||
|
||||
[resource_plugin:os_neutron_floatingip]
|
||||
enabled = True
|
||||
|
||||
[resource_plugin:os_neutron_security_group]
|
||||
enabled = True
|
Loading…
Reference in New Issue