Remove lookup related manifests and config
This commit is contained in:
parent
3315e17346
commit
00c494193a
12 changed files with 9 additions and 201 deletions
|
@ -4,8 +4,6 @@ function sunetdrive::get_customer() >> String {
|
||||||
if $hostnameparts[1] == 'drive' {
|
if $hostnameparts[1] == 'drive' {
|
||||||
if $hostnameparts[0] =~ /^gss/ {
|
if $hostnameparts[0] =~ /^gss/ {
|
||||||
return 'gss'
|
return 'gss'
|
||||||
} elsif $hostnameparts[0] =~ /^lookup/ {
|
|
||||||
return 'lookup'
|
|
||||||
} else {
|
} else {
|
||||||
return 'common'
|
return 'common'
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,6 @@ define sunetdrive::app_type (
|
||||||
$gs_federation = hiera('gs_federation')
|
$gs_federation = hiera('gs_federation')
|
||||||
$gss_master_admin = hiera_array('gss_master_admin')
|
$gss_master_admin = hiera_array('gss_master_admin')
|
||||||
$gss_master_url = hiera("gss_master_url_${environment}")
|
$gss_master_url = hiera("gss_master_url_${environment}")
|
||||||
$lookup_server = hiera("lookup_server_${environment}")
|
|
||||||
$mail_domain = hiera("mail_domain_${environment}")
|
$mail_domain = hiera("mail_domain_${environment}")
|
||||||
$mail_smtphost = hiera("mail_smtphost_${environment}")
|
$mail_smtphost = hiera("mail_smtphost_${environment}")
|
||||||
$mail_from_address = hiera("mail_from_address_${environment}")
|
$mail_from_address = hiera("mail_from_address_${environment}")
|
||||||
|
|
|
@ -46,11 +46,7 @@ define sunetdrive::db_type(
|
||||||
sunet::system_user {'mysql': username => 'mysql', group => 'mysql' }
|
sunet::system_user {'mysql': username => 'mysql', group => 'mysql' }
|
||||||
|
|
||||||
|
|
||||||
if $location =~ /^lookup/ {
|
|
||||||
$sql_files = ['02-backup_user.sql', '03-proxysql.sql', '05-lookup.sql']
|
|
||||||
} else {
|
|
||||||
$sql_files = ['02-backup_user.sql', '03-proxysql.sql', '04-nextcloud.sql']
|
$sql_files = ['02-backup_user.sql', '03-proxysql.sql', '04-nextcloud.sql']
|
||||||
}
|
|
||||||
$sql_files.each |$sql_file|{
|
$sql_files.each |$sql_file|{
|
||||||
file { "${mariadb_dir}/init/${sql_file}":
|
file { "${mariadb_dir}/init/${sql_file}":
|
||||||
ensure => present,
|
ensure => present,
|
||||||
|
|
|
@ -7,7 +7,6 @@ class sunetdrive::infra_script (
|
||||||
$customer = 'common'
|
$customer = 'common'
|
||||||
$config = hiera_hash($environment)
|
$config = hiera_hash($environment)
|
||||||
$gss_backup_server = $config['gss_backup_server']
|
$gss_backup_server = $config['gss_backup_server']
|
||||||
$lookup_backup_server = $config['lookup_backup_server']
|
|
||||||
$ssh_config = "Host *.sunet.se
|
$ssh_config = "Host *.sunet.se
|
||||||
User script
|
User script
|
||||||
IdentityFile /root/.ssh/id_script"
|
IdentityFile /root/.ssh/id_script"
|
||||||
|
@ -66,7 +65,8 @@ class sunetdrive::infra_script (
|
||||||
warn_criteria => ['exit_status=1','max_age=3d'],
|
warn_criteria => ['exit_status=1','max_age=3d'],
|
||||||
}
|
}
|
||||||
sunet::scriptherder::cronjob { 'backuplookupdb':
|
sunet::scriptherder::cronjob { 'backuplookupdb':
|
||||||
cmd => "/root/tasks/backupdb.sh ${lookup_backup_server}",
|
ensure => 'absent',
|
||||||
|
cmd => 'true',
|
||||||
hour => '2',
|
hour => '2',
|
||||||
minute => '0',
|
minute => '0',
|
||||||
ok_criteria => ['exit_status=0','max_age=2d'],
|
ok_criteria => ['exit_status=0','max_age=2d'],
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
#Class for SUNET-Drive-Lookup-Server
|
|
||||||
class sunetdrive::lookup (
|
|
||||||
$bootstrap = undef,
|
|
||||||
$location = undef
|
|
||||||
) {
|
|
||||||
|
|
||||||
$environment = sunetdrive::get_environment()
|
|
||||||
$config = lookup($environment, undef, undef, undef)
|
|
||||||
|
|
||||||
$public_url = "https://${config['site_name']}"
|
|
||||||
|
|
||||||
|
|
||||||
# Firewall settings
|
|
||||||
$nextcloud_ip = hiera_array("${location}_app", [])
|
|
||||||
$tug_office = hiera_array('tug_office')
|
|
||||||
|
|
||||||
$dbhost = '127.0.0.1'
|
|
||||||
$gss_jwt_key = safe_hiera('gss_jwt_key')
|
|
||||||
$replication_auth = safe_hiera('replication_auth')
|
|
||||||
$mysql_user_password = safe_hiera('mysql_user_password')
|
|
||||||
$lookup_version = hiera("lookup_version_${environment}")
|
|
||||||
$email_sender = $config['email_sender']
|
|
||||||
|
|
||||||
#Create users
|
|
||||||
user { 'www-data': ensure => present, system => true }
|
|
||||||
|
|
||||||
file { '/opt/lookup/config.php':
|
|
||||||
ensure => file,
|
|
||||||
owner => 'www-data',
|
|
||||||
group => 'root',
|
|
||||||
content => template('sunetdrive/lookup/config.php.erb'),
|
|
||||||
mode => '0644',
|
|
||||||
}
|
|
||||||
|
|
||||||
sunet::docker_compose { 'drive_lookup_docker_compose':
|
|
||||||
content => template('sunetdrive/lookup/docker-compose_lookup.yml.erb'),
|
|
||||||
service_name => 'lookup',
|
|
||||||
compose_dir => '/opt/',
|
|
||||||
compose_filename => 'docker-compose.yml',
|
|
||||||
description => 'Lookup server',
|
|
||||||
}
|
|
||||||
|
|
||||||
sunet::misc::ufw_allow { 'https':
|
|
||||||
from => '0.0.0.0/0',
|
|
||||||
port => 443,
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -274,7 +274,6 @@ MACAddressPolicy=none'
|
||||||
$gss_master_admin = hiera_array('gss_master_admin')
|
$gss_master_admin = hiera_array('gss_master_admin')
|
||||||
$gss_master_url = hiera("gss_master_url_${environment}")
|
$gss_master_url = hiera("gss_master_url_${environment}")
|
||||||
$https_port = hiera_hash('multinode_mapping')[$customer]['port']
|
$https_port = hiera_hash('multinode_mapping')[$customer]['port']
|
||||||
$lookup_server = hiera("lookup_server_${environment}")
|
|
||||||
$mail_domain = hiera("mail_domain_${environment}")
|
$mail_domain = hiera("mail_domain_${environment}")
|
||||||
$mail_from_address = hiera("mail_from_address_${environment}")
|
$mail_from_address = hiera("mail_from_address_${environment}")
|
||||||
$mail_smtphost = hiera("mail_smtphost_${environment}")
|
$mail_smtphost = hiera("mail_smtphost_${environment}")
|
||||||
|
|
|
@ -418,17 +418,17 @@ class sunetdrive::script (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$gss_backup_server = $config['gss_backup_server']
|
|
||||||
$lookup_backup_server = $config['lookup_backup_server']
|
|
||||||
sunet::scriptherder::cronjob { 'backupgssdb':
|
sunet::scriptherder::cronjob { 'backupgssdb':
|
||||||
cmd => "/root/tasks/backupdb.sh ${gss_backup_server}",
|
ensure => 'absent',
|
||||||
|
cmd => 'true',
|
||||||
hour => '2',
|
hour => '2',
|
||||||
minute => '0',
|
minute => '0',
|
||||||
ok_criteria => ['exit_status=0','max_age=2d'],
|
ok_criteria => ['exit_status=0','max_age=2d'],
|
||||||
warn_criteria => ['exit_status=1','max_age=3d'],
|
warn_criteria => ['exit_status=1','max_age=3d'],
|
||||||
}
|
}
|
||||||
sunet::scriptherder::cronjob { 'backuplookupdb':
|
sunet::scriptherder::cronjob { 'backuplookupdb':
|
||||||
cmd => "/root/tasks/backupdb.sh ${lookup_backup_server}",
|
ensure => 'absent',
|
||||||
|
cmd => 'true',
|
||||||
hour => '2',
|
hour => '2',
|
||||||
minute => '0',
|
minute => '0',
|
||||||
ok_criteria => ['exit_status=0','max_age=2d'],
|
ok_criteria => ['exit_status=0','max_age=2d'],
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
<?php
|
|
||||||
$CONFIG = [
|
|
||||||
'AUTH_KEY' => "<%= @gss_jwt_key %>",
|
|
||||||
'DB' => [
|
|
||||||
'host' => "<%= @dbhost %>",
|
|
||||||
'db' => "lookup" ,
|
|
||||||
'user' => "lookup",
|
|
||||||
'pass' => "<%= @mysql_user_password %>",
|
|
||||||
],
|
|
||||||
'EMAIL_SENDER' => '<%= @email_sender %>',
|
|
||||||
'ERROR_VERBOSE' => false,
|
|
||||||
'GLOBAL_SCALE' => true,
|
|
||||||
'IP_BLACKLIST' => [
|
|
||||||
],
|
|
||||||
'MAX_REQUESTS' => 10000,
|
|
||||||
'MAX_SEARCH_PAGE' => 10,
|
|
||||||
'PUBLIC_URL' => '<%= @public_url %>',
|
|
||||||
'REPLICATION_AUTH' => '<%= @replication_auth %>',
|
|
||||||
'REPLICATION_HOSTS' => [
|
|
||||||
],
|
|
||||||
'SPAM_BLACKLIST' => [
|
|
||||||
],
|
|
||||||
'TWITTER' => [
|
|
||||||
'CONSUMER_KEY' => '',
|
|
||||||
'CONSUMER_SECRET' => '',
|
|
||||||
'ACCESS_TOKEN' => '',
|
|
||||||
'ACCESS_TOKEN_SECRET' => '',
|
|
||||||
],
|
|
||||||
];
|
|
|
@ -1,17 +0,0 @@
|
||||||
version: '3.2'
|
|
||||||
|
|
||||||
services:
|
|
||||||
|
|
||||||
app:
|
|
||||||
container_name: lookup_app_1
|
|
||||||
image: docker.sunet.se/drive/nextcloud-lookup:<%= @lookup_version %>
|
|
||||||
restart: always
|
|
||||||
volumes:
|
|
||||||
- /opt/lookup/config.php:/var/www/html/config/config.php
|
|
||||||
network_mode: host
|
|
||||||
dns:
|
|
||||||
- 89.46.20.75
|
|
||||||
- 89.46.21.29
|
|
||||||
- 89.32.32.32
|
|
||||||
command: apachectl -D FOREGROUND
|
|
||||||
tty: true
|
|
|
@ -1,62 +0,0 @@
|
||||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
|
||||||
SET time_zone = "+00:00";
|
|
||||||
|
|
||||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
|
||||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
|
||||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
|
||||||
/*!40101 SET NAMES utf8mb4 */;
|
|
||||||
|
|
||||||
CREATE DATABASE IF NOT EXISTS `lookup` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
||||||
USE `lookup`;
|
|
||||||
|
|
||||||
CREATE USER 'lookup'@'%' IDENTIFIED BY '<%= @mysql_user_password %>';
|
|
||||||
GRANT ALL PRIVILEGES ON lookup.* TO 'lookup'@'%' IDENTIFIED BY '<%= @mysql_user_password %>';
|
|
||||||
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `emailValidation`;
|
|
||||||
CREATE TABLE IF NOT EXISTS `emailValidation` (
|
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`storeId` int(11) NOT NULL,
|
|
||||||
`token` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL,
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
KEY `token` (`token`),
|
|
||||||
KEY `storeId` (`storeId`)
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `store`;
|
|
||||||
CREATE TABLE IF NOT EXISTS `store` (
|
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`userId` int(11) NOT NULL,
|
|
||||||
`k` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
|
|
||||||
`v` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
|
|
||||||
`valid` tinyint(1) NOT NULL DEFAULT '0',
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
KEY `key` (`k`(191)),
|
|
||||||
KEY `value` (`v`(191)),
|
|
||||||
KEY `userId` (`userId`)
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `users`;
|
|
||||||
CREATE TABLE IF NOT EXISTS `users` (
|
|
||||||
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
|
||||||
`federationId` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
|
|
||||||
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
KEY `federationId` (`federationId`(191))
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `toVerify`;
|
|
||||||
CREATE TABLE IF NOT EXISTS `toVerify` (
|
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`userId` int(11) NOT NULL,
|
|
||||||
`storeId` int(11) NOT NULL,
|
|
||||||
`property` varchar(512) COLLATE utf8mb4_unicode_ci NOT NULL,
|
|
||||||
`location` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
|
|
||||||
`tries` int(11) NOT NULL,
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
||||||
|
|
||||||
|
|
||||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
|
||||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
|
||||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
|
|
@ -131,32 +131,6 @@ define host {
|
||||||
<% end -%>
|
<% end -%>
|
||||||
use monitor-site
|
use monitor-site
|
||||||
}
|
}
|
||||||
<% if site.match('lookup') %>
|
|
||||||
define service {
|
|
||||||
notes_url https://<%= site %>
|
|
||||||
action_url /grafana/dashboard/script/histou.js?host=$HOSTNAME$&service=$SERVICEDISPLAYNAME$&theme=light&annotations=true
|
|
||||||
check_command check_https
|
|
||||||
check_interval 5
|
|
||||||
check_period 24x7
|
|
||||||
<% if @environment == 'prod' %>
|
|
||||||
contacts slack
|
|
||||||
<% else -%>
|
|
||||||
contact_groups naemon-admins
|
|
||||||
<% end -%>
|
|
||||||
host_name <%= site %>
|
|
||||||
max_check_attempts 3
|
|
||||||
notification_interval 60
|
|
||||||
notification_period 24x7
|
|
||||||
retry_interval 1
|
|
||||||
service_description HTTPS
|
|
||||||
<% if site.match('test') -%>
|
|
||||||
servicegroups test-sites
|
|
||||||
<% else -%>
|
|
||||||
servicegroups prod-sites
|
|
||||||
<% end -%>
|
|
||||||
}
|
|
||||||
<% end -%>
|
|
||||||
<% unless site.match('lookup') %>
|
|
||||||
define service {
|
define service {
|
||||||
notes_url https://<%= site %>/status.php
|
notes_url https://<%= site %>/status.php
|
||||||
action_url /grafana/dashboard/script/histou.js?host=$HOSTNAME$&service=$SERVICEDISPLAYNAME$&theme=light&annotations=true
|
action_url /grafana/dashboard/script/histou.js?host=$HOSTNAME$&service=$SERVICEDISPLAYNAME$&theme=light&annotations=true
|
||||||
|
@ -209,4 +183,3 @@ define service {
|
||||||
<% end -%>
|
<% end -%>
|
||||||
}
|
}
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%>
|
|
||||||
|
|
|
@ -67,12 +67,10 @@ def main() -> int:
|
||||||
reboot_command = ['sudo /usr/local/bin/safer_reboot']
|
reboot_command = ['sudo /usr/local/bin/safer_reboot']
|
||||||
|
|
||||||
if customers[0] == "common":
|
if customers[0] == "common":
|
||||||
customers = ["lookup", "multinode"]
|
customers = ["multinode"]
|
||||||
for customer in customers:
|
for customer in customers:
|
||||||
backup_type = "backup"
|
backup_type = "backup"
|
||||||
if customer == "lookup":
|
if customer == "multinode":
|
||||||
backup_type = "lookupbackup"
|
|
||||||
elif customer == "multinode":
|
|
||||||
backup_command = ['sudo /home/script/bin/backup_multinode_db.sh']
|
backup_command = ['sudo /home/script/bin/backup_multinode_db.sh']
|
||||||
backup_type = "multinode-db"
|
backup_type = "multinode-db"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue