From eca3acb8e5ca79d944e3ce7be84dd7979afe5eed Mon Sep 17 00:00:00 2001 From: Roland Date: Sat, 19 Mar 2022 15:50:50 -0600 Subject: [PATCH] Moving install configs into etc directory. --- etc/debian11/000-default.conf | 39 +++++++++ etc/debian11/README.md | 1 + etc/debian11/index.html | 37 ++++++++ etc/debian11/ports.conf | 15 ++++ etc/debian11/renderd.conf | 18 ++++ etc/ubuntu20.04/000-default.conf | 39 +++++++++ etc/ubuntu20.04/index.html | 37 ++++++++ etc/ubuntu20.04/mod_tile.conf | 1 + etc/ubuntu20.04/ports.conf | 15 ++++ etc/ubuntu20.04/renderd.conf | 17 ++++ scripts/install_map_debian_11.sh | 131 ++-------------------------- scripts/install_map_ubuntu_20.04.sh | 129 ++------------------------- 12 files changed, 232 insertions(+), 247 deletions(-) create mode 100644 etc/debian11/000-default.conf create mode 100644 etc/debian11/README.md create mode 100644 etc/debian11/index.html create mode 100644 etc/debian11/ports.conf create mode 100644 etc/debian11/renderd.conf create mode 100644 etc/ubuntu20.04/000-default.conf create mode 100644 etc/ubuntu20.04/index.html create mode 100644 etc/ubuntu20.04/mod_tile.conf create mode 100644 etc/ubuntu20.04/ports.conf create mode 100644 etc/ubuntu20.04/renderd.conf diff --git a/etc/debian11/000-default.conf b/etc/debian11/000-default.conf new file mode 100644 index 00000000..4555d845 --- /dev/null +++ b/etc/debian11/000-default.conf @@ -0,0 +1,39 @@ + + # The ServerName directive sets the request scheme, hostname and port that + # the server uses to identify itself. This is used when creating + # redirection URLs. In the context of virtual hosts, the ServerName + # specifies what hostname must appear in the request's Host: header to + # match this virtual host. For the default virtual host (this file) this + # value is not decisive as it is used as a last resort host regardless. + # However, you must set it for any further virtual host explicitly. + #ServerName www.example.com + + ServerAdmin webmaster@localhost + + LoadTileConfigFile /etc/renderd.conf + ModTileRenderdSocketName /var/run/renderd/renderd.sock + # Timeout before giving up for a tile to be rendered + ModTileRequestTimeout 0 + # Timeout before giving up for a tile to be rendered that is otherwise missing + ModTileMissingRequestTimeout 30 + + DocumentRoot /var/www/html + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + +# vim: syntax=apache ts=4 sw=4 sts=4 sr noet diff --git a/etc/debian11/README.md b/etc/debian11/README.md new file mode 100644 index 00000000..7b9098f2 --- /dev/null +++ b/etc/debian11/README.md @@ -0,0 +1 @@ +The files in `etc` are files necessary to build an on-the-metal WROLPi. diff --git a/etc/debian11/index.html b/etc/debian11/index.html new file mode 100644 index 00000000..2ab8047f --- /dev/null +++ b/etc/debian11/index.html @@ -0,0 +1,37 @@ + + + + + + + + + + +
+ + + diff --git a/etc/debian11/ports.conf b/etc/debian11/ports.conf new file mode 100644 index 00000000..ddcbc031 --- /dev/null +++ b/etc/debian11/ports.conf @@ -0,0 +1,15 @@ +# If you just change the port or add more ports here, you will likely also +# have to change the VirtualHost statement in +# /etc/apache2/sites-enabled/000-default.conf + +Listen 8084 + + + Listen 443 + + + + Listen 443 + + +# vim: syntax=apache ts=4 sw=4 sts=4 sr noet diff --git a/etc/debian11/renderd.conf b/etc/debian11/renderd.conf new file mode 100644 index 00000000..21c6e68a --- /dev/null +++ b/etc/debian11/renderd.conf @@ -0,0 +1,18 @@ +[renderd] +stats_file=/run/renderd/renderd.stats +socketname=/run/renderd/renderd.sock +num_threads=4 +tile_dir=/var/cache/renderd/tiles + +[mapnik] +plugins_dir=/usr/lib/mapnik/3.1/input +font_dir=/usr/share/fonts/truetype +font_dir_recurse=true + +[ajt] +URI=/hot/ +TILEDIR=/var/lib/mod_tile +XML=/opt/openstreetmap-carto/mapnik.xml +HOST=localhost +TILESIZE=256 +MAXZOOM=20 diff --git a/etc/ubuntu20.04/000-default.conf b/etc/ubuntu20.04/000-default.conf new file mode 100644 index 00000000..06b39e80 --- /dev/null +++ b/etc/ubuntu20.04/000-default.conf @@ -0,0 +1,39 @@ + + # The ServerName directive sets the request scheme, hostname and port that + # the server uses to identify itself. This is used when creating + # redirection URLs. In the context of virtual hosts, the ServerName + # specifies what hostname must appear in the request's Host: header to + # match this virtual host. For the default virtual host (this file) this + # value is not decisive as it is used as a last resort host regardless. + # However, you must set it for any further virtual host explicitly. + #ServerName www.example.com + + ServerAdmin webmaster@localhost + + LoadTileConfigFile /usr/local/etc/renderd.conf + ModTileRenderdSocketName /var/run/renderd/renderd.sock + # Timeout before giving up for a tile to be rendered + ModTileRequestTimeout 0 + # Timeout before giving up for a tile to be rendered that is otherwise missing + ModTileMissingRequestTimeout 30 + + DocumentRoot /var/www/html + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + + +# vim: syntax=apache ts=4 sw=4 sts=4 sr noet diff --git a/etc/ubuntu20.04/index.html b/etc/ubuntu20.04/index.html new file mode 100644 index 00000000..2ab8047f --- /dev/null +++ b/etc/ubuntu20.04/index.html @@ -0,0 +1,37 @@ + + + + + + + + + + +
+ + + diff --git a/etc/ubuntu20.04/mod_tile.conf b/etc/ubuntu20.04/mod_tile.conf new file mode 100644 index 00000000..eb6b3301 --- /dev/null +++ b/etc/ubuntu20.04/mod_tile.conf @@ -0,0 +1 @@ +LoadModule tile_module /usr/lib/apache2/modules/mod_tile.so diff --git a/etc/ubuntu20.04/ports.conf b/etc/ubuntu20.04/ports.conf new file mode 100644 index 00000000..ddcbc031 --- /dev/null +++ b/etc/ubuntu20.04/ports.conf @@ -0,0 +1,15 @@ +# If you just change the port or add more ports here, you will likely also +# have to change the VirtualHost statement in +# /etc/apache2/sites-enabled/000-default.conf + +Listen 8084 + + + Listen 443 + + + + Listen 443 + + +# vim: syntax=apache ts=4 sw=4 sts=4 sr noet diff --git a/etc/ubuntu20.04/renderd.conf b/etc/ubuntu20.04/renderd.conf new file mode 100644 index 00000000..7ad24e2e --- /dev/null +++ b/etc/ubuntu20.04/renderd.conf @@ -0,0 +1,17 @@ +[renderd] +num_threads=4 +tile_dir=/var/lib/mod_tile +stats_file=/var/run/renderd/renderd.stats + +[mapnik] +plugins_dir=/usr/lib/mapnik/3.0/input +font_dir=/usr/share/fonts/truetype +font_dir_recurse=1 + +[ajt] +URI=/hot/ +TILEDIR=/var/lib/mod_tile +XML=/opt/openstreetmap-carto/mapnik.xml +HOST=localhost +TILESIZE=256 +MAXZOOM=20 diff --git a/scripts/install_map_debian_11.sh b/scripts/install_map_debian_11.sh index d2f1e14a..662ade1b 100755 --- a/scripts/install_map_debian_11.sh +++ b/scripts/install_map_debian_11.sh @@ -52,132 +52,15 @@ sudo -u wrolpi osm2pgsql -d gis --create --slim -G --hstore --tag-transform-scri -S /opt/openstreetmap-carto/openstreetmap-carto.style /tmp/district-of-columbia-latest.osm.pbf sudo -u wrolpi psql -d gis -f /opt/openstreetmap-carto/indexes.sql -cat >/etc/renderd.conf <<'EOF' -[renderd] -stats_file=/run/renderd/renderd.stats -socketname=/run/renderd/renderd.sock -num_threads=4 -tile_dir=/var/cache/renderd/tiles - -[mapnik] -plugins_dir=/usr/lib/mapnik/3.1/input -font_dir=/usr/share/fonts/truetype -font_dir_recurse=true - -[ajt] -URI=/hot/ -TILEDIR=/var/lib/mod_tile -XML=/opt/openstreetmap-carto/mapnik.xml -HOST=localhost -TILESIZE=256 -MAXZOOM=20 - -EOF - +cp /opt/wrolpi/etc/debian11/renderd.conf /etc/renderd.conf # Configure Apache2 to listen on 8084. -cat >/etc/apache2/ports.conf <<'EOF' -# If you just change the port or add more ports here, you will likely also -# have to change the VirtualHost statement in -# /etc/apache2/sites-enabled/000-default.conf - -Listen 8084 - - - Listen 443 - - - - Listen 443 - - -# vim: syntax=apache ts=4 sw=4 sts=4 sr noet -EOF - -cat >/etc/apache2/sites-available/000-default.conf <<'EOF' - - # The ServerName directive sets the request scheme, hostname and port that - # the server uses to identify itself. This is used when creating - # redirection URLs. In the context of virtual hosts, the ServerName - # specifies what hostname must appear in the request's Host: header to - # match this virtual host. For the default virtual host (this file) this - # value is not decisive as it is used as a last resort host regardless. - # However, you must set it for any further virtual host explicitly. - #ServerName www.example.com - - ServerAdmin webmaster@localhost - - LoadTileConfigFile /etc/renderd.conf - ModTileRenderdSocketName /var/run/renderd/renderd.sock - # Timeout before giving up for a tile to be rendered - ModTileRequestTimeout 0 - # Timeout before giving up for a tile to be rendered that is otherwise missing - ModTileMissingRequestTimeout 30 - - DocumentRoot /var/www/html - - # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, - # error, crit, alert, emerg. - # It is also possible to configure the loglevel for particular - # modules, e.g. - #LogLevel info ssl:warn - - ErrorLog ${APACHE_LOG_DIR}/error.log - CustomLog ${APACHE_LOG_DIR}/access.log combined - - # For most configuration files from conf-available/, which are - # enabled or disabled at a global level, it is possible to - # include a line for only one particular virtual host. For example the - # following line enables the CGI configuration for this host only - # after it has been globally disabled with "a2disconf". - #Include conf-available/serve-cgi-bin.conf - - -# vim: syntax=apache ts=4 sw=4 sts=4 sr noet -EOF - -cat >/var/www/html/index.html <<'EOF' - - - - - - - - - - -
- - - -EOF - +cp /opt/wrolpi/etc/debian11/ports.conf /etc/apache2/ports.conf +cp /opt/wrolpi/etc/debian11/000-defaults.conf /etc/apache2/sites-available/000-default.conf # Copy Leaflet files to Apache's directory so they can be used offline. -cp /opt/wrolpi/modules/map/leaflet.js /var/www/html/leaflet.js -cp /opt/wrolpi/modules/map/leaflet.css /var/www/html/leaflet.css +cp /opt/wrolpi/etc/debian11/index.html \ + /opt/wrolpi/modules/map/leaflet.js \ + /opt/wrolpi/modules/map/leaflet.css /var/www/html/ +chmod 644 /var/www/html/* systemctl enable renderd systemctl stop renderd diff --git a/scripts/install_map_ubuntu_20.04.sh b/scripts/install_map_ubuntu_20.04.sh index 79e6b085..2f337196 100755 --- a/scripts/install_map_ubuntu_20.04.sh +++ b/scripts/install_map_ubuntu_20.04.sh @@ -85,133 +85,16 @@ fi set -e -cat >/usr/local/etc/renderd.conf <<'EOF' -[renderd] -num_threads=4 -tile_dir=/var/lib/mod_tile -stats_file=/var/run/renderd/renderd.stats - -[mapnik] -plugins_dir=/usr/lib/mapnik/3.0/input -font_dir=/usr/share/fonts/truetype -font_dir_recurse=1 - -[ajt] -URI=/hot/ -TILEDIR=/var/lib/mod_tile -XML=/opt/openstreetmap-carto/mapnik.xml -HOST=localhost -TILESIZE=256 -MAXZOOM=20 -EOF - +cp /opt/wrolpi/etc/ubuntu20.04/rendred.conf /usr/local/etc/renderd.conf # Enable mod_tile. -cat >>/etc/apache2/conf-available/mod_tile.conf <<'EOF' -LoadModule tile_module /usr/lib/apache2/modules/mod_tile.so -EOF +cp /opt/wrolpi/etc/ubuntu20.04/mod_tile.conf /etc/apache2/conf-available/mod_tile.conf + /usr/sbin/a2enconf mod_tile # Configure Apache2 to listen on 8084. -cat >/etc/apache2/ports.conf <<'EOF' -# If you just change the port or add more ports here, you will likely also -# have to change the VirtualHost statement in -# /etc/apache2/sites-enabled/000-default.conf - -Listen 8084 - - - Listen 443 - - - - Listen 443 - - -# vim: syntax=apache ts=4 sw=4 sts=4 sr noet -EOF - -cat >/etc/apache2/sites-available/000-default.conf <<'EOF' - - # The ServerName directive sets the request scheme, hostname and port that - # the server uses to identify itself. This is used when creating - # redirection URLs. In the context of virtual hosts, the ServerName - # specifies what hostname must appear in the request's Host: header to - # match this virtual host. For the default virtual host (this file) this - # value is not decisive as it is used as a last resort host regardless. - # However, you must set it for any further virtual host explicitly. - #ServerName www.example.com - - ServerAdmin webmaster@localhost - - LoadTileConfigFile /usr/local/etc/renderd.conf - ModTileRenderdSocketName /var/run/renderd/renderd.sock - # Timeout before giving up for a tile to be rendered - ModTileRequestTimeout 0 - # Timeout before giving up for a tile to be rendered that is otherwise missing - ModTileMissingRequestTimeout 30 - - DocumentRoot /var/www/html - - # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, - # error, crit, alert, emerg. - # It is also possible to configure the loglevel for particular - # modules, e.g. - #LogLevel info ssl:warn - - ErrorLog ${APACHE_LOG_DIR}/error.log - CustomLog ${APACHE_LOG_DIR}/access.log combined - - # For most configuration files from conf-available/, which are - # enabled or disabled at a global level, it is possible to - # include a line for only one particular virtual host. For example the - # following line enables the CGI configuration for this host only - # after it has been globally disabled with "a2disconf". - #Include conf-available/serve-cgi-bin.conf - - -# vim: syntax=apache ts=4 sw=4 sts=4 sr noet -EOF - -cat >/var/www/html/index.html <<'EOF' - - - - - - - - - - -
- - - -EOF - +cp /opt/wrolpi/etc/ubuntu20.04/ports.conf /etc/apache2/ports.conf +cp /opt/wrolpi/etc/ubuntu20.04/000-default.conf /etc/apache2/sites-available/000-default.conf +cp /opt/wrolpi/etc/ubuntu20.04/index.html /var/www/html/index.html # Copy Leaflet files to Apache's directory so they can be used offline. cp /opt/wrolpi/modules/map/leaflet.js /var/www/html/leaflet.js cp /opt/wrolpi/modules/map/leaflet.css /var/www/html/leaflet.css