Changeset 4fa6152 for src/puppetcode


Ignore:
Timestamp:
Jan 6, 2021, 8:33:50 PM (6 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
debian/bullseye, master
Children:
afe3f85
Parents:
e38db6b
Message:

Docker compose is now working with all container except the osm container

Location:
src/puppetcode/environments/gnuboat
Files:
57 added
1 deleted
8 edited

Legend:

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

    re38db6b r4fa6152  
    22classes:
    33  - gnuboat_mapservice
    4   - apt
    5   - postgresql::server
    6 #  - mysql::server
    7 #  - docker
    8 #  - docker::compose
     4  - docker
     5  - docker::compose
    96
    10 gnuboat_mapservice::containerized: false
     7gnuboat_mapservice::containerized: true
    118gnuboat_mapservice::database_name: 'gnuboat_mapservice'
    129gnuboat_mapservice::database_user: 'gnuboat_mapservice'
     10# A random password is set, if this is not set
    1311gnuboat_mapservice::database_password: 'Sr7DeuA7Db9fdve3Ywbf'
     12gnuboat_mapservice::mapservice_tile_cache_dir: '/var/lib/gnuboat/tilecache'
     13# Add a proxy vhost
    1414gnuboat_mapservice::apache_enabled: true
    15 apt::sources:
    16   'gnuboat':
    17     comment: 'GNUBoat repository'
    18     location: 'http://ftp.engsas.de/unstable/gnuboat/'
    19     release: 'bullseye'
    20     repos: 'main'
    21     key:
    22       id: 'B5FB30C861780282'
    23       server: 'pgp.mit.edu'
    24     include:
    25       src: true
    26       deb: true
    27 postgresql::server::postgis::package_ensure: 'present'
    28 #postgresql::server::roles:
    29 #   '%{gnuboat_mapservice::database_user}':
    30 #     ensure: 'present'
    31 #     login: true
    32 postgresql::server::extension:
    33   'postgis':
    34     ensure: present
    35     database: '%{gnuboat_mapservice::database_name}'
    36 postgresql::server::db:
    37   '%{gnuboat_mapservice::database_name}':
    38     user: '%{gnuboat_mapservice::database_user}'
    39     password_hash: '%{gnuboat_mapservice::database_password}'
    40 #docker::version: 'latest'
    41 #docker::ensure: 'present'
    42 #docker::use_upstream_package_source: true
    43 #docker::manage_package: true
    44 #docker::compose::ensure: 'present'
    45 #docker::compose::version: '1.26.1'
     15gnuboat_mapservice::apache_replace_default_host: true
     16#gnuboat_mapservice::apache_vhost_name: gnuboat.example.org
     17gnuboat_mapservice::osm_tileserver_enabled: false
     18docker::version: 'latest'
     19docker::ensure: 'present'
     20docker::use_upstream_package_source: true
     21docker::manage_package: true
     22docker::compose::ensure: 'present'
     23#docker::compose::version: 'latest'
    4624#docker::compose::compose_files:
    47 #  - '/tmp/gnuboat_mapservice.yaml'
    48 #docker::stack::ensure: 'present'
     25#  - '/var/lib/gnuboat/mapservice/gnuboat_mapservice.yaml'
     26docker::stack::ensure: 'present'
  • src/puppetcode/environments/gnuboat/modules/gnuboat_mapservice/files/gnuboat_mapservice.sql

    re38db6b r4fa6152  
    262262
    263263ALTER SEQUENCE public.processingstatus_id_seq OWNED BY public.processingstatus.id;
     264
     265
     266--
     267-- Data for Name: processingstatus; Type: TABLE DATA; Schema: public; Owner: -
     268--
     269
     270INSERT INTO public.processingstatus(id, label) VALUES (1, 'Undefined');
     271INSERT INTO public.processingstatus(id, label) VALUES (2, 'Queued for Parsing');
     272INSERT INTO public.processingstatus(id, label) VALUES (3, 'Parsing');
     273INSERT INTO public.processingstatus(id, label) VALUES (4, 'Queued for Processing');
     274INSERT INTO public.processingstatus(id, label) VALUES (5, 'Processing');
     275INSERT INTO public.processingstatus(id, label) VALUES (6, 'Deployed');
     276INSERT INTO public.processingstatus(id, label) VALUES (7, 'To Old');
     277INSERT INTO public.processingstatus(id, label) VALUES (8, 'Error');
    264278
    265279
  • src/puppetcode/environments/gnuboat/modules/gnuboat_mapservice/files/mapservice_database_dockerfile

    re38db6b r4fa6152  
    11FROM postgis/postgis
    2 #ARG FACTER_GNUBOAT_ROLE=GNUBOAT_MAPSERVICE_DATABASE
    3 #ADD puppet /etc/puppet
    4 #ADD database_run /usr/local/bin/
    5 #ADD database_setup.sql /tmp/
    6 #RUN chmod +x /etc/puppet/environments/gnuboat/configversion /usr/local/bin/database_run
    7 #RUN apt-get update && apt-get -y install puppet
    8 #RUN puppet apply --config /etc/puppet/gnuboat_puppet.conf --environment gnuboat /etc/puppet/environments/gnuboat/manifests/
    9 #RUN rm -rf /etc/puppet
    102WORKDIR /docker-entrypoint-initdb.d
    113ADD gnuboat_mapservice.sql /docker-entrypoint-initdb.d
    124VOLUME /var/lib/postgresql
    135EXPOSE 5432
    14 #CMD ["/usr/local/bin/database_run"]
  • src/puppetcode/environments/gnuboat/modules/gnuboat_mapservice/manifests/host_install.pp

    re38db6b r4fa6152  
    1 class gnuboat_mapservice::host_install inherits gnuboat_mapservice
     1class 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,
     6) inherits gnuboat_mapservice
    27{
    3         file { '/var/lib/gnuboat':
     8        file { extlib::dir_split($mapservice_tile_cache_dir):
    49                ensure => 'directory',
     10                mode => '0750',
    511        }
     12
     13        unless File['/var/lib/gnuboat'] {
     14                file { '/var/lib/gnuboat':
     15                        ensure => 'directory',
     16                }
     17        }
    618        file { '/var/lib/gnuboat/mapservice':
    719                ensure => 'directory',
    820        }
    9         file { '/var/lib/gnuboat/mapservice/database':
     21        file { '/var/lib/gnuboat/mapservice/rabbitmq':
     22                ensure => 'directory',
     23        }
     24
     25        file { '/var/lib/gnuboat/mapservice/docker_database':
    1026                ensure => 'directory',
    1127        }
    1228
    13         file { '/tmp/gnuboat_mapservice_database':
     29        file { '/var/lib/gnuboat/mapservice/docker_mapservice':
     30                ensure => 'directory',
     31        }
     32
     33        file { '/var/lib/gnuboat/mapservice/docker_mapservice_celery':
    1434                ensure => 'directory',
    1535        }
    1636
    17         file { '/tmp/gnuboat_mapservice_mapservice':
     37        file { '/var/lib/gnuboat/mapservice/docker_rabbitmq':
    1838                ensure => 'directory',
    1939        }
    2040
    21         file { '/tmp/gnuboat_mapservice_database/Dockerfile':
     41        file { '/var/lib/gnuboat/mapservice/docker_memcached':
     42                ensure => 'directory',
     43        }
     44
     45        file { '/var/lib/gnuboat/mapservice/docker_database/Dockerfile':
    2246                ensure => file,
    23                 path => '/tmp/gnuboat_mapservice_database/Dockerfile',
    2447                content => file('gnuboat_mapservice/mapservice_database_dockerfile'),
    2548        }
    2649
    27         file { '/tmp/gnuboat_mapservice_database/gnuboat_mapservice.sql':
     50        file { '/var/lib/gnuboat/mapservice/docker_database/gnuboat_mapservice.sql':
    2851                ensure => file,
    2952                content => file('gnuboat_mapservice/gnuboat_mapservice.sql'),
    3053        }
    3154
    32         file { '/tmp/gnuboat_mapservice_mapservice/Dockerfile':
     55        file { '/var/lib/gnuboat/mapservice/docker_mapservice/Dockerfile':
    3356                ensure => file,
    34                 path => '/tmp/gnuboat_mapservice_mapservice/Dockerfile',
    35                 content => file('gnuboat_mapservice/mapservice_mapservice_dockerfile'),
     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                }),
    3662        }
    3763
    38         file { '/tmp/gnuboat_mapservice_mapservice/gnuboat-keyring.gpg':
     64        file { '/var/lib/gnuboat/mapservice/docker_mapservice/gnuboat-keyring.gpg':
    3965                ensure => file,
    40                 path => '/tmp/gnuboat_mapservice_mapservice/gnuboat-keyring.gpg',
    4166                content => file('gnuboat_mapservice/gnuboat-keyring.gpg'),
    4267        }
    4368
    44 #       file { '/tmp/puppet':
    45 #               before => File['/tmp/gnuboat_mapservice_database/Dockerfile'],
    46 #               path => '/tmp/gnuboat_mapservice_database/puppet',
    47 #               source => '/etc/puppet',
    48 #               recurse => true,
    49 #       }
     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        }
    5082
    51         file { '/tmp/gnuboat_mapservice.yaml':
     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':
    52134                ensure => file,
    53135                content => epp('gnuboat_mapservice/gnuboat_mapservice.yaml.epp',
    … …  
    56138                                'database_user' => $database_user,
    57139                                '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,
    58145                        }
    59146                ),
    … …  
    61148
    62149        docker_compose{'gnuboat_mapservice_host':
    63                 require => File['/var/lib/gnuboat/mapservice/database'],
    64                 compose_files => ['/tmp/gnuboat_mapservice.yaml'],
     150                compose_files => ['/var/lib/gnuboat/mapservice/gnuboat_mapservice_docker.yaml'],
    65151                ensure => present,
    66152                scale => {
    67                         'gnuboat_mapservice_database' => 1,
     153                        'gnuboat_mapservice_mapservice' => 1,
    68154                },
     155                require => [
     156                        File['/var/lib/gnuboat/mapservice'],
     157                        File['/var/lib/gnuboat/mapservice/rabbitmq'],
     158                ],
    69159        }
    70 
    71 #       file { '/tmp/gnuboat_mapservice_database/database_setup.sql':
    72 #               ensure => file,
    73 #               content => epp('gnuboat_mapservice/mapservice_database.sql.epp',
    74 #                        {
    75 #                               'database_name' => $database_name,
    76 #                               'database_user' => $database_user,
    77 #                               'database_password' => $database_password,
    78 #                       }
    79 #              ),
    80 #       }
    81 
    82 #       file { '/tmp/gnuboat_mapservice_database/database_run':
    83 #               ensure => file,
    84 #               content => file('gnuboat_mapservice/mapservice_database_run'),
    85 #       }
    86160}
  • src/puppetcode/environments/gnuboat/modules/gnuboat_mapservice/manifests/init.pp

    re38db6b r4fa6152  
    66        String $database_name = 'gnuboat_mapservice',
    77        String $database_user = 'gnuboat_mapservice',
    8         String $database_password = 'Sr7DeuA7Db9fdve3Ywbf',
     8        String $database_password = extlib::random_password(42),
     9        String $database_host = "localhost",
    910        String $mapservice_version = 'latest',
    1011        Integer $mapservice_workers = 1,
    1112        Integer $mapservice_port = 8080,
    1213        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',
    1317        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,
    1424)
    1525{
    16 #       contain gnuboat_mapservice::config
    17 #       contain gnuboat_mapservice::service
    18 
    1926        if $gnuboat_type == "mapservice_host" {
     27                contain gnuboat_mapservice::apache_config
    2028                if $containerized {
    2129                        contain gnuboat_mapservice::host_install
    … …  
    2331
    2432                        Class['gnuboat_mapservice::host_install'] ->
    25                 #       Class['gnuboat_mapservice::config']
     33                        Class['gnuboat_mapservice::apache_config'] ->
    2634                        Class['gnuboat_mapservice::host_service']
    2735                }
    … …  
    3341                        Class['gnuboat_mapservice::mapservice_without_container_install'] ->
    3442                        Class['gnuboat_mapservice::mapservice_without_container_config'] ->
     43                        Class['gnuboat_mapservice::apache_config'] ->
    3544                        Class['gnuboat_mapservice::mapservice_without_container_service']
    3645                }
  • src/puppetcode/environments/gnuboat/modules/gnuboat_mapservice/manifests/mapservice_without_container_config.pp

    re38db6b r4fa6152  
    3939        }
    4040
    41 
    42         file { '/var/lib/gnuboat/tilescache':
    43                 ensure => 'directory',
    44                 owner => 'gnuboat',
    45                 group => 'gnuboat',
    46                 mode => '0750',
    47         }
    48 
    4941        # Configure mapservice itself
    5042        file { '/lib/systemd/system/gnuboat-mapservice.service':
    … …  
    6456                        'database_user' => $database_user,
    6557                        'database_password' => $database_password,
     58                        'broker_host' => $broker_host,
     59                        'celery_cache_host' => $celery_cache_host,
     60                        'mapservice_tile_cache_dir' => $mapservice_tile_cache_dir,
    6661                }),
    6762        }
    … …  
    10297                content => file('gnuboat_mapservice/gnuboat_mapservice_celery_beat.service'),
    10398        }
    104 
    105         # Configure apache, if wanted
    106         if($apache_enabled){
    107                 class {'apache':
    108                         default_vhost => false,
    109                 }
    110 
    111                 apache::vhost{'gnuboat_proxy':
    112                         port => '80',
    113                         docroot => '/var/www',
    114                         proxy_pass => [
    115                                 { path => '/', url => 'http://localhost:8080/' },
    116                         ],
    117                         suphp_engine => off,
    118                 }
    119         }
    12099}
  • src/puppetcode/environments/gnuboat/modules/gnuboat_mapservice/templates/gnuboat_mapservice.yaml.epp

    re38db6b r4fa6152  
    11<%- |   String $database_name,
    22        String $database_user,
    3         String $database_password | -%>
    4 version: "3.0"
     3        String $database_password,
     4        String $database_host,
     5        String $broker_host,
     6        String $celery_cache_host,
     7        String $mapservice_tile_cache_dir,
     8        Boolean osm_tileserver_enabled,
     9 | -%>
     10version: "2.0"
    511services:
    6   gnuboat_mapservice_database:
     12  <%= $database_host %>:
    713    environment:
    814      - POSTGRES_USER=<%= $database_name %>
    915      - POSTGRES_PASSWORD=<%= $database_password %>
    1016      - POSTGRES_DB=<%= $database_name %>
    11     build: gnuboat_mapservice_database/
     17      - PGDATA=/var/lib/postgresql/database/data
     18    build: docker_database/
    1219    expose:
    1320      - "5432"
    1421    volumes:
    15       - /var/lib/gnuboat/mapservice/database:/var/lib/postgresql
     22      - /var/lib/gnuboat/mapservice:/var/lib/postgresql
     23      - /var/log/gnuboat:/var/log/gnuboat
     24    restart: always
    1625  gnuboat_mapservice_mapservice:
    17     build: gnuboat_mapservice_mapservice/
     26    build: docker_mapservice/
    1827    expose:
    1928      - "8080"
     29    ports:
     30      - "8080:8080"
     31    volumes:
     32      - /var/log/gnuboat:/var/log/gnuboat
     33      - <%= $mapservice_tile_cache_dir %>:<%= $mapservice_tile_cache_dir %>
     34    depends_on:
     35      - <%= $database_host %>
     36      - <%= $broker_host %>
     37      - <%= $celery_cache_host %>
     38      - gnuboat_mapservice_celery
     39    restart: always
     40  gnuboat_mapservice_celery:
     41    build: docker_mapservice_celery/
     42    volumes:
     43      - <%= $mapservice_tile_cache_dir %>:<%= $mapservice_tile_cache_dir %>
     44      - /var/log/gnuboat:/var/log/gnuboat
     45    depends_on:
     46      - <%= $database_host %>
     47      - <%= $broker_host %>
     48      - <%= $celery_cache_host %>
     49    restart: always
     50  <%= $broker_host %>:
     51    build: docker_rabbitmq/
     52    hostname: 'gnuboat_mapservice_rabbitmq'
     53    volumes:
     54      - /var/lib/gnuboat/mapservice/rabbitmq:/var/lib/rabbitmq
     55    expose:
     56      - "5672"
     57    restart: always
     58  <%= $celery_cache_host %>:
     59    build: docker_memcached/
     60    expose:
     61      - "12211"
     62    restart: always
     63<% if $osm_tileserver_enabled { %>
     64  gnuboat_osm:
     65    enviornment:
     66      - UPDATES=enabled
     67    build: docker_osm/
     68    volumes:
     69      - /var/lib/gnuboat/osm/database:/var/lib/postgresql
     70      - /var/lib/gnuboat/osm/tilecache:/var/lib/mod_tile
     71      - /var/lib/gnuboat/osm/data.osm.pbf:/data.osm.pbf
     72    ports:
     73      - "8080:8081"
     74<% } %>
  • src/puppetcode/environments/gnuboat/modules/gnuboat_mapservice/templates/mapservice.conf.epp

    re38db6b r4fa6152  
    11<%- |   String $database_name,
    22        String $database_user,
    3         String $database_password | -%>
    4 SQLALCHEMY_DATABASE_URI: 'postgresql://<%= $database_user %>:<%= $database_password %>@localhost/<%= $database_name %>'
    5 TILES_CACHE_PATH: '/var/lib/gnuboat/tilecache'
     3        String $database_password,
     4        String $database_host,
     5        String $broker_host,
     6        String $celery_cache_host,
     7        String $mapservice_tile_cache_dir | -%>
     8SQLALCHEMY_DATABASE_URI: 'postgresql://<%= $database_user %>:<%= $database_password %>@<%= $database_host %>/<%= $database_name %>'
     9TILES_CACHE_PATH: '<%= $mapservice_tile_cache_dir %>'
     10CELERY_BROKER_URL: 'pyamqp://guest:guest@<%= $broker_host %>//'
     11CELERY_CACHE_BACKEND: 'memcached://<%= $celery_cache_host %>:11211'
Note: See TracChangeset for help on using the changeset viewer.