diff --git a/functions/get_customer.pp b/functions/get_customer.pp index ab67f9f..c1d9964 100644 --- a/functions/get_customer.pp +++ b/functions/get_customer.pp @@ -4,8 +4,6 @@ function sunetdrive::get_customer() >> String { if $hostnameparts[1] == 'drive' { if $hostnameparts[0] =~ /^gss/ { return 'gss' - } elsif $hostnameparts[0] =~ /^lookup/ { - return 'lookup' } else { return 'common' } diff --git a/manifests/app_type.pp b/manifests/app_type.pp index d8096b1..e86aa86 100644 --- a/manifests/app_type.pp +++ b/manifests/app_type.pp @@ -74,7 +74,6 @@ define sunetdrive::app_type ( $gs_federation = hiera('gs_federation') $gss_master_admin = hiera_array('gss_master_admin') $gss_master_url = hiera("gss_master_url_${environment}") - $lookup_server = hiera("lookup_server_${environment}") $mail_domain = hiera("mail_domain_${environment}") $mail_smtphost = hiera("mail_smtphost_${environment}") $mail_from_address = hiera("mail_from_address_${environment}") diff --git a/manifests/db_type.pp b/manifests/db_type.pp index 23e4660..376334b 100644 --- a/manifests/db_type.pp +++ b/manifests/db_type.pp @@ -46,11 +46,7 @@ define sunetdrive::db_type( 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|{ file { "${mariadb_dir}/init/${sql_file}": ensure => present, diff --git a/manifests/infra_script.pp b/manifests/infra_script.pp index be78e19..818cf1a 100644 --- a/manifests/infra_script.pp +++ b/manifests/infra_script.pp @@ -7,7 +7,6 @@ class sunetdrive::infra_script ( $customer = 'common' $config = hiera_hash($environment) $gss_backup_server = $config['gss_backup_server'] - $lookup_backup_server = $config['lookup_backup_server'] $ssh_config = "Host *.sunet.se User script IdentityFile /root/.ssh/id_script" @@ -66,7 +65,8 @@ class sunetdrive::infra_script ( warn_criteria => ['exit_status=1','max_age=3d'], } sunet::scriptherder::cronjob { 'backuplookupdb': - cmd => "/root/tasks/backupdb.sh ${lookup_backup_server}", + ensure => 'absent', + cmd => 'true', hour => '2', minute => '0', ok_criteria => ['exit_status=0','max_age=2d'], diff --git a/manifests/lookup.pp b/manifests/lookup.pp deleted file mode 100644 index 30994b8..0000000 --- a/manifests/lookup.pp +++ /dev/null @@ -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, - } -} diff --git a/manifests/multinode.pp b/manifests/multinode.pp index ed3def2..1bf9aeb 100644 --- a/manifests/multinode.pp +++ b/manifests/multinode.pp @@ -274,7 +274,6 @@ MACAddressPolicy=none' $gss_master_admin = hiera_array('gss_master_admin') $gss_master_url = hiera("gss_master_url_${environment}") $https_port = hiera_hash('multinode_mapping')[$customer]['port'] - $lookup_server = hiera("lookup_server_${environment}") $mail_domain = hiera("mail_domain_${environment}") $mail_from_address = hiera("mail_from_address_${environment}") $mail_smtphost = hiera("mail_smtphost_${environment}") diff --git a/manifests/script.pp b/manifests/script.pp index 56a910d..4cfa6c1 100644 --- a/manifests/script.pp +++ b/manifests/script.pp @@ -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': - cmd => "/root/tasks/backupdb.sh ${gss_backup_server}", + ensure => 'absent', + cmd => 'true', hour => '2', minute => '0', ok_criteria => ['exit_status=0','max_age=2d'], warn_criteria => ['exit_status=1','max_age=3d'], } sunet::scriptherder::cronjob { 'backuplookupdb': - cmd => "/root/tasks/backupdb.sh ${lookup_backup_server}", + ensure => 'absent', + cmd => 'true', hour => '2', minute => '0', ok_criteria => ['exit_status=0','max_age=2d'], diff --git a/templates/lookup/config.php.erb b/templates/lookup/config.php.erb deleted file mode 100644 index c7f9551..0000000 --- a/templates/lookup/config.php.erb +++ /dev/null @@ -1,29 +0,0 @@ - "<%= @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' => '', - ], -]; diff --git a/templates/lookup/docker-compose_lookup.yml.erb b/templates/lookup/docker-compose_lookup.yml.erb deleted file mode 100644 index 0fbf94d..0000000 --- a/templates/lookup/docker-compose_lookup.yml.erb +++ /dev/null @@ -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 diff --git a/templates/mariadb/05-lookup.sql.erb b/templates/mariadb/05-lookup.sql.erb deleted file mode 100644 index 577c0e9..0000000 --- a/templates/mariadb/05-lookup.sql.erb +++ /dev/null @@ -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 */; diff --git a/templates/monitor/sunetdrive_sites.cfg.erb b/templates/monitor/sunetdrive_sites.cfg.erb index 7991da6..c9a7772 100644 --- a/templates/monitor/sunetdrive_sites.cfg.erb +++ b/templates/monitor/sunetdrive_sites.cfg.erb @@ -131,32 +131,6 @@ define host { <% end -%> 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 { notes_url https://<%= site %>/status.php action_url /grafana/dashboard/script/histou.js?host=$HOSTNAME$&service=$SERVICEDISPLAYNAME$&theme=light&annotations=true @@ -209,4 +183,3 @@ define service { <% end -%> } <% end -%> -<% end -%> diff --git a/templates/script/restart-db-cluster.erb b/templates/script/restart-db-cluster.erb index 82ac939..3fdcbca 100755 --- a/templates/script/restart-db-cluster.erb +++ b/templates/script/restart-db-cluster.erb @@ -67,12 +67,10 @@ def main() -> int: reboot_command = ['sudo /usr/local/bin/safer_reboot'] if customers[0] == "common": - customers = ["lookup", "multinode"] + customers = ["multinode"] for customer in customers: backup_type = "backup" - if customer == "lookup": - backup_type = "lookupbackup" - elif customer == "multinode": + if customer == "multinode": backup_command = ['sudo /home/script/bin/backup_multinode_db.sh'] backup_type = "multinode-db"