Merge pull request #10 from radiorabe/feature/config-rewrite-airtime-saas-folder
Rewrite config from /etc/airtime-saas to plain /etc/airtime
This commit is contained in:
commit
01a954481c
|
@ -114,7 +114,7 @@ define("SUBDOMAIN_WHMCS_CUSTOM_FIELD_NAME", "Choose your domain");
|
||||||
define('LIBRETIME_ENABLE_LIVECHAT', false);
|
define('LIBRETIME_ENABLE_LIVECHAT', false);
|
||||||
|
|
||||||
//Sentry error logging
|
//Sentry error logging
|
||||||
define('SENTRY_CONFIG_PATH', '/etc/airtime-saas/sentry.airtime_web.ini');
|
define('SENTRY_CONFIG_PATH', LIBRETIME_CONF_DIR . '/sentry.airtime_web.ini');
|
||||||
|
|
||||||
//Provisioning status
|
//Provisioning status
|
||||||
define('PROVISIONING_STATUS_SUSPENDED' , 'Suspended');
|
define('PROVISIONING_STATUS_SUSPENDED' , 'Suspended');
|
||||||
|
|
|
@ -81,16 +81,18 @@ class Application_Model_RabbitMq
|
||||||
public static function getRmqConfigPath() {
|
public static function getRmqConfigPath() {
|
||||||
//Hack for Airtime Pro. The RabbitMQ settings for communicating with airtime_analyzer are global
|
//Hack for Airtime Pro. The RabbitMQ settings for communicating with airtime_analyzer are global
|
||||||
//and shared between all instances on Airtime Pro.
|
//and shared between all instances on Airtime Pro.
|
||||||
|
//
|
||||||
|
// todo: rewrite me to only use the config class and not access /etc/airtime directly
|
||||||
$CC_CONFIG = Config::getConfig();
|
$CC_CONFIG = Config::getConfig();
|
||||||
$devEnv = "production"; //Default
|
$devEnv = "production"; //Default
|
||||||
if (array_key_exists("dev_env", $CC_CONFIG)) {
|
if (array_key_exists("dev_env", $CC_CONFIG)) {
|
||||||
$devEnv = $CC_CONFIG["dev_env"];
|
$devEnv = $CC_CONFIG["dev_env"];
|
||||||
}
|
}
|
||||||
$rmq_config_path = "/etc/airtime-saas/".$devEnv."/rabbitmq-analyzer.ini";
|
$rmq_config_path = LIBRETIME_CONF_DIR . '/' . $devEnv."/rabbitmq-analyzer.ini";
|
||||||
if (!file_exists($rmq_config_path)) {
|
if (!file_exists($rmq_config_path)) {
|
||||||
// If the dev env specific rabbitmq-analyzer.ini doesn't exist default
|
// If the dev env specific rabbitmq-analyzer.ini doesn't exist default
|
||||||
// to the production rabbitmq-analyzer.ini
|
// to the production rabbitmq-analyzer.ini
|
||||||
$rmq_config_path = "/etc/airtime-saas/production/rabbitmq-analyzer.ini";
|
$rmq_config_path = LIBRETIME_CONF_PATH . "/production/rabbitmq-analyzer.ini";
|
||||||
}
|
}
|
||||||
return $rmq_config_path;
|
return $rmq_config_path;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,7 @@ require_once(dirname(dirname( __DIR__)) . "/application/models/airtime/CcMusicDi
|
||||||
class MediaSetup extends Setup {
|
class MediaSetup extends Setup {
|
||||||
|
|
||||||
const MEDIA_FOLDER = "mediaFolder";
|
const MEDIA_FOLDER = "mediaFolder";
|
||||||
const AIRTIME_CONF_PATH = "/etc/airtime/airtime.conf";
|
const LIBRETIME_CONF_FILE_NAME = "airtime.conf";
|
||||||
const RMQ_INI_BASE_PATH = "/etc/airtime-saas/";
|
|
||||||
const RMQ_INI_FILE_NAME = "rabbitmq-analyzer.ini";
|
const RMQ_INI_FILE_NAME = "rabbitmq-analyzer.ini";
|
||||||
|
|
||||||
static $path;
|
static $path;
|
||||||
|
@ -77,8 +76,11 @@ class MediaSetup extends Setup {
|
||||||
* airtime.conf to airtime.conf.tmp during the setup process. Now that we're done,
|
* airtime.conf to airtime.conf.tmp during the setup process. Now that we're done,
|
||||||
* we can rename it to airtime.conf.bak to avoid confusion.
|
* we can rename it to airtime.conf.bak to avoid confusion.
|
||||||
*/
|
*/
|
||||||
if (file_exists(self::AIRTIME_CONF_PATH . ".tmp")) {
|
$fileName = LIBRETIME_CONF_DIR . '/' . self::LIBRETIME_CONF_FILE_NAME;
|
||||||
rename(self::AIRTIME_CONF_PATH . ".tmp", self::AIRTIME_CONF_PATH . ".bak");
|
$tmpFile = $fileName . '.tmp';
|
||||||
|
$bakFile = $fileName . '.bak';
|
||||||
|
if (file_exists($tmpFile)) {
|
||||||
|
rename($tmpFile, $bakFile);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self::$message = "Failed to move airtime.conf; /etc/airtime doesn't exist!";
|
self::$message = "Failed to move airtime.conf; /etc/airtime doesn't exist!";
|
||||||
|
@ -96,7 +98,7 @@ class MediaSetup extends Setup {
|
||||||
* @return boolean false if either of the copy or removal operations fail
|
* @return boolean false if either of the copy or removal operations fail
|
||||||
*/
|
*/
|
||||||
function moveAirtimeConfig() {
|
function moveAirtimeConfig() {
|
||||||
return copy(AIRTIME_CONF_TEMP_PATH, self::AIRTIME_CONF_PATH)
|
return copy(AIRTIME_CONF_TEMP_PATH, LIBRETIME_CONF_DIR . '/' . self::LIBRETIME_CONF_FILE_NAME)
|
||||||
&& unlink(AIRTIME_CONF_TEMP_PATH);
|
&& unlink(AIRTIME_CONF_TEMP_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,8 +107,8 @@ class MediaSetup extends Setup {
|
||||||
* @return boolean false if either of the copy or removal operations fail
|
* @return boolean false if either of the copy or removal operations fail
|
||||||
*/
|
*/
|
||||||
function moveRmqConfig() {
|
function moveRmqConfig() {
|
||||||
return copy(RMQ_INI_TEMP_PATH, self::RMQ_INI_BASE_PATH . self::RMQ_INI_FILE_NAME)
|
return copy(RMQ_INI_TEMP_PATH, LIBRETIME_CONF_DIR . '/' . self::RMQ_INI_FILE_NAME)
|
||||||
&& copy(RMQ_INI_TEMP_PATH, self::RMQ_INI_BASE_PATH . "production/" . self::RMQ_INI_FILE_NAME)
|
&& copy(RMQ_INI_TEMP_PATH, LIBRETIME_CONF_DIR . '/production/' . self::RMQ_INI_FILE_NAME)
|
||||||
&& unlink(RMQ_INI_TEMP_PATH);
|
&& unlink(RMQ_INI_TEMP_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ Developers
|
||||||
To debug, you can run celery directly from the command line:
|
To debug, you can run celery directly from the command line:
|
||||||
|
|
||||||
$ cd /my/airtime/root/python_apps/airtime-celery
|
$ cd /my/airtime/root/python_apps/airtime-celery
|
||||||
$ RMQ_CONFIG_FILE=/etc/airtime/airtime.conf celery -A airtime-celery.tasks worker --loglevel=info
|
$ RMQ_CONFIG_FILE=${LIBRETIME_CONF_DIR}/airtime.conf celery -A airtime-celery.tasks worker --loglevel=info
|
||||||
|
|
||||||
This worker can be run alongside the service without issue.
|
This worker can be run alongside the service without issue.
|
||||||
|
|
||||||
|
@ -57,8 +57,8 @@ If you run into issues getting Celery to accept tasks from Airtime:
|
||||||
|
|
||||||
2) Check the log file (/var/log/airtime/airtime-celery[-DEV_ENV].log) to make sure Celery started correctly.
|
2) Check the log file (/var/log/airtime/airtime-celery[-DEV_ENV].log) to make sure Celery started correctly.
|
||||||
|
|
||||||
3) Check your /etc/airtime/airtime.conf rabbitmq settings. Make sure the settings here align with
|
3) Check your $LIBRETIME_CONF_DIR/airtime.conf rabbitmq settings. Make sure the settings here align with
|
||||||
/etc/airtime-saas/production/rabbitmq.ini.
|
$LIBRETIME_CONF_DIR/$ENVIRONMENT/rabbitmq.ini.
|
||||||
|
|
||||||
4) Check RabbitMQ to make sure the celeryresults and task queues were created in the correct vhost.
|
4) Check RabbitMQ to make sure the celeryresults and task queues were created in the correct vhost.
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ from boto.s3.key import Key
|
||||||
# https://github.com/docker/docker-registry/issues/400
|
# https://github.com/docker/docker-registry/issues/400
|
||||||
u'fix getaddrinfo deadlock'.encode('idna')
|
u'fix getaddrinfo deadlock'.encode('idna')
|
||||||
|
|
||||||
CLOUD_CONFIG_PATH = '/etc/airtime-saas/cloud_storage.conf'
|
CLOUD_CONFIG_PATH = os.path.join(os.getenv('LIBRETIME_CONF_DIR', '/etc/airtime'), 'cloud_storage.conf')
|
||||||
STORAGE_BACKEND_FILE = "file"
|
STORAGE_BACKEND_FILE = "file"
|
||||||
SOCKET_TIMEOUT = 240
|
SOCKET_TIMEOUT = 240
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ from libcloud.storage.providers import get_driver
|
||||||
from libcloud.storage.types import Provider, ContainerDoesNotExistError, ObjectDoesNotExistError
|
from libcloud.storage.types import Provider, ContainerDoesNotExistError, ObjectDoesNotExistError
|
||||||
|
|
||||||
|
|
||||||
CLOUD_CONFIG_PATH = '/etc/airtime-saas/cloud_storage.conf'
|
CLOUD_CONFIG_PATH = os.path.join(os.getenv('LIBRETIME_CONF_DIR', '/etc/airtime'), 'cloud_storage.conf')
|
||||||
STORAGE_BACKEND_FILE = "file"
|
STORAGE_BACKEND_FILE = "file"
|
||||||
|
|
||||||
class CloudStorageUploader:
|
class CloudStorageUploader:
|
||||||
|
|
|
@ -8,8 +8,9 @@ import os
|
||||||
import airtime_analyzer.airtime_analyzer as aa
|
import airtime_analyzer.airtime_analyzer as aa
|
||||||
|
|
||||||
VERSION = "1.0"
|
VERSION = "1.0"
|
||||||
DEFAULT_RMQ_CONFIG_PATH = '/etc/airtime/airtime.conf'
|
LIBRETIME_CONF_DIR = os.getenv('LIBRETIME_CONF_DIR', '/etc/airtime')
|
||||||
DEFAULT_CLOUD_STORAGE_CONFIG_PATH = '/etc/airtime-saas/production/cloud_storage.conf'
|
DEFAULT_RMQ_CONFIG_PATH = os.path.join(LIBRETIME_CONF_DIR, 'airtime.conf')
|
||||||
|
DEFAULT_CLOUD_STORAGE_CONFIG_PATH = os.path.join(LIBRETIME_CONF_DIR, os.getenv('ENVIRONMENT', 'production'), 'airtime.conf')
|
||||||
DEFAULT_HTTP_RETRY_PATH = '/tmp/airtime_analyzer_http_retries'
|
DEFAULT_HTTP_RETRY_PATH = '/tmp/airtime_analyzer_http_retries'
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
|
|
|
@ -22,7 +22,7 @@ def teardown():
|
||||||
def test_basic():
|
def test_basic():
|
||||||
filename = os.path.basename(DEFAULT_AUDIO_FILE)
|
filename = os.path.basename(DEFAULT_AUDIO_FILE)
|
||||||
q = Queue.Queue()
|
q = Queue.Queue()
|
||||||
#cloud_storage_config_path = '/etc/airtime-saas/production/cloud_storage.conf'
|
#cloud_storage_config_path = os.path.join(os.getenv('LIBRETIME_CONF_DIR', '/etc/airtime'), '/production/cloud_storage.conf')
|
||||||
#cloud_storage_config = config_file.read_config_file(cloud_storage_config_path)
|
#cloud_storage_config = config_file.read_config_file(cloud_storage_config_path)
|
||||||
cloud_storage_config = SafeConfigParser()
|
cloud_storage_config = SafeConfigParser()
|
||||||
cloud_storage_config.add_section("current_backend")
|
cloud_storage_config.add_section("current_backend")
|
||||||
|
|
Loading…
Reference in New Issue