Skip to content

Commit

Permalink
Change EE_OPT_ROOT to EE_ROOT_DIR
Browse files Browse the repository at this point in the history
  • Loading branch information
sagarnasit committed Sep 14, 2018
1 parent ee74260 commit 82ec28d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion features/bootstrap/FeatureContext.php
Expand Up @@ -14,7 +14,7 @@

define( 'EE', true );
define( 'EE_VERSION', trim( file_get_contents( EE_ROOT . '/VERSION' ) ) );
define( 'EE_OPT_ROOT', '/opt/easyengine' );
define( 'EE_ROOT_DIR', '/opt/easyengine' );

require_once EE_ROOT . '/php/bootstrap.php';

Expand Down
12 changes: 6 additions & 6 deletions php/EE/Migration/Containers.php
Expand Up @@ -136,9 +136,9 @@ private static function migrate_global_containers() {
* @throws \Exception
*/
public static function nginxproxy_container_up() {
$EE_OPT_ROOT = EE_OPT_ROOT;
$EE_ROOT_DIR = EE_ROOT_DIR;
$nginx_proxy_image = 'easyengine/nginx-proxy:v' . EE_VERSION;
$ee_proxy_command = "docker run --name ee-nginx-proxy -e LOCAL_USER_ID=`id -u` -e LOCAL_GROUP_ID=`id -g` --restart=always -d -p 80:80 -p 443:443 -v $EE_OPT_ROOT/nginx/certs:/etc/nginx/certs -v $EE_OPT_ROOT/nginx/dhparam:/etc/nginx/dhparam -v $EE_OPT_ROOT/nginx/conf.d:/etc/nginx/conf.d -v $EE_OPT_ROOT/nginx/htpasswd:/etc/nginx/htpasswd -v $EE_OPT_ROOT/nginx/vhost.d:/etc/nginx/vhost.d -v /var/run/docker.sock:/tmp/docker.sock:ro -v $EE_OPT_ROOT:/app/ee4 -v /usr/share/nginx/html $nginx_proxy_image";
$ee_proxy_command = "docker run --name ee-nginx-proxy -e LOCAL_USER_ID=`id -u` -e LOCAL_GROUP_ID=`id -g` --restart=always -d -p 80:80 -p 443:443 -v $EE_ROOT_DIR/nginx/certs:/etc/nginx/certs -v $EE_ROOT_DIR/nginx/dhparam:/etc/nginx/dhparam -v $EE_ROOT_DIR/nginx/conf.d:/etc/nginx/conf.d -v $EE_ROOT_DIR/nginx/htpasswd:/etc/nginx/htpasswd -v $EE_ROOT_DIR/nginx/vhost.d:/etc/nginx/vhost.d -v /var/run/docker.sock:/tmp/docker.sock:ro -v $EE_ROOT_DIR:/app/ee4 -v /usr/share/nginx/html $nginx_proxy_image";

default_launch( 'docker rm -f ee-nginx-proxy', false, true );

Expand All @@ -156,9 +156,9 @@ public static function nginxproxy_container_up() {
* @throws \Exception
*/
public static function nginxproxy_container_down( $existing_nginx_proxy_image ) {
$EE_OPT_ROOT = EE_OPT_ROOT;
$EE_ROOT_DIR = EE_ROOT_DIR;
$nginx_proxy_image = trim( $existing_nginx_proxy_image->stout );
$ee_proxy_command = "docker run --name ee-nginx-proxy -e LOCAL_USER_ID=`id -u` -e LOCAL_GROUP_ID=`id -g` --restart=always -d -p 80:80 -p 443:443 -v $EE_OPT_ROOT/nginx/certs:/etc/nginx/certs -v $EE_OPT_ROOT/nginx/dhparam:/etc/nginx/dhparam -v $EE_OPT_ROOT/nginx/conf.d:/etc/nginx/conf.d -v $EE_OPT_ROOT/nginx/htpasswd:/etc/nginx/htpasswd -v $EE_OPT_ROOT/nginx/vhost.d:/etc/nginx/vhost.d -v /var/run/docker.sock:/tmp/docker.sock:ro -v $EE_OPT_ROOT:/app/ee4 -v /usr/share/nginx/html $nginx_proxy_image";
$ee_proxy_command = "docker run --name ee-nginx-proxy -e LOCAL_USER_ID=`id -u` -e LOCAL_GROUP_ID=`id -g` --restart=always -d -p 80:80 -p 443:443 -v $EE_ROOT_DIR/nginx/certs:/etc/nginx/certs -v $EE_ROOT_DIR/nginx/dhparam:/etc/nginx/dhparam -v $EE_ROOT_DIR/nginx/conf.d:/etc/nginx/conf.d -v $EE_ROOT_DIR/nginx/htpasswd:/etc/nginx/htpasswd -v $EE_ROOT_DIR/nginx/vhost.d:/etc/nginx/vhost.d -v /var/run/docker.sock:/tmp/docker.sock:ro -v $EE_ROOT_DIR:/app/ee4 -v /usr/share/nginx/html $nginx_proxy_image";

default_launch( 'docker rm -f ee-nginx-proxy', false, true );

Expand All @@ -174,7 +174,7 @@ public static function nginxproxy_container_down( $existing_nginx_proxy_image )
*/
public static function cron_container_up() {
$cron_image = 'easyengine/cron:v' . EE_VERSION;
$cron_scheduler_run_command = 'docker run --name ee-cron-scheduler --restart=always -d -v ' . EE_OPT_ROOT . '/cron:/etc/ofelia:ro -v /var/run/docker.sock:/var/run/docker.sock:ro ' . $cron_image;
$cron_scheduler_run_command = 'docker run --name ee-cron-scheduler --restart=always -d -v ' . EE_ROOT_DIR . '/cron:/etc/ofelia:ro -v /var/run/docker.sock:/var/run/docker.sock:ro ' . $cron_image;

default_launch( 'docker rm -f ee-cron-scheduler', false, true );

Expand All @@ -192,7 +192,7 @@ public static function cron_container_up() {
*/
public static function cron_container_down( $existing_cron_image ) {
$cron_image = trim( $existing_cron_image->stdout );
$cron_scheduler_run_command = 'docker run --name ee-cron-scheduler --restart=always -d -v ' . EE_OPT_ROOT . '/cron:/etc/ofelia:ro -v /var/run/docker.sock:/var/run/docker.sock:ro ' . $cron_image;
$cron_scheduler_run_command = 'docker run --name ee-cron-scheduler --restart=always -d -v ' . EE_ROOT_DIR . '/cron:/etc/ofelia:ro -v /var/run/docker.sock:/var/run/docker.sock:ro ' . $cron_image;

default_launch( 'docker rm -f ee-cron-scheduler', false, true );

Expand Down
22 changes: 11 additions & 11 deletions php/EE/Runner.php
Expand Up @@ -52,7 +52,7 @@ private function init_ee() {
$this->ensure_present_in_config( 'locale', 'en_US' );
$this->ensure_present_in_config( 'ee_installer_version', 'stable' );

define( 'DB', EE_OPT_ROOT.'/db/ee.sqlite' );
define( 'DB', EE_ROOT_DIR.'/db/ee.sqlite' );
define( 'LOCALHOST_IP', '127.0.0.1' );
}

Expand Down Expand Up @@ -111,7 +111,7 @@ public function get_global_config_path() {
$config_path = getenv( 'EE_CONFIG_PATH' );
$this->_global_config_path_debug = 'Using global config from EE_CONFIG_PATH env var: ' . $config_path;
} else {
$config_path = EE_OPT_ROOT . '/config/config.yml';
$config_path = EE_ROOT_DIR . '/config/config.yml';
$this->_global_config_path_debug = 'Using default global config: ' . $config_path;
}

Expand Down Expand Up @@ -165,7 +165,7 @@ public function get_packages_dir_path() {
if ( getenv( 'EE_PACKAGES_DIR' ) ) {
$packages_dir = Utils\trailingslashit( getenv( 'EE_PACKAGES_DIR' ) );
} else {
$packages_dir = EE_OPT_ROOT . '/packages';
$packages_dir = EE_ROOT_DIR . '/packages';
}
return $packages_dir;
}
Expand Down Expand Up @@ -473,25 +473,25 @@ public function init_logger() {
EE::set_logger( $logger );

// Create the config directory if not exist for file logger to initialize.
if ( ! is_dir( EE_OPT_ROOT ) ) {
shell_exec('mkdir -p ' . EE_OPT_ROOT);
if ( ! is_dir( EE_ROOT_DIR ) ) {
shell_exec('mkdir -p ' . EE_ROOT_DIR);
}

if ( ! is_writable( EE_OPT_ROOT ) ) {
EE::err( 'Config root: ' . EE_OPT_ROOT . ' is not writable by EasyEngine' );
if ( ! is_writable( EE_ROOT_DIR ) ) {
EE::err( 'Config root: ' . EE_ROOT_DIR . ' is not writable by EasyEngine' );
}

if ( !empty( $this->arguments[0] ) && 'cli' === $this->arguments[0] && ! empty( $this->arguments[1] ) && 'info' === $this->arguments[1] ) {
$file_logging_path = '/dev/null';
}
else {
$file_logging_path = EE_OPT_ROOT . '/logs/ee.log';
$file_logging_path = EE_ROOT_DIR . '/logs/ee.log';
}

$dateFormat = 'd-m-Y H:i:s';
$output = "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n";
$formatter = new \Monolog\Formatter\LineFormatter( $output, $dateFormat, false, true );
$stream = new \Monolog\Handler\StreamHandler( EE_OPT_ROOT . '/logs/ee.log', Logger::DEBUG );
$stream = new \Monolog\Handler\StreamHandler( EE_ROOT_DIR . '/logs/ee.log', Logger::DEBUG );
$stream->setFormatter( $formatter );
$file_logger = new \Monolog\Logger( 'ee' );
$file_logger->pushHandler( $stream );
Expand Down Expand Up @@ -564,7 +564,7 @@ public function init_config() {
* @param $default Default value to use if $var is not set.
*/
public function ensure_present_in_config( $var, $default ) {
$config_file_path = getenv( 'EE_CONFIG_PATH' ) ? getenv( 'EE_CONFIG_PATH' ) : EE_OPT_ROOT . '/config/config.yml';
$config_file_path = getenv( 'EE_CONFIG_PATH' ) ? getenv( 'EE_CONFIG_PATH' ) : EE_ROOT_DIR . '/config/config.yml';
$existing_config = Spyc::YAMLLoad( $config_file_path );
if ( ! isset( $existing_config[$var] ) ) {
$this->config[$var] = $default;
Expand Down Expand Up @@ -610,7 +610,7 @@ private function run_alias_group( $aliases ) {
if ( getenv( 'EE_CONFIG_PATH' ) ) {
$config_path = getenv( 'EE_CONFIG_PATH' );
} else {
$config_path = EE_OPT_ROOT . '/config/config.yml';
$config_path = EE_ROOT_DIR . '/config/config.yml';
}
$config_path = escapeshellarg( $config_path );

Expand Down
2 changes: 1 addition & 1 deletion php/class-ee.php
Expand Up @@ -931,7 +931,7 @@ public static function launch_self( $command, $args = array(), $assoc_args = arr
if ( getenv( 'EE_CONFIG_PATH' ) ) {
$config_path = getenv( 'EE_CONFIG_PATH' );
} else {
$config_path = EE_OPT_ROOT . '/config/config.yml';
$config_path = EE_ROOT_DIR . '/config/config.yml';
}
$config_path = escapeshellarg( $config_path );

Expand Down
2 changes: 1 addition & 1 deletion php/init-ee.php
Expand Up @@ -4,7 +4,7 @@
define( 'EE', true );
define( 'EE_VERSION', trim( file_get_contents( EE_ROOT . '/VERSION' ) ) );
define( 'EE_START_MICROTIME', microtime( true ) );
define( 'EE_OPT_ROOT', '/opt/easyengine' );
define( 'EE_ROOT_DIR', '/opt/easyengine' );
define( 'EE_PROXY_TYPE', 'ee-nginx-proxy' );

if ( file_exists( EE_ROOT . '/vendor/autoload.php' ) ) {
Expand Down

0 comments on commit 82ec28d

Please sign in to comment.