Ignore:
Timestamp:
Feb 7, 2021, 2:31:13 PM (6 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
debian/bullseye, master
Children:
8721817, df86d5a
Parents:
bc8139b
Message:

Added mapservice-webclient to configuration

Location:
src/puppetcode/environments/gnuboat
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • src/puppetcode/environments/gnuboat/hieradata/gnuboat/mapservice_host.yaml

    rbc8139b r7dc03d6  
    22classes:
    33  - gnuboat_mapservice
     4  - apt
    45  - docker
    56  - docker::compose
    … …  
    1617#gnuboat_mapservice::apache_vhost_name: gnuboat.example.org
    1718gnuboat_mapservice::osm_tileserver_enabled: false
     19apt::sources:
     20  'gnuboat':
     21    comment: 'GNUBoat repository'
     22    location: 'http://ftp.engsas.de/unstable/gnuboat/'
     23    release: 'bullseye'
     24    repos: 'main'
     25    key:
     26      id: 'B5FB30C861780282'
     27      server: 'pgp.mit.edu'
     28    include:
     29      src: true
     30      deb: true
    1831docker::version: 'latest'
    1932docker::ensure: 'present'
  • src/puppetcode/environments/gnuboat/modules/gnuboat_mapservice/manifests/host_install.pp

    rbc8139b r7dc03d6  
    11class gnuboat_mapservice::host_install (
    2         String $database_host = "gnuboat_mapservice_database",
    3         String $broker_host = "gnuboat_mapservice_rabbitmq",
    4         String $celery_cache_host = "gnuboat_mapservice_cache",
    5         Integer $mapservice_workers = 2,
     2    String $database_host = "gnuboat_mapservice_database",
     3    String $broker_host = "gnuboat_mapservice_rabbitmq",
     4    String $celery_cache_host = "gnuboat_mapservice_cache",
     5    Integer $mapservice_workers = 2,
    66) inherits gnuboat_mapservice
    77{
    8         file { extlib::dir_split($mapservice_tile_cache_dir):
    9                 ensure => 'directory',
    10                 mode => '0750',
     8    file { extlib::dir_split($mapservice_tile_cache_dir):
     9            ensure => 'directory',
     10            mode => '0750',
     11    }
     12
     13    unless File['/var/lib/gnuboat'] {
     14        file { '/var/lib/gnuboat':
     15            ensure => 'directory',
     16        }
     17    }
     18    file { '/var/lib/gnuboat/mapservice':
     19        ensure => 'directory',
     20    }
     21    file { '/var/lib/gnuboat/mapservice/rabbitmq':
     22        ensure => 'directory',
     23    }
     24
     25    file { '/var/lib/gnuboat/mapservice/docker_database':
     26        ensure => 'directory',
     27    }
     28
     29    file { '/var/lib/gnuboat/mapservice/docker_mapservice':
     30        ensure => 'directory',
     31    }
     32
     33    file { '/var/lib/gnuboat/mapservice/docker_mapservice_celery':
     34        ensure => 'directory',
     35    }
     36
     37    file { '/var/lib/gnuboat/mapservice/docker_rabbitmq':
     38        ensure => 'directory',
     39    }
     40
     41    file { '/var/lib/gnuboat/mapservice/docker_memcached':
     42        ensure => 'directory',
     43    }
     44
     45    file { '/var/lib/gnuboat/mapservice/docker_database/Dockerfile':
     46        ensure => file,
     47        content => file('gnuboat_mapservice/mapservice_database_dockerfile'),
     48    }
     49
     50    file { '/var/lib/gnuboat/mapservice/docker_database/gnuboat_mapservice.sql':
     51        ensure => file,
     52        content => file('gnuboat_mapservice/gnuboat_mapservice.sql'),
     53    }
     54
     55    file { '/var/lib/gnuboat/mapservice/docker_mapservice/Dockerfile':
     56        ensure => file,
     57        content => epp('gnuboat_mapservice/mapservice_mapservice_dockerfile.epp',
     58        { 
     59            'mapservice_workers' => $mapservice_workers,
     60            'mapservice_tile_cache_dir' => $mapservice_tile_cache_dir,
     61        }),
     62    }
     63
     64    file { '/var/lib/gnuboat/mapservice/docker_mapservice/gnuboat-keyring.gpg':
     65        ensure => file,
     66        content => file('gnuboat_mapservice/gnuboat-keyring.gpg'),
     67    }
     68
     69    file { '/var/lib/gnuboat/mapservice/docker_mapservice/mapservice.conf':
     70        ensure => file,
     71        content => epp('gnuboat_mapservice/mapservice.conf.epp',
     72        {
     73            'database_name' => $database_name,
     74            'database_user' => $database_user,
     75            'database_password' => $database_password,
     76            'database_host' => $database_host,
     77            'broker_host' => $broker_host,
     78            'celery_cache_host' => $celery_cache_host,
     79            'mapservice_tile_cache_dir' => $mapservice_tile_cache_dir,
     80        }),
     81    }
     82
     83    # Configure celery worker service
     84    file { '/var/lib/gnuboat/mapservice/docker_mapservice_celery/mapservice-celery.conf':
     85        ensure => file,
     86        content => epp('gnuboat_mapservice/mapservice_celery.conf.epp',
     87        {
     88            'mapservice_celery_nodes' => $mapservice_celery_nodes,
     89        }),
     90    }
     91    file { '/var/lib/gnuboat/mapservice/docker_mapservice_celery/mapservice_celery_entrypoint.sh':
     92        ensure => file,
     93        content => file('gnuboat_mapservice/mapservice_celery_entrypoint.sh'),
     94        mode => '0755',
     95    }
     96    file { '/var/lib/gnuboat/mapservice/docker_mapservice_celery/mapservice.conf':
     97        ensure => file,
     98        content => epp('gnuboat_mapservice/mapservice.conf.epp',
     99        {
     100            'database_name' => $database_name,
     101            'database_user' => $database_user,
     102            'database_password' => $database_password,
     103            'database_host' => $database_host,
     104            'broker_host' => $broker_host,
     105            'celery_cache_host' => $celery_cache_host,
     106            'mapservice_tile_cache_dir' => $mapservice_tile_cache_dir,
     107        }),
     108    }
     109
     110    file { '/var/lib/gnuboat/mapservice/docker_mapservice_celery/Dockerfile':
     111        ensure => file,
     112        content => epp('gnuboat_mapservice/mapservice_celery_dockerfile.epp',
     113        {
     114            'mapservice_tile_cache_dir' => $mapservice_tile_cache_dir,
     115        }),
     116    }
     117
     118    file { '/var/lib/gnuboat/mapservice/docker_mapservice_celery/gnuboat-keyring.gpg':
     119        ensure => file,
     120        content => file('gnuboat_mapservice/gnuboat-keyring.gpg'),
     121    }
     122
     123    file { '/var/lib/gnuboat/mapservice/docker_rabbitmq/Dockerfile':
     124        ensure => file,
     125        content => file('gnuboat_mapservice/mapservice_rabbitmq_dockerfile'),
     126    }
     127
     128    file { '/var/lib/gnuboat/mapservice/docker_memcached/Dockerfile':
     129        ensure => file,
     130        content => file('gnuboat_mapservice/mapservice_memcached_dockerfile'),
     131    }
     132
     133    file { '/var/lib/gnuboat/mapservice/gnuboat_mapservice_docker.yaml':
     134        ensure => file,
     135        content => epp('gnuboat_mapservice/gnuboat_mapservice.yaml.epp',
     136        {
     137            'database_name' => $database_name,
     138            'database_user' => $database_user,
     139            'database_password' => $database_password,
     140            'database_host' => $database_host,
     141            'broker_host' => $broker_host,
     142            'celery_cache_host' => $celery_cache_host,
     143            'mapservice_tile_cache_dir' => $mapservice_tile_cache_dir,
     144            'osm_tileserver_enabled' => $osm_tileserver_enabled,
     145        }),
     146    }
     147
     148
     149    if($osm_tileserver_enabled){
     150        file{'/var/lib/gnuboat/osm':
     151            ensure => directory,
     152        }
     153        file{'/var/lib/gnuboat/osm/database':
     154            ensure => directory,
     155        }
     156        file{'/var/lib/gnuboat/osm/tilecache':
     157            ensure => directory,
     158            owner => "33",
     159        }
     160        file{'/var/lib/gnuboat/osm/tilecache/.osmosis':
     161            ensure => directory,
     162            owner => "1000",
    11163        }
    12164
    13         unless File['/var/lib/gnuboat'] {
    14                 file { '/var/lib/gnuboat':
    15                         ensure => 'directory',
    16                 }
    17         }
    18         file { '/var/lib/gnuboat/mapservice':
    19                 ensure => 'directory',
    20         }
    21         file { '/var/lib/gnuboat/mapservice/rabbitmq':
    22                 ensure => 'directory',
     165        file{'/var/lib/gnuboat/mapservice/docker_osm':
     166            ensure => directory,
    23167        }
    24168
    25         file { '/var/lib/gnuboat/mapservice/docker_database':
    26                 ensure => 'directory',
    27         }
    28 
    29         file { '/var/lib/gnuboat/mapservice/docker_mapservice':
    30                 ensure => 'directory',
     169        file { '/var/lib/gnuboat/mapservice/docker_osm/Dockerfile':
     170            ensure => file,
     171            content => file('gnuboat_mapservice/osm_dockerfile'),
    31172        }
    32173
    33         file { '/var/lib/gnuboat/mapservice/docker_mapservice_celery':
    34                 ensure => 'directory',
    35         }
    36 
    37         file { '/var/lib/gnuboat/mapservice/docker_rabbitmq':
    38                 ensure => 'directory',
     174        file{'/var/lib/gnuboat/osm/data.osm.pbf':
     175            source => 'https://download.geofabrik.de/europe-latest.osm.pbf',
    39176        }
    40 
    41         file { '/var/lib/gnuboat/mapservice/docker_memcached':
    42                 ensure => 'directory',
    43         }
    44 
    45         file { '/var/lib/gnuboat/mapservice/docker_database/Dockerfile':
    46                 ensure => file,
    47                 content => file('gnuboat_mapservice/mapservice_database_dockerfile'),
    48         }
    49 
    50         file { '/var/lib/gnuboat/mapservice/docker_database/gnuboat_mapservice.sql':
    51                 ensure => file,
    52                 content => file('gnuboat_mapservice/gnuboat_mapservice.sql'),
    53         }
    54 
    55         file { '/var/lib/gnuboat/mapservice/docker_mapservice/Dockerfile':
    56                 ensure => file,
    57                 content => epp('gnuboat_mapservice/mapservice_mapservice_dockerfile.epp',
    58                 {
    59                         'mapservice_workers' => $mapservice_workers,
    60                         'mapservice_tile_cache_dir' => $mapservice_tile_cache_dir,
    61                 }),
    62         }
    63 
    64         file { '/var/lib/gnuboat/mapservice/docker_mapservice/gnuboat-keyring.gpg':
    65                 ensure => file,
    66                 content => file('gnuboat_mapservice/gnuboat-keyring.gpg'),
    67         }
    68 
    69         file { '/var/lib/gnuboat/mapservice/docker_mapservice/mapservice.conf':
    70                 ensure => file,
    71                 content => epp('gnuboat_mapservice/mapservice.conf.epp',
    72                 {
    73                         'database_name' => $database_name,
    74                         'database_user' => $database_user,
    75                         'database_password' => $database_password,
    76                         'database_host' => $database_host,
    77                         'broker_host' => $broker_host,
    78                         'celery_cache_host' => $celery_cache_host,
    79                         'mapservice_tile_cache_dir' => $mapservice_tile_cache_dir,
    80                 }),
    81         }
    82 
    83         # Configure celery worker service
    84         file { '/var/lib/gnuboat/mapservice/docker_mapservice_celery/mapservice-celery.conf':
    85                 ensure => file,
    86                 content => epp('gnuboat_mapservice/mapservice_celery.conf.epp',
    87                 {
    88                         'mapservice_celery_nodes' => $mapservice_celery_nodes,
    89                 }),
    90         }
    91         file { '/var/lib/gnuboat/mapservice/docker_mapservice_celery/mapservice_celery_entrypoint.sh':
    92                 ensure => file,
    93                 content => file('gnuboat_mapservice/mapservice_celery_entrypoint.sh'),
    94                 mode => '0755',
    95         }
    96         file { '/var/lib/gnuboat/mapservice/docker_mapservice_celery/mapservice.conf':
    97                 ensure => file,
    98                 content => epp('gnuboat_mapservice/mapservice.conf.epp',
    99                 {
    100                         'database_name' => $database_name,
    101                         'database_user' => $database_user,
    102                         'database_password' => $database_password,
    103                         'database_host' => $database_host,
    104                         'broker_host' => $broker_host,
    105                         'celery_cache_host' => $celery_cache_host,
    106                         'mapservice_tile_cache_dir' => $mapservice_tile_cache_dir,
    107                 }),
    108         }
    109 
    110         file { '/var/lib/gnuboat/mapservice/docker_mapservice_celery/Dockerfile':
    111                 ensure => file,
    112                 content => epp('gnuboat_mapservice/mapservice_celery_dockerfile.epp',
    113                 {
    114                         'mapservice_tile_cache_dir' => $mapservice_tile_cache_dir,
    115                 }),
    116         }
    117 
    118         file { '/var/lib/gnuboat/mapservice/docker_mapservice_celery/gnuboat-keyring.gpg':
    119                 ensure => file,
    120                 content => file('gnuboat_mapservice/gnuboat-keyring.gpg'),
    121         }
    122 
    123         file { '/var/lib/gnuboat/mapservice/docker_rabbitmq/Dockerfile':
    124                 ensure => file,
    125                 content => file('gnuboat_mapservice/mapservice_rabbitmq_dockerfile'),
    126         }
    127 
    128         file { '/var/lib/gnuboat/mapservice/docker_memcached/Dockerfile':
    129                 ensure => file,
    130                 content => file('gnuboat_mapservice/mapservice_memcached_dockerfile'),
    131         }
    132 
    133         file { '/var/lib/gnuboat/mapservice/gnuboat_mapservice_docker.yaml':
    134                 ensure => file,
    135                 content => epp('gnuboat_mapservice/gnuboat_mapservice.yaml.epp',
    136                         {
    137                                 'database_name' => $database_name,
    138                                 'database_user' => $database_user,
    139                                 'database_password' => $database_password,
    140                                 'database_host' => $database_host,
    141                                 'broker_host' => $broker_host,
    142                                 'celery_cache_host' => $celery_cache_host,
    143                                 'mapservice_tile_cache_dir' => $mapservice_tile_cache_dir,
    144                                 'osm_tileserver_enabled' => $osm_tileserver_enabled,
    145                         }
    146                 ),
    147         }
     177        notice("To import the dataset you need to import the database first")
     178        notice("cd /var/lib/gnuboat/mapservice && docker-compose -f gnuboat_mapservice_docker.yaml -p gnuboat_mapservice_host run gnuboat_osm import")
     179        notice("and restart the service with docker-compose -f gnuboat_mapservice_docker.yaml -p gnuboat_mapservice_host restart gnuboat_osm")
     180    }
    148181
    149182
    150         if($osm_tileserver_enabled){
    151                 file{'/var/lib/gnuboat/osm':
    152                         ensure => directory,
    153                 }
    154                 file{'/var/lib/gnuboat/osm/database':
    155                         ensure => directory,
    156                 }
    157                 file{'/var/lib/gnuboat/osm/tilecache':
    158                         ensure => directory,
    159                         owner => "33",
    160                 }
    161                 file{'/var/lib/gnuboat/osm/tilecache/.osmosis':
    162                         ensure => directory,
    163                         owner => "1000",
    164                 }
    165 
    166                 file{'/var/lib/gnuboat/mapservice/docker_osm':
    167                         ensure => directory,
    168                 }
    169 
    170                 file { '/var/lib/gnuboat/mapservice/docker_osm/Dockerfile':
    171                         ensure => file,
    172                         content => file('gnuboat_mapservice/osm_dockerfile'),
    173                 }
    174 
    175                 file{'/var/lib/gnuboat/osm/data.osm.pbf':
    176                         source => 'https://download.geofabrik.de/europe-latest.osm.pbf',
    177                 }
    178                 notice("To import the dataset you need to import the database first")
    179                 notice("cd /var/lib/gnuboat/mapservice && docker-compose -f gnuboat_mapservice_docker.yaml -p gnuboat_mapservice_host run gnuboat_osm import")
    180                 notice("and restart the service with docker-compose -f gnuboat_mapservice_docker.yaml -p gnuboat_mapservice_host restart gnuboat_osm")
    181         }
    182 
    183 
    184         docker_compose{'gnuboat_mapservice_host':
    185                 compose_files => ['/var/lib/gnuboat/mapservice/gnuboat_mapservice_docker.yaml'],
    186                 ensure => present,
    187                 scale => {
    188                         'gnuboat_mapservice_mapservice' => 1,
    189                 },
    190                 require => [
    191                         File['/var/lib/gnuboat/mapservice'],
    192                         File['/var/lib/gnuboat/mapservice/rabbitmq'],
    193                 ],
    194         }
     183    docker_compose{'gnuboat_mapservice_host':
     184        compose_files => ['/var/lib/gnuboat/mapservice/gnuboat_mapservice_docker.yaml'],
     185        ensure => present,
     186        scale => {
     187            'gnuboat_mapservice_mapservice' => 1,
     188        },
     189        require => [
     190            File['/var/lib/gnuboat/mapservice'],
     191            File['/var/lib/gnuboat/mapservice/rabbitmq'],
     192        ],
     193    }
    195194}
  • src/puppetcode/environments/gnuboat/modules/gnuboat_mapservice/manifests/init.pp

    rbc8139b r7dc03d6  
    11class gnuboat_mapservice
    22(
    3         Boolean $containerized = true,
    4         Boolean $mapservice_host = false,
     3    Boolean $containerized = true,
     4    Boolean $mapservice_host = false,
    55#       String $version = 'latest',
    6         String $database_name = 'gnuboat_mapservice',
    7         String $database_user = 'gnuboat_mapservice',
    8         String $database_password = extlib::random_password(42),
    9         String $database_host = "localhost",
    10         String $mapservice_version = 'latest',
    11         Integer $mapservice_workers = 1,
    12         Integer $mapservice_port = 8080,
    13         Integer $mapservice_celery_nodes = 2,
    14         String $broker_host = "localhost",
    15         String $celery_cache_host = "localhost",
    16         String $mapservice_tile_cache_dir = '/var/lib/gnuboat/tilescache',
    17         Boolean $apache_enabled = false,
    18         String $apache_vhost_name = "gnuboat_proxy",
    19         String $apache_vhost_servername = "localhost",
    20         String $apache_vhost_ssl_cert = '',
    21         String $apache_vhost_ssl_key = '',
    22         Boolean $apache_replace_default_host = false,
    23         Boolean $osm_tileserver_enabled= false,
     6    String $database_name = 'gnuboat_mapservice',
     7    String $database_user = 'gnuboat_mapservice',
     8    String $database_password = extlib::random_password(42),
     9    String $database_host = "localhost",
     10    String $mapservice_version = 'latest',
     11    Integer $mapservice_workers = 1,
     12    Integer $mapservice_port = 8080,
     13    Integer $mapservice_celery_nodes = 2,
     14    String $broker_host = "localhost",
     15    String $celery_cache_host = "localhost",
     16    String $mapservice_tile_cache_dir = '/var/lib/gnuboat/tilescache',
     17    Boolean $apache_enabled = false,
     18    String $apache_vhost_name = "gnuboat_proxy",
     19    String $apache_vhost_servername = "localhost",
     20    String $apache_vhost_ssl_cert = '',
     21    String $apache_vhost_ssl_key = '',
     22    Boolean $apache_replace_default_host = false,
     23    Boolean $osm_tileserver_enabled= false,
    2424)
    2525{
    26         if $gnuboat_type == "mapservice_host" {
    27                 contain gnuboat_mapservice::apache_config
    28                 if $containerized {
    29                         contain gnuboat_mapservice::host_install
    30                         contain gnuboat_mapservice::host_service
     26    if $gnuboat_type == "mapservice_host" {
     27        contain gnuboat_mapservice::apache_config
     28        containt gnuboat_mapservice::mapservice_webclient_install
     29        if $containerized {
     30            contain gnuboat_mapservice::host_install
     31            contain gnuboat_mapservice::host_service
    3132
    32                         Class['gnuboat_mapservice::host_install'] ->
    33                         Class['gnuboat_mapservice::apache_config'] ->
    34                         Class['gnuboat_mapservice::host_service']
    35                 }
    36                 else {
    37                         contain gnuboat_mapservice::mapservice_without_container_install
    38                         contain gnuboat_mapservice::mapservice_without_container_config
    39                         contain gnuboat_mapservice::mapservice_without_container_service
     33            Class['gnuboat_mapservice::host_install'] ->
     34            Class['gnuboat_mapservice::mapservice_webclient_install'] ->
     35            Class['gnuboat_mapservice::apache_config'] ->
     36            Class['gnuboat_mapservice::host_service']
     37        }
     38        else {
     39            contain gnuboat_mapservice::mapservice_without_container_install
     40            contain gnuboat_mapservice::mapservice_without_container_config
     41            contain gnuboat_mapservice::mapservice_without_container_service
    4042
    41                         Class['gnuboat_mapservice::mapservice_without_container_install'] ->
    42                         Class['gnuboat_mapservice::mapservice_without_container_config'] ->
    43                         Class['gnuboat_mapservice::apache_config'] ->
    44                         Class['gnuboat_mapservice::mapservice_without_container_service']
    45                 }
    46         }
    47 
    48         if $gnuboat_type == "mapservice_database" {
    49                 contain gnuboat_mapservice::database_install
    50 
    51                 Class['gnuboat_mapservice::database_install']
    52         }
    53 
    54         if $gnuboat_type == "mapservice_mapservice" {
    55                 contain gnuboat_mapservice::mapservice_install
    56 
    57                 Class['gnuboat_mapservice::mapservice_install']
    58         }
     43            Class['gnuboat_mapservice::mapservice_without_container_install'] ->
     44            Class['gnuboat_mapservice::mapservice_webclient_install'] ->
     45            Class['gnuboat_mapservice::mapservice_without_container_config'] ->
     46            Class['gnuboat_mapservice::apache_config'] ->
     47            Class['gnuboat_mapservice::mapservice_without_container_service']
     48        }
     49    }
    5950}
Note: See TracChangeset for help on using the changeset viewer.