
docker/build/compass is for building compass docker image, which should be triggered automatically by CI(or other periodic jobs). under docker/build/scripts there is a sample start that can be included in Dockerfile(uncomment CMD["/root/sample_start"] when testing this image build. Change-Id: I05dbbde67bd82803971cf3f90a8dbea6d57b0776
57 lines
1.6 KiB
Bash
57 lines
1.6 KiB
Bash
#!/bin/bash
|
|
|
|
# set python home
|
|
# sed -i "s|\$PythonHome|\/root\/\.virtualenvs\/compass-core|g" /opt/compass/bin/switch_virtualenv.py
|
|
|
|
# add apache to root user group
|
|
# usermod -a -G `groups root|awk '{print$3}'` apache
|
|
|
|
# activate virtualenv
|
|
source `which virtualenvwrapper.sh`
|
|
workon compass-core
|
|
|
|
## mysql
|
|
# install db
|
|
# grant permission to mysql data dir
|
|
# /usr/bin/mysql_install_db
|
|
# chown mysql:mysql /var/lib/mysql
|
|
# chown mysql:mysql /var/lib/mysql/*
|
|
# chown mysql:mysql /var/lib/mysql/mysql/*
|
|
# chown mysql:mysql /var/lib/mysql/performance_schema/*
|
|
|
|
# start mysqld service, push it to bg
|
|
/usr/bin/mysqld_safe > /dev/null 2>&1 &
|
|
|
|
RET=1
|
|
while [[ RET -ne 0 ]]; do
|
|
echo "waiting for mariadb to startup"
|
|
sleep 5
|
|
mysql -uroot -e "status" > /dev/null 2>&1
|
|
RET=$?
|
|
done
|
|
|
|
echo "mariadb started"
|
|
|
|
# set mysql with default username and password
|
|
mysqladmin -h127.0.0.1 --port=3306 -u root password root
|
|
|
|
# create db 'compass'
|
|
mysql -h127.0.0.1 --port=3306 -uroot -proot -e "create database compass"
|
|
|
|
## virtualenv
|
|
# create virtualenv
|
|
# source `which virtualenvwrapper.sh`
|
|
# mkvirtualenv --system-site-packages compass-core
|
|
|
|
# install compass requirements
|
|
|
|
# start compass services
|
|
/opt/compass/bin/manage_db.py createdb
|
|
/usr/sbin/apachectl -k start
|
|
/usr/sbin/rabbitmq-server &
|
|
/usr/bin/redis-server &
|
|
ln -s /root/.virtualenvs/compass-core/bin/celery /opt/compass/bin/celery
|
|
CELERY_CONFIG_MODULE=compass.utils.celeryconfig_wrapper C_FORCE_ROOT=1 /opt/compass/bin/celery worker &> /tmp/celery-worker.log &
|
|
/opt/compass/bin/progress_update.py &> /tmp/progress_update.log &
|
|
tail -f /dev/null
|