Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from hyn/issue-47
refactored to monolythic so working on the repo is easier in the future
- Loading branch information
Showing
95 changed files
with
2,958 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
return [ | ||
'packages' => [ | ||
'multi-tenant' => [ | ||
'description' => 'Multi tenancy for Laravel 5.1+', | ||
'service-provider' => 'Hyn\MultiTenant\MultiTenantServiceProvider', | ||
], | ||
'management-interface' => [ | ||
'description' => 'Interface for managing webserver and multi tenancy', | ||
'service-provider' => 'Hyn\ManagementInterface\ManagementInterfaceServiceProvider', | ||
], | ||
'webserver' => [ | ||
'description' => 'Integration into and generation of configs for webservices', | ||
'service-provider' => 'Hyn\Webserver\WebserverServiceProvider', | ||
], | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
<?php | ||
|
||
/** | ||
* All hyn-me/webserver related configuration options. | ||
* | ||
* @warning please be advised, read the documentation on http://hyn.me before editing | ||
* | ||
* None of the generated configurations will work as long as you don't add the paths to the corresponding webservice | ||
* configuration file. See documentation for more info. | ||
*/ | ||
return [ | ||
'webservers' => ['nginx', 'apache'], | ||
|
||
/* | ||
* If tenant files should belong to a certain user, set the `default-user` value to that username | ||
* - true will generate a username automatically based on the website | ||
* - <string> will use the specified existing username for the website | ||
* - null will disable generating users | ||
*/ | ||
'default-user' => true, | ||
|
||
/* | ||
* The group the tenant files should belong to | ||
*/ | ||
'group' => 'www-data', | ||
|
||
/* | ||
* SSL | ||
*/ | ||
'ssl' => [ | ||
'path' => storage_path('webserver/ssl'), | ||
], | ||
/* | ||
* Logging specific settings | ||
*/ | ||
'log' => [ | ||
// path where to store the webserver logs | ||
'path' => storage_path('logs'), | ||
], | ||
/* | ||
* Apache | ||
*/ | ||
'apache' => [ | ||
'path' => storage_path('webserver/apache/'), | ||
// class that runs functionality for this service | ||
'class' => 'Hyn\Webserver\Generators\Webserver\Apache', | ||
'enabled' => true, | ||
'port' => [ | ||
'http' => 80, | ||
'https' => 443, | ||
], | ||
// path to service daemon, used to verify service exists | ||
'service' => '/etc/init.d/apache2', | ||
// how to run actions for this service | ||
'actions' => [ | ||
'configtest' => 'apache2ctl -t', | ||
'reload' => 'apache2ctl graceful', | ||
], | ||
// system wide configuration directory | ||
'conf' => [ | ||
// location for ubuntu 14.04 systems | ||
'/etc/apache2/sites-enabled/', | ||
], | ||
// mask for auto-generated config file that includes the tenant configurations | ||
'mask' => '%s.conf', | ||
// include format using sprintf to include the location of the storage/webserver/apache directory | ||
'include' => 'IncludeOptional %s*', | ||
], | ||
/* | ||
* Nginx | ||
*/ | ||
'nginx' => [ | ||
'path' => storage_path('webserver/nginx/'), | ||
'class' => 'Hyn\Webserver\Generators\Webserver\Nginx', | ||
'enabled' => true, | ||
'port' => [ | ||
'http' => 80, | ||
'https' => 443, | ||
], | ||
// path to service daemon, used to verify service exists | ||
'service' => '/etc/init.d/nginx', | ||
// how to run actions for this service | ||
'actions' => [ | ||
'configtest' => '/etc/init.d/nginx configtest', | ||
'reload' => '/etc/init.d/nginx reload', | ||
], | ||
'conf' => ['/etc/nginx/sites-enabled/'], | ||
'mask' => '%s.conf', | ||
'include' => 'include %s*;', | ||
/* | ||
* the nginx service depends on fpm | ||
* during changes we will automatically trigger fpm as well | ||
*/ | ||
'depends' => [ | ||
'fpm', | ||
], | ||
], | ||
/* | ||
* PHP FPM | ||
*/ | ||
'fpm' => [ | ||
'path' => storage_path('webserver/fpm/'), | ||
'class' => 'Hyn\Webserver\Generators\Webserver\Fpm', | ||
'enabled' => true, | ||
'conf' => ['/etc/php5/fpm/pool.d/'], | ||
// path to service daemon, used to verify service exists | ||
'service' => '/etc/init.d/php5-fpm', | ||
// how to run actions for this service | ||
'actions' => [ | ||
'configtest' => '/etc/init.d/php5-fpm -t', | ||
'reload' => '/etc/init.d/php5-fpm reload', | ||
], | ||
'mask' => '%s.conf', | ||
'include' => 'include=%s*;', | ||
/* | ||
* base modifier for fpm pool port | ||
* @example if base is 9000, will generate pool file for website Id 5 with port 9005 | ||
* @info this port is used in Nginx configurations for the PHP proxy | ||
*/ | ||
'port' => 9000, | ||
], | ||
]; |
55 changes: 55 additions & 0 deletions
55
database/migrations/2015_05_19_000000_hws_ssl_certificates_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Hyn\MultiTenant\Tenant\DatabaseConnection; | ||
|
||
class HwsSslCertificatesTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::connection(DatabaseConnection::systemConnectionName())->create('ssl_certificates', function (Blueprint $table) { | ||
$table->bigIncrements('id'); | ||
// tenant owner | ||
$table->bigInteger('tenant_id')->unsigned(); | ||
|
||
// certificate | ||
$table->text('certificate'); | ||
// bundles | ||
$table->text('authority_bundle'); | ||
// key | ||
$table->text('key'); | ||
|
||
$table->boolean('wildcard')->default(false); | ||
|
||
// date when certificate becomes usable as read from certificate | ||
$table->timestamp('validates_at')->nullable(); | ||
// date of expiry as read from certificate | ||
$table->timestamp('invalidates_at')->nullable(); | ||
|
||
// timestaps | ||
$table->timestamps(); | ||
$table->softDeletes(); | ||
|
||
// relations | ||
$table->foreign('tenant_id')->references('id')->on('tenants')->onDelete('cascade'); | ||
|
||
// index | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::connection(DatabaseConnection::systemConnectionName())->dropIfExists('ssl_certificates'); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
database/migrations/2015_05_19_000001_hws_ssl_hostnames_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Hyn\MultiTenant\Tenant\DatabaseConnection; | ||
|
||
class HwsSslHostnamesTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::connection(DatabaseConnection::systemConnectionName())->create('ssl_hostnames', function (Blueprint $table) { | ||
$table->bigIncrements('id'); | ||
// certificate id | ||
$table->bigInteger('ssl_certificate_id')->unsigned(); | ||
// domain relation | ||
$table->bigInteger('hostname_id')->unsigned(); | ||
|
||
// certificate | ||
$table->string('hostname'); | ||
|
||
// timestaps | ||
$table->timestamps(); | ||
$table->softDeletes(); | ||
|
||
// index | ||
$table->index('hostname'); | ||
$table->index('hostname_id'); | ||
$table->index('ssl_certificate_id'); | ||
// relations | ||
$table->foreign('ssl_certificate_id')->references('id')->on('ssl_certificates')->onDelete('cascade'); | ||
// the set null constraint does not work on mariadb; let's just ignore that for now | ||
// @TODO but fix support for set null in the future somehow | ||
// $table->foreign('hostname_id')->references('id')->on('hostnames')->onDelete('set null'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::connection(DatabaseConnection::systemConnectionName())->dropIfExists('ssl_hostnames'); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
database/migrations/2015_05_19_000002_hws_ssl_hostnames_drop_hostname_id.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Hyn\MultiTenant\Tenant\DatabaseConnection; | ||
|
||
class HwsSslHostnamesDropHostnameId extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::connection(DatabaseConnection::systemConnectionName())->table('ssl_hostnames', function (Blueprint $table) { | ||
// domain relation | ||
$table->dropColumn('hostname_id'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::connection(DatabaseConnection::systemConnectionName())->table('ssl_hostnames', function (Blueprint $table) { | ||
// domain relation | ||
$table->bigInteger('hostname_id')->unsigned(); | ||
}); | ||
} | ||
} |
Oops, something went wrong.