Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bobimicroweber committed Sep 17, 2024
1 parent 41e1d91 commit 49cf3ff
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
33 changes: 30 additions & 3 deletions web/Modules/Email/App/Console/SetupDockerEmailServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

namespace Modules\Email\App\Console;

use App\Models\DomainSslCertificate;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Blade;
use Modules\LetsEncrypt\Models\LetsEncryptCertificate;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;

Expand Down Expand Up @@ -37,23 +39,34 @@ public function handle()

$workPath = '/usr/local/phyre/email/docker';

$domain = 'allsidepixels.com';

$moduleServerConfigTemplatesPath = '/usr/local/phyre/web/Modules/Email/server/docker/';
$dockerComposeYaml = file_get_contents($moduleServerConfigTemplatesPath . 'docker-compose.yaml');
$dockerComposeYaml = Blade::render($dockerComposeYaml, [
'containerName' => 'phyre-mail-server',
'hostName'=> 'mail.allsidepixels.com',
'hostName'=> 'mail.'.$domain,
'workPath' => $workPath,
]);
shell_exec('mkdir -p ' . $workPath);
file_put_contents($workPath . '/docker-compose.yaml', $dockerComposeYaml);

$ssl = DomainSslCertificate::where('domain', $domain)->first();
if ($ssl) {
shell_exec('mkdir -p ' . $workPath . '/docker-data/acme-companion/certs/' . $domain);
file_put_contents($workPath . '/docker-data/acme-companion/certs/' . $domain . '/fullchain.pem', $ssl->certificate_chain);
file_put_contents($workPath . '/docker-data/acme-companion/certs/' . $domain . '/privkey.pem', $ssl->private_key);
}



// dd(shell_exec('docker-compose -f ' . $workPath . '/docker-compose.yaml up -d'));

// after compose you must create the email account

//docker exec -ti ba139fb8b106 setup email add [email protected] passwd123
//docker exec -ti cc85629c8ad5 setup email add [email protected] passwd123

// docker exec -it ba139fb8b106 setup config dkim
// docker exec -it cc85629c8ad5 setup config dkim


//ufw allow 25
Expand All @@ -63,4 +76,18 @@ public function handle()
dd($dockerComposeYaml);

}

public function checkDNSValidation()
{

// exec: dig @1.1.1.1 +short MX allsidepixels.com
// output: 10 mail.allsidepixels.com

// exec: dig @1.1.1.1 +short A mail.allsidepixels.com
// output: 49.13.13.211

// exec: dig @1.1.1.1 +short -x 49.13.13.211
// output: mail.allsidepixels.com

}
}
1 change: 1 addition & 0 deletions web/Modules/Email/server/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ services:
- ENABLE_SPAMASSASSIN=0
- SPOOF_PROTECTION=0
- ENABLE_POP3=1
- [email protected]
cap_add:
- NET_ADMIN
- SYS_PTRACE
Expand Down

0 comments on commit 49cf3ff

Please sign in to comment.