Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 0 additions & 65 deletions src/helper/site-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,71 +100,6 @@ function get_site_info( $args, $site_enabled_check = true, $exit_if_not_found =
return $site_data;
}


/**
* Function to check all the required configurations needed to create the site.
*
* Boots up the container if it is stopped or not running.
*/
function init_checks() {

$proxy_type = EE_PROXY_TYPE;
if ( 'running' !== EE::docker()::container_status( $proxy_type ) ) {
/**
* Checking ports.
*/
$port_80_status = \EE\Utils\get_curl_info( 'localhost', 80, true );
$port_443_status = \EE\Utils\get_curl_info( 'localhost', 443, true );

// if any/both the port/s is/are occupied.
if ( ! ( $port_80_status && $port_443_status ) ) {
EE::error( 'Cannot create/start proxy container. Please make sure port 80 and 443 are free.' );
} else {

$fs = new Filesystem();

if ( ! $fs->exists( EE_CONF_ROOT . '/docker-compose.yml' ) ) {
generate_global_docker_compose_yml( $fs );
}

$EE_CONF_ROOT = EE_CONF_ROOT;
if ( ! EE::docker()::docker_network_exists( GLOBAL_BACKEND_NETWORK ) ) {
if ( ! EE::docker()::create_network( GLOBAL_BACKEND_NETWORK ) ) {
EE::error( 'Unable to create network ' . GLOBAL_BACKEND_NETWORK );
}
}
if ( ! EE::docker()::docker_network_exists( GLOBAL_FRONTEND_NETWORK ) ) {
if ( ! EE::docker()::create_network( GLOBAL_FRONTEND_NETWORK ) ) {
EE::error( 'Unable to create network ' . GLOBAL_FRONTEND_NETWORK );
}
}
if ( EE::docker()::docker_compose_up( EE_CONF_ROOT, [ 'nginx-proxy' ] ) ) {
$fs->dumpFile( "$EE_CONF_ROOT/nginx/conf.d/custom.conf", file_get_contents( EE_ROOT . '/templates/custom.conf.mustache' ) );
EE::success( "$proxy_type container is up." );
} else {
EE::error( "There was some error in starting $proxy_type container. Please check logs." );
}
}
}
}

/**
* Function to start global db if it is not running.
*/
function init_global_db() {

if ( ! EE::docker()::docker_network_exists( GLOBAL_BACKEND_NETWORK ) ) {
if ( ! EE::docker()::create_network( GLOBAL_BACKEND_NETWORK ) ) {
EE::error( 'Unable to create network ' . GLOBAL_BACKEND_NETWORK );
}
}

if ( 'running' !== EE::docker()::container_status( GLOBAL_DB ) ) {
chdir( EE_CONF_ROOT );
EE::docker()::boot_container( GLOBAL_DB, 'docker-compose up -d ' . GLOBAL_DB );
}
}

/**
* Generates global docker-compose.yml at EE_CONF_ROOT
*
Expand Down
2 changes: 1 addition & 1 deletion src/site-type/html.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function create( $args, $assoc_args ) {
$this->site_data['site_ssl_wildcard'] = \EE\Utils\get_flag_value( $assoc_args, 'wildcard' );
$this->skip_status_check = \EE\Utils\get_flag_value( $assoc_args, 'skip-status-check' );

\EE\Site\Utils\init_checks();
\EE\Service\Utils\nginx_proxy_check();

\EE::log( 'Configuring project.' );

Expand Down
57 changes: 0 additions & 57 deletions templates/global_docker_compose.yml.mustache

This file was deleted.