2024-02-27 10:59:32 +00:00
|
|
|
#Class for SUNET-Drive-portal-Server
|
|
|
|
class sunetdrive::portal (
|
|
|
|
String $portal_version = '0.0.1-1'
|
|
|
|
) {
|
|
|
|
|
|
|
|
$environment = sunetdrive::get_environment()
|
|
|
|
if $environment == 'prod' {
|
|
|
|
$domain = 'drive.sunet.se'
|
|
|
|
} else {
|
|
|
|
$domain = 'drive.test.sunet.se'
|
|
|
|
}
|
|
|
|
sunet::docker_compose { 'portal_compose':
|
|
|
|
content => template('sunetdrive/portal/docker-compose.erb.yaml'),
|
|
|
|
service_name => 'portal',
|
|
|
|
compose_dir => '/opt/',
|
|
|
|
compose_filename => 'docker-compose.yml',
|
|
|
|
description => 'Portal server',
|
|
|
|
}
|
|
|
|
|
|
|
|
exec { 'workaround_docker_compose_dir':
|
|
|
|
command => 'mkdir -p /opt/portal/nginx',
|
|
|
|
unless => 'test -d /opt/portal/nginx',
|
|
|
|
}
|
|
|
|
|
|
|
|
$nginx_dirs = ['acme', 'certs', 'conf', 'dhparam', 'html', 'vhost']
|
|
|
|
$nginx_dirs.each | $dir| {
|
|
|
|
file { "/opt/portal/nginx/${dir}":
|
|
|
|
ensure => directory,
|
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
|
|
|
mode => '0751',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
file { '/opt/portal/config.yaml':
|
|
|
|
ensure => present,
|
|
|
|
content => template('sunetdrive/portal/config.erb.yaml'),
|
|
|
|
mode => '0644',
|
|
|
|
}
|
|
|
|
sunet::misc::ufw_allow { 'https':
|
|
|
|
from => '0.0.0.0/0',
|
|
|
|
port => 443,
|
|
|
|
}
|
2024-02-27 15:31:27 +00:00
|
|
|
# For acme and redirect
|
|
|
|
sunet::misc::ufw_allow { 'http':
|
|
|
|
from => '0.0.0.0/0',
|
|
|
|
port => 80,
|
|
|
|
}
|
2024-02-27 10:59:32 +00:00
|
|
|
}
|