Skip to content
Snippets Groups Projects
Commit d83b5251 authored by Martin van Es's avatar Martin van Es
Browse files

Store DB in volume mount, minor tweaks

parent c8a40f56
Branches
Tags
No related merge requests found
.env .env
cert/wildcard* cert/*
!cert/KEEP
database/data/*
!database/data/KEEP
...@@ -12,6 +12,7 @@ services: ...@@ -12,6 +12,7 @@ services:
MARIADB_USER: ${MARIADB_USER} MARIADB_USER: ${MARIADB_USER}
MARIADB_PASSWORD: ${MARIADB_PASSWORD} MARIADB_PASSWORD: ${MARIADB_PASSWORD}
volumes: volumes:
- ./database/data:/var/lib/mysql
- ./database/testidp.sql:/docker-entrypoint-initdb.d/testidp.sql - ./database/testidp.sql:/docker-entrypoint-initdb.d/testidp.sql
testidp: testidp:
...@@ -20,12 +21,13 @@ services: ...@@ -20,12 +21,13 @@ services:
args: args:
SALT: ${SALT} SALT: ${SALT}
DOMAIN: ${DOMAIN} DOMAIN: ${DOMAIN}
PORT: ${PORT}
MARIADB_USER: ${MARIADB_USER} MARIADB_USER: ${MARIADB_USER}
MARIADB_PASSWORD: ${MARIADB_PASSWORD} MARIADB_PASSWORD: ${MARIADB_PASSWORD}
restart: always restart: always
ports: ports:
- 8080:80 - 8080:80
- 8443:443 - ${PORT}:443
volumes: volumes:
- ./cert:/etc/apache2/cert - ./cert:/etc/apache2/cert
- ./testidp/simplesamlphp/config/logins.json:/opt/simplesamlphp/config/logins.json - ./testidp/simplesamlphp/config/logins.json:/opt/simplesamlphp/config/logins.json
......
MARIADB_USER=admin MARIADB_USER=admin
MARIADB_PASSWORD=admin MARIADB_PASSWORD=admin
DOMAIN=example.org DOMAIN=example.org
PORT=8443
SALT=secret_salt SALT=secret_salt
...@@ -4,6 +4,7 @@ ARG RUNLEVEL=1 ...@@ -4,6 +4,7 @@ ARG RUNLEVEL=1
ENV TERM linux ENV TERM linux
ARG DOMAIN ARG DOMAIN
ARG PORT
ARG MARIADB_USER ARG MARIADB_USER
ARG MARIADB_PASSWORD ARG MARIADB_PASSWORD
ARG SALT ARG SALT
......
...@@ -8,32 +8,48 @@ ...@@ -8,32 +8,48 @@
class custom_phpmailer { class custom_phpmailer {
public function __construct() { public function __construct() {
} }
public static function send_email($to, $to_name='', $subject='Message from Test IDP portal', $message, $success='Your account registration is pending') { public static function send_email($to, $to_name='', $subject='Message from Test IDP portal', $message, $success='Your account registration is pending') {
$mail = new PHPMailer; $mail = new PHPMailer;
$mail->CharSet = "UTF-8"; $mail->CharSet = "UTF-8";
$mail->isSMTP(); $mail->isSMTP();
$mail->SMTPDebug = 0; // 0 = off (for production use) - 1 = client messages - 2 = client and server messages $mail->SMTPDebug = 0; // 0 = off (for production use) - 1 = client messages - 2 = client and server messages
$mail->Host = gethostbyname('replace your.mailrelay.org'); //$mail->Host = "smtp.gmail.com"; // use $mail->Host = gethostbyname('smtp.gmail.com'); // if your network does not support SMTP over IPv6
$mail->Host = "in-v3.mailjet.com";
//$mail->Port = 465; // TLS only //$mail->Port = 465; // TLS only
$mail->Port = 587; // TLS only $mail->Port = 587; // TLS only
//$mail->SMTPSecure = 'ssl'; // ssl is deprecated
$mail->SMTPAuth = true; $mail->SMTPAuth = true;
$mail->Username = 'replace username'; //$mail->Username = 'geant.incubator@gmail.com';
$mail->Password = 'replace password'; $mail->Username = 'eaa84e1afc080e61cdf87e021b2b3f8e';
$mail->setFrom('example.org', 'Test IDP portal'); //$mail->Password = '=xtJEq&>+]TS&qu7-719}B{E[4';
$mail->Password = 'f444618af6955a1aba1c29f219fe6746';
//$mail->setFrom('noreply@testidp.incubator.geant.org', 'Test IDP portal');
$mail->setFrom('tikrasseo@gmail.com', 'Test IDP portal');
if (security::check_request_data($to_name)) { if (security::check_request_data($to_name)) {
$mail->addAddress($to, $to_name); $mail->addAddress($to, $to_name);
} else { } else {
$mail->addAddress($to); $mail->addAddress($to);
} }
$mail->Subject = $subject; $mail->Subject = $subject;
$mail->msgHTML($message); embedded, /*
$from_ip = '';
if(filter_var('', FILTER_VALIDATE_IP)) {
$from_ip = @$_SERVER['HTTP_CLIENT_IP'];
} elseif(filter_var('', FILTER_VALIDATE_IP)) {
$from_ip = @$_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$from_ip = @$_SERVER['REMOTE_ADDR'];
}
$message .= '<br />Sent from IP: '.$from_ip;
*/
$mail->msgHTML($message); //$mail->msgHTML(file_get_contents('contents.html'), __DIR__); //Read an HTML message body from an external file, convert referenced images to embedded,
$mail->AltBody = strip_tags(str_replace('<br />', "\n\r", $message)); $mail->AltBody = strip_tags(str_replace('<br />', "\n\r", $message));
if(!$mail->send()){ if(!$mail->send()){
return security::format_message("ERROR:Įvyko klaida siunčiant el. laišką. Prašome kreiptis į administratorių."); return security::format_message("ERROR:Įvyko klaida siunčiant el. laišką. Prašome kreiptis į administratorių.");
} else { } else {
return $success; return $success;
} }
} }
} }
?> ?>
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
//Basic web data (one time domain settings) //Basic web data (one time domain settings)
define('WEB_BASE_PRO', 'https'); define('WEB_BASE_PRO', 'https');
define('WEB_BASE_URL', WEB_BASE_PRO.'://admin.${DOMAIN}:8443'); //Without trailing slash define('WEB_BASE_URL', WEB_BASE_PRO.'://admin.${DOMAIN}:${PORT}'); //Without trailing slash
define('WEB_BASE_DIR', '/opt/admin/public_html'); //Without trailing slash define('WEB_BASE_DIR', '/opt/admin/public_html'); //Without trailing slash
define('APP_BASE_DIR', '/opt/admin/application'); //Without trailing slash define('APP_BASE_DIR', '/opt/admin/application'); //Without trailing slash
define('UPL_BASE_URL', WEB_BASE_URL.'/uploads'); //Without trailing slash define('UPL_BASE_URL', WEB_BASE_URL.'/uploads'); //Without trailing slash
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment