Browse Source

Iniial commit

master
7u83 8 months ago
parent
commit
ae53be5af7
3 changed files with 2157 additions and 0 deletions
  1. +181
    -0
      manifests/init.pp
  2. +43
    -0
      templates/config.php.erb
  3. +1933
    -0
      templates/php.ini.erb

+ 181
- 0
manifests/init.pp View File

@@ -0,0 +1,181 @@
#
#
#
class wmdeit_nextcloud(
$instanceid,
$passwordsalt,
$secret,
$trusted_domains =[] ,
$main_domain,

$ext_url = "https://$main_domain",

$install_dir = "/var/www/nextcloud",
$distfile = "nextcloud-19.0.1.zip",
$sourcefile = "https://download.nextcloud.com/server/releases/nextcloud-19.0.1.zip",

$redis_password = undef,

$db_port = undef,
$db_user = "nextcloud",
$db_password = undef,
$db_host = "localhost",
$db_name = "nextcloud",
$db_type = "mysql",
$db_prefix = "oc_",

$data_dir = "$install_dir/data",

$nc_user = "www-data",
$nc_group = "www-data",

$php_version = "7.2"
)

{

class { 'apache':
mpm_module => 'prefork',
}
class { 'apache::mod::php':
# php_version=>"7.2"
}
class { '::php':
extensions => {
zip => {},
mbstring => {},
gd => {},
curl => {},
pgsql => {},
mysql => {},
ldap => {},
intl => {},
imagick => {},
redis => {},
apcu => {},
},
settings => {
'PHP/memory_limit' => '512M',
}
}

archive { "/tmp/$distfile":

ensure => present,
source => $sourcefile,
extract_path => "/var/www",
extract => true,
cleanup => true,
checksum => $checksum,
checksum_type => $checksum_type,
creates => "$install_dir",
require => Class["apache"]
} ->
apache::vhost { $main_domain:
serveraliases => $trusted_domains,
port => '80',
docroot => $install_dir,
} ->
exec { 'ncperms':
command => "/bin/chown -R www-data:www-data $install_dir",
subscribe => Archive["/tmp/$distfile"],
require => Class["apache"]
} ->
file { "$install_dir/config/config.php":
ensure => file,
content => template("wmdeit_nextcloud/config.php.erb")
} ->

exec {"/bin/mkdir -p $data_dir":
creates => $data_dir
} ->
file {$data_dir:
ensure => directory,
owner => $nc_user,
group => $nc_group
} ->
file {"$data_dir/.ocdata":
ensure => file,
owner => $nc_user,
group => $nc_group
} ->
file {"/etc/php/$php_version/apache2/php.ini":
ensure => file,
content => template("wmdeit_nextcloud/php.ini.erb")
}


cron {'nc_cron':
ensure => present,
user => 'www-data',
command => '/usr/bin/php /var/www/html/cron.php',
minute => '*/15',
}

class {'redis':
bind => '127.0.0.1',
masterauth => $redis_password
}

include java
package {"elasticsearch":
ensure => installed
}
# class { 'elasticsearch':
# status => 'enabled',
# version => '7.8.0',
# ensure => absent
# }

# elasticsearch::instance { 'es-01': }

#class {"wmdeit_nextcloud::solr":
#}
}



class wmdeit_nextcloud::solr
{
###
# solr
package {["openjdk-11-jdk","lsof"]:
ensure => installed
}
file {"/opt":
ensure => directory
} ->
archive { "/tmp/solr-8.6.0.tgz":
ensure => present,
source => "https://downloads.apache.org/lucene/solr/8.6.0/solr-8.6.0.tgz",
extract_path => "/opt/",
extract => true,
cleanup => false,
checksum => $checksum,
checksum_type => $checksum_type,
creates => "/opt/solr-8.6.0",
} ->
file { '/opt/solr':
ensure => link,
target => "/opt/solr-8.6.0",
} ->
group{"solr":
ensure => present
} ->
user{"solr":
ensure => present
}->
file { '/opt/solr/server/logs':
ensure => directory,
owner => 'solr',
group => 'solr',
}->
exec{ '/opt/solr/bin/solr start':
user => 'solr',

}

}



+ 43
- 0
templates/config.php.erb View File

@@ -0,0 +1,43 @@
<?php
$CONFIG = array (
'instanceid' => '<%= @instanceid %>',
'passwordsalt' => '<%= @passwordsalt %>',
'secret' => '<%= @secret %>',
'trusted_domains' =>
array (
<% @trusted_domains.each_with_index do | dom,idx | -%>
<%= idx %> => '<%= dom %>',
<% end -%>
),
'datadirectory' => '<%= @data_dir %>',
'overwrite.cli.url' => '<= @ext_url %>',
'overwriteprotocol' => 'https',

# caching
'memcache.local' => '\\OC\\Memcache\\Redis',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' =>
array (
'host' => 'localhost',
'port' => 6379,
'timeout' => 0.0,
'password' => '<%= $redis_password %>',
),

# because we are behind a reverse proxy
'overwriteprotocol' => 'https',

# database stuff
'dbtype' => '<%= @db_type %>',
'dbname' => '<%= @db_name %>',
'dbhost' => '<%= @db_host %>',
'dbport' => '<%= @db_port %>',
'dbtableprefix' => '<%= @db_prefix %>',
'dbuser' => '<%= @db_user %>',
'dbpassword' => '<%= @db_password %>',

# rest
'version' => '19.0.1.1',
'installed' => true,
);


+ 1933
- 0
templates/php.ini.erb
File diff suppressed because it is too large
View File


Loading…
Cancel
Save