I am having an odd issue with Ansible and connecting to a host (any host) and hoping someone can see something I'm not. I can ssh directly to the host w/o any issue. I can run -m ping w/o issue. But that's where success ends. If I run a -m setup it appears to connect and gather some info, but subsequent connections fail.
This is a server spun up on Proxmox (7.2.11). I've done this 100's of times w/o issue. That's why I can't seen to identify what has changed. I typically spin up a container and set up w/ a ssh key (requiring passphrase) for root. If a VM, I simply copy the public key to the root users authorized_keys. Then run ansible playbook to add the user(s) and services along with locking down ssh. So my playbooks initially run using the root user. Ansible has always prompted for the passphrase and then go along it's merry way.
I'm using pipelining, but I've set to false in testing.
Appreciate any insight you may have... Thank you
Here's the output of a simple gather facts. You can see that the first two SSH: EXEC return a result, but the third connection hangs.
➜ ansible git:(main) ✗ ansible all -vvv -i ./inventory.yml -m setup
ansible 2.10.8
config file = /home/johndoe/NAS1-Mounts/Code/ansible/ansible.cfg
configured module search path = ['/home/johndoe/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0]
Using /home/johndoe/NAS1-Mounts/Code/ansible/ansible.cfg as config file
host_list declined parsing /home/johndoe/NAS1-Mounts/Code/ansible/inventory.yml as it did not pass its verify_file() method
script declined parsing /home/johndoe/NAS1-Mounts/Code/ansible/inventory.yml as it did not pass its verify_file() method
Parsed /home/johndoe/NAS1-Mounts/Code/ansible/inventory.yml inventory source with ini plugin
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
META: ran handlers
<target_server> Attempting python interpreter discovery
<10.2.0.27> ESTABLISH SSH CONNECTION FOR USER: root
<10.2.0.27> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/home/johndoe/.dotfiles/ansible/.ansible/cp/27e670244a 10.2.0.27 '/bin/sh -c '"'"'echo PLATFORM; uname; echo FOUND; command -v '"'"'"'"'"'"'"'"'/usr/bin/python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.9'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.8'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.5'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/libexec/platform-python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/bin/python3'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python'"'"'"'"'"'"'"'"'; echo ENDFOUND && sleep 0'"'"''
<10.2.0.27> (0, b'PLATFORM\nLinux\nFOUND\n/usr/bin/python3\nENDFOUND\n', b'')
<10.2.0.27> ESTABLISH SSH CONNECTION FOR USER: root
<10.2.0.27> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/home/johndoe/.dotfiles/ansible/.ansible/cp/27e670244a 10.2.0.27 '/bin/sh -c '"'"'/usr/bin/python3 && sleep 0'"'"''
<10.2.0.27> (0, b'{"platform_dist_result": [], "osrelease_content": "PRETTY_NAME=\\"Ubuntu 22.04.1 LTS\\"\\nNAME=\\"Ubuntu\\"\\nVERSION_ID=\\"22.04\\"\\nVERSION=\\"22.04.1 LTS (Jammy Jellyfish)\\"\\nVERSION_CODENAME=jammy\\nID=ubuntu\\nID_LIKE=debian\\nHOME_URL=\\"https://www.ubuntu.com/\\"\\nSUPPORT_URL=\\"https://help.ubuntu.com/\\"\\nBUG_REPORT_URL=\\"https://bugs.launchpad.net/ubuntu/\\"\\nPRIVACY_POLICY_URL=\\"https://www.ubuntu.com/legal/terms-and-policies/privacy-policy\\"\\nUBUNTU_CODENAME=jammy\\n"}\n', b'')
Using module file /usr/lib/python3/dist-packages/ansible/modules/setup.py
Pipelining is enabled.
<10.2.0.27> ESTABLISH SSH CONNECTION FOR USER: root
<10.2.0.27> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/home/johndoe/.dotfiles/ansible/.ansible/cp/27e670244a 10.2.0.27 '/bin/sh -c '"'"'/usr/bin/python3 && sleep 0'"'"''
^C [ERROR]: User interrupted execution
➜ ansible git:(main) ✗
-m ping
➜ ansible git:(main) ✗ ansible all -vvv -i ./inventory.yml -m ping
ansible 2.10.8
config file = /home/johndoe/NAS1-Mounts/Code/ansible/ansible.cfg
configured module search path = ['/home/johndoe/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0]
Using /home/johndoe/NAS1-Mounts/Code/ansible/ansible.cfg as config file
host_list declined parsing /home/johndoe/NAS1-Mounts/Code/ansible/inventory.yml as it did not pass its verify_file() method
script declined parsing /home/johndoe/NAS1-Mounts/Code/ansible/inventory.yml as it did not pass its verify_file() method
Parsed /home/johndoe/NAS1-Mounts/Code/ansible/inventory.yml inventory source with ini plugin
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
META: ran handlers
<target_server> Attempting python interpreter discovery
<10.2.0.27> ESTABLISH SSH CONNECTION FOR USER: root
<10.2.0.27> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/home/johndoe/.dotfiles/ansible/.ansible/cp/27e670244a 10.2.0.27 '/bin/sh -c '"'"'echo PLATFORM; uname; echo FOUND; command -v '"'"'"'"'"'"'"'"'/usr/bin/python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.9'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.8'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.5'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/libexec/platform-python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/bin/python3'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python'"'"'"'"'"'"'"'"'; echo ENDFOUND && sleep 0'"'"''
<10.2.0.27> (0, b'PLATFORM\nLinux\nFOUND\n/usr/bin/python3\nENDFOUND\n', b'')
<10.2.0.27> ESTABLISH SSH CONNECTION FOR USER: root
<10.2.0.27> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/home/johndoe/.dotfiles/ansible/.ansible/cp/27e670244a 10.2.0.27 '/bin/sh -c '"'"'/usr/bin/python3 && sleep 0'"'"''
<10.2.0.27> (0, b'{"platform_dist_result": [], "osrelease_content": "PRETTY_NAME=\\"Ubuntu 22.04.1 LTS\\"\\nNAME=\\"Ubuntu\\"\\nVERSION_ID=\\"22.04\\"\\nVERSION=\\"22.04.1 LTS (Jammy Jellyfish)\\"\\nVERSION_CODENAME=jammy\\nID=ubuntu\\nID_LIKE=debian\\nHOME_URL=\\"https://www.ubuntu.com/\\"\\nSUPPORT_URL=\\"https://help.ubuntu.com/\\"\\nBUG_REPORT_URL=\\"https://bugs.launchpad.net/ubuntu/\\"\\nPRIVACY_POLICY_URL=\\"https://www.ubuntu.com/legal/terms-and-policies/privacy-policy\\"\\nUBUNTU_CODENAME=jammy\\n"}\n', b'')
Using module file /usr/lib/python3/dist-packages/ansible/modules/ping.py
Pipelining is enabled.
<10.2.0.27> ESTABLISH SSH CONNECTION FOR USER: root
<10.2.0.27> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o ControlPath=/home/johndoe/.dotfiles/ansible/.ansible/cp/27e670244a 10.2.0.27 '/bin/sh -c '"'"'/usr/bin/python3 && sleep 0'"'"''
<10.2.0.27> (0, b'\n{"ping": "pong", "invocation": {"module_args": {"data": "pong"}}}\n', b'')
target_server | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"invocation": {
"module_args": {
"data": "pong"
}
},
"ping": "pong"
}
META: ran handlers
META: ran handlers
ansible.cfg
➜ ansible git:(main) ✗ cat ansible.cfg
[default]
inventory = /home/johndoe/NAS1-Mounts/Code/ansible/inventory.yml
# Use the Beautiful Output callback plugin.
stdout_callback = beautiful_output
# Use specific ssh key and user
# ed25519 w/ passphrase
private_key = /home/johndoe/.ssh/johndoe_default
host_key_checking = False
# For updates/maintenance as sudo user
remote_user = johndoe
# Set remote host working directory
remote_tmp = ~/.ansible/tmp
# Misc
allow_world_readable_tmpfiles = True
display_skipped_hosts = False
# display_args_to_stdout = True
# stdout_callback = full_skip
transport = ssh
[ssh_connection]
pipelining = True
timeout = 30
[connection]
pipelining = True
my inventory.yml
➜ ansible git:(main) ✗ cat inventory.yml
# Vagrant Host
#default
[workstation]
[server]
target_server ansible_user=root ansible_host=10.2.0.27 install_docker=true
[pve_container]
my .ssh/config file
➜ ansible git:(main) ✗ cat ~/.ssh/config
# Defaults
Host *
# Default ed25519 Keypair for all connections - unless otherwise specified
IdentityFile ~/.ssh/johndoe_default
IdentitiesOnly yes
# Always use multiplex'd sessions - unless otherwise specified in host def below
Controlmaster auto
ControlPersist yes
Controlpath /tmp/ssh-%r#%h:%p
ControlPersist 10m
ssh directly to host
➜ ansible git:(main) ✗ ssh root#10.2.0.27
Welcome to Ubuntu 22.04.1 LTS (GNU/Linux 5.15.0-56-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Wed Dec 14 05:06:20 PM UTC 2022
System load: 0.0 Processes: 117
Usage of /: 31.8% of 14.66GB Users logged in: 1
Memory usage: 11% IPv4 address for ens18: 10.2.0.27
Swap usage: 0%
50 updates can be applied immediately.
To see these additional updates run: apt list --upgradable
Last login: Wed Dec 14 17:05:53 2022 from 10.0.2.5
root#ubuntu-ansible-test:~#
My apologies for wasting anyone's time. My issue turned out to be a MTU issue with the Tunnel to the remote site. Someone set it up with 1500 on the wireguard tunnel. A packet capture pcap showed a bunch of TCP Out or order, TCP Dup ACK and TCP Retransmission. Setting back to 1420 cured the issue.
Best
I'm using OpenStreetMap tile server # the https://github.com/Overv/openstreetmap-tile-server to host my own tile server.
I run the container with the following command and it runs without error, however when I try to view the web page at localhost:8080 the map tiles do not load. When I view the network tab I can see they are getting a 404 error:
PS C:\Development\Uni> docker run -p 8080:80 -v openstreetmap-data:/var/lib/postgres/12/main -d overv/openstreetmap-tile-server run
I got a copy of the Docker logs to find out what was happening there:
+ '[' 1 -ne 1 ']'
+ '[' run = import ']'
+ '[' run = run ']'
+ rm -rf /tmp/hsperfdata_root
+ chown postgres:postgres /var/lib/postgresql -R
+ '[' '' == enabled ']'
+ '[' '' == 1 ']'
+ createPostgresConfig
+ cp /etc/postgresql/12/main/postgresql.custom.conf.tmpl /etc/postgresql/12/main/conf.d/postgresql.custom.conf
+ sudo -u postgres echo 'autovacuum = on'
+ cat /etc/postgresql/12/main/conf.d/postgresql.custom.conf
# Suggested minimal settings from
# https://ircama.github.io/osm-carto-tutorials/tile-server-ubuntu/
shared_buffers = 128MB
min_wal_size = 1GB
max_wal_size = 2GB
maintenance_work_mem = 256MB
# Suggested settings from
# https://github.com/openstreetmap/chef/blob/master/roles/tile.rb#L38-L45
max_connections = 250
temp_buffers = 32MB
work_mem = 128MB
wal_buffers = 1024kB
wal_writer_delay = 500ms
commit_delay = 10000
# checkpoint_segments = 60 # unrecognized in psql 10.7.1
max_wal_size = 2880MB
random_page_cost = 1.1
track_activity_query_size = 16384
autovacuum_vacuum_scale_factor = 0.05
autovacuum_analyze_scale_factor = 0.02
listen_addresses = '*'
autovacuum = on
+ service postgresql start
* Starting PostgreSQL 12 database server
...done.
+ service apache2 restart
* Restarting Apache httpd web server apache2
[Mon Apr 27 20:29:40.317813 2020] [tile:notice] [pid 68:tid 140528325397440] Loading tile config ajt at /tile/ for zooms 0 - 20 from tile directory /var/lib/mod_tile with extension .png and mime type image/png
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
...done.
+ setPostgresPassword
+ sudo -u postgres psql -c 'ALTER USER renderer PASSWORD '\''renderer'\'''
ERROR: role "renderer" does not exist
+ sed -i -E 's/num_threads=[0-9]+/num_threads=4/g' /usr/local/etc/renderd.conf
+ '[' disabled = enabled ']'
+ '[' disabled = 1 ']'
+ trap stop_handler SIGTERM
+ child=144
+ wait 144
+ sudo -u renderer renderd -f -c /usr/local/etc/renderd.conf
renderd[145]: Rendering daemon started
renderd[145]: Initiating request_queue
renderd[145]: Parsing section renderd
renderd[145]: Parsing render section 0
renderd[145]: Parsing section mapnik
renderd[145]: Parsing section ajt
renderd[145]: config renderd: unix socketname=/var/run/renderd/renderd.sock
renderd[145]: config renderd: num_threads=4
renderd[145]: config renderd: num_slaves=0
renderd[145]: config renderd: tile_dir=/var/lib/mod_tile
renderd[145]: config renderd: stats_file=/var/run/renderd/renderd.stats
renderd[145]: config mapnik: plugins_dir=/usr/lib/mapnik/3.0/input
renderd[145]: config mapnik: font_dir=/usr/share/fonts
renderd[145]: config mapnik: font_dir_recurse=1
renderd[145]: config renderd(0): Active
renderd[145]: config renderd(0): unix socketname=/var/run/renderd/renderd.sock
renderd[145]: config renderd(0): num_threads=4
renderd[145]: config renderd(0): tile_dir=/var/lib/mod_tile
renderd[145]: config renderd(0): stats_file=/var/run/renderd/renderd.stats
renderd[145]: config map 0: name(ajt) file(/home/renderer/src/openstreetmap-carto/mapnik.xml) uri(/tile/) htcp() host(localhost)
renderd[145]: Initialising unix server socket on /var/run/renderd/renderd.sock
renderd[145]: Created server socket 3
renderd[145]: Renderd is using mapnik version 3.0.19
renderd[145]: DEBUG: Loading font: /usr/share/fonts/truetype/noto/NotoSansDisplay-Italic.ttf
...
...
...
renderd[145]: DEBUG: Loading font: /usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc
Running in foreground mode...
renderd[145]: Starting stats thread
debug: init_storage_backend: initialising file storage backend at: /var/lib/mod_tile
renderd[145]: Loading parameterization function for
debug: init_storage_backend: initialising file storage backend at: /var/lib/mod_tile
renderd[145]: Loading parameterization function for
debug: init_storage_backend: initialising file storage backend at: /var/lib/mod_tile
renderd[145]: Loading parameterization function for
debug: init_storage_backend: initialising file storage backend at: /var/lib/mod_tile
renderd[145]: Loading parameterization function for
Mapnik LOG> 2020-04-27 20:29:41: warning: unable to find face-name 'Noto Serif Tibetan Regular' in FontSet 'fontset-0'
...
...
...
Mapnik LOG> 2020-04-27 20:29:41: warning: unable to find face-name 'unifont Medium' in FontSet 'fontset-2'
renderd[145]: An error occurred while loading the map layer 'ajt': Postgis Plugin: FATAL: role "renderer" does not exist
Connection string: ' dbname=gis connect_timeout=4'
encountered during parsing of layer 'landcover-low-zoom' in Layer at line 825 of '/home/renderer/src/openstreetmap-carto/mapnik.xml'
renderd[145]: An error occurred while loading the map layer 'ajt': Postgis Plugin: FATAL: role "renderer" does not exist
Connection string: ' dbname=gis connect_timeout=4'
encountered during parsing of layer 'landcover-low-zoom' in Layer at line 825 of '/home/renderer/src/openstreetmap-carto/mapnik.xml'
renderd[145]: An error occurred while loading the map layer 'ajt': Postgis Plugin: FATAL: role "renderer" does not exist
Connection string: ' dbname=gis connect_timeout=4'
encountered during parsing of layer 'landcover-low-zoom' in Layer at line 825 of '/home/renderer/src/openstreetmap-carto/mapnik.xml'
renderd[145]: An error occurred while loading the map layer 'ajt': Postgis Plugin: FATAL: role "renderer" does not exist
Connection string: ' dbname=gis connect_timeout=4'
encountered during parsing of layer 'landcover-low-zoom' in Layer at line 825 of '/home/renderer/src/openstreetmap-carto/mapnik.xml'
Hopefully someone can make more sense of it than me but I did notice the following lines looked suspect:
+ sudo -u postgres psql -c 'ALTER USER renderer PASSWORD '\''renderer'\'''
ERROR: role "renderer" does not exist
renderd[145]: An error occurred while loading the map layer 'ajt': Postgis Plugin: FATAL: role "renderer" does not exist
Connection string: ' dbname=gis connect_timeout=4'
encountered during parsing of layer 'landcover-low-zoom' in Layer at line 825 of '/home/renderer/src/openstreetmap-carto/mapnik.xml'
I think it is an issue with the Docker install so this is the Docker file for reference (also I'm using Docker for Windows):
FROM ubuntu:18.04
# Based on
# https://switch2osm.org/manually-building-a-tile-server-18-04-lts/
# Set up environment
ENV TZ=UTC
ENV AUTOVACUUM=on
ENV UPDATES=disabled
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Install dependencies
RUN apt-get update \
&& apt-get install wget gnupg2 lsb-core -y \
&& wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& echo "deb [ trusted=yes ] https://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list \
&& apt-get update \
&& apt-get install -y apt-transport-https ca-certificates
RUN apt-get install -y curl \
&& wget --quiet -O - https://deb.nodesource.com/setup_10.x | bash - \
&& apt-get install -y nodejs
RUN apt-get install -y --no-install-recommends \
apache2 \
apache2-dev \
autoconf \
build-essential \
bzip2 \
cmake \
cron \
fonts-noto-cjk \
fonts-noto-hinted \
fonts-noto-unhinted \
gcc \
gdal-bin \
git-core \
libagg-dev \
libboost-filesystem-dev \
libboost-system-dev \
libbz2-dev \
libcairo-dev \
libcairomm-1.0-dev \
libexpat1-dev \
libfreetype6-dev \
libgdal-dev \
libgeos++-dev \
libgeos-dev \
libgeotiff-epsg \
libicu-dev \
liblua5.3-dev \
libmapnik-dev \
libpq-dev \
libproj-dev \
libprotobuf-c0-dev \
libtiff5-dev \
libtool \
libxml2-dev \
lua5.3 \
make \
mapnik-utils \
node-gyp \
osmium-tool \
osmosis \
postgis \
postgresql-12 \
postgresql-contrib-12 \
postgresql-server-dev-12 \
protobuf-c-compiler \
python3-mapnik \
python3-lxml \
python3-psycopg2 \
python3-shapely \
sudo \
tar \
ttf-unifont \
unzip \
wget \
zlib1g-dev \
&& apt-get clean autoclean \
&& apt-get autoremove --yes \
&& rm -rf /var/lib/{apt,dpkg,cache,log}/
# Set up PostGIS
RUN wget https://download.osgeo.org/postgis/source/postgis-3.0.0.tar.gz -O postgis.tar.gz \
&& mkdir -p postgis_src \
&& tar -xvzf postgis.tar.gz --strip 1 -C postgis_src \
&& rm postgis.tar.gz \
&& cd postgis_src \
&& ./configure && make && make install \
&& cd .. && rm -rf postgis_src
# Set up renderer user
RUN adduser --disabled-password --gecos "" renderer
# Install latest osm2pgsql
RUN mkdir -p /home/renderer/src \
&& cd /home/renderer/src \
&& git clone https://github.com/openstreetmap/osm2pgsql.git \
&& cd /home/renderer/src/osm2pgsql \
&& rm -rf .git \
&& mkdir build \
&& cd build \
&& cmake .. \
&& make -j $(nproc) \
&& make install \
&& mkdir /nodes \
&& chown renderer:renderer /nodes \
&& rm -rf /home/renderer/src/osm2pgsql
# Install mod_tile and renderd
RUN mkdir -p /home/renderer/src \
&& cd /home/renderer/src \
&& git clone -b switch2osm https://github.com/SomeoneElseOSM/mod_tile.git \
&& cd mod_tile \
&& ./autogen.sh \
&& ./configure \
&& make -j $(nproc) \
&& make -j $(nproc) install \
&& make -j $(nproc) install-mod_tile \
&& ldconfig \
&& cd ..
# Configure stylesheet
RUN mkdir -p /home/renderer/src \
&& cd /home/renderer/src \
&& git clone https://github.com/gravitystorm/openstreetmap-carto.git \
&& git -C openstreetmap-carto checkout v4.23.0 \
&& cd openstreetmap-carto \
&& rm -rf .git \
&& npm install -g carto#0.18.2 \
&& carto project.mml > mapnik.xml \
&& scripts/get-shapefiles.py \
&& rm /home/renderer/src/openstreetmap-carto/data/*.zip
# Configure renderd
RUN sed -i 's/renderaccount/renderer/g' /usr/local/etc/renderd.conf \
&& sed -i 's/\/truetype//g' /usr/local/etc/renderd.conf \
&& sed -i 's/hot/tile/g' /usr/local/etc/renderd.conf
# Configure Apache
RUN mkdir /var/lib/mod_tile \
&& chown renderer /var/lib/mod_tile \
&& mkdir /var/run/renderd \
&& chown renderer /var/run/renderd \
&& echo "LoadModule tile_module /usr/lib/apache2/modules/mod_tile.so" >> /etc/apache2/conf-available/mod_tile.conf \
&& echo "LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so" >> /etc/apache2/conf-available/mod_headers.conf \
&& a2enconf mod_tile && a2enconf mod_headers
COPY apache.conf /etc/apache2/sites-available/000-default.conf
COPY leaflet-demo.html /var/www/html/index.html
RUN ln -sf /dev/stdout /var/log/apache2/access.log \
&& ln -sf /dev/stderr /var/log/apache2/error.log
# Configure PosgtreSQL
COPY postgresql.custom.conf.tmpl /etc/postgresql/12/main/
RUN chown -R postgres:postgres /var/lib/postgresql \
&& chown postgres:postgres /etc/postgresql/12/main/postgresql.custom.conf.tmpl \
&& echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/12/main/pg_hba.conf \
&& echo "host all all ::/0 md5" >> /etc/postgresql/12/main/pg_hba.conf
# Copy update scripts
COPY openstreetmap-tiles-update-expire /usr/bin/
RUN chmod +x /usr/bin/openstreetmap-tiles-update-expire \
&& mkdir /var/log/tiles \
&& chmod a+rw /var/log/tiles \
&& ln -s /home/renderer/src/mod_tile/osmosis-db_replag /usr/bin/osmosis-db_replag \
&& echo "* * * * * renderer openstreetmap-tiles-update-expire\n" >> /etc/crontab
# Install trim_osc.py helper script
RUN mkdir -p /home/renderer/src \
&& cd /home/renderer/src \
&& git clone https://github.com/zverik/regional \
&& cd regional \
&& git checkout 612fe3e040d8bb70d2ab3b133f3b2cfc6c940520 \
&& rm -rf .git \
&& chmod u+x /home/renderer/src/regional/trim_osc.py
# Start running
COPY run.sh /
COPY indexes.sql /
ENTRYPOINT ["/run.sh"]
CMD []
EXPOSE 80 5432
I would recommend using a different volume name from the example provided as this worked for me.
I use these setup options on the latest version. Everything works :
docker run -e DOWNLOAD_PBF=http://download.geofabrik.de/europe-latest.osm.pbf -v map-data:/var/lib/postgresql/14/main overv/openstreetmap-tile-server import
then
docker run -p 8080:80 -v openstreetmap-data:/var/lib/postgresql/14/main -d overv/openstreetmap-tile-server run.
I'm trying to build a customized postgres replication cluster in docker. I'm using postgres:9.6-alpine as my base image.
Here is my Dockerfiles which I'm using to build the slave container.
// Dockerfile
FROM postgres:9.6-alpine
ENV GOSU_VERSION 1.10
RUN set -ex; \
\
apk add --no-cache --virtual .gosu-deps \
dpkg \
gnupg \
openssl \
; \
\
dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \
wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \
wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \
\
# verify the signature
export GNUPGHOME="$(mktemp -d)"; \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \
rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc; \
\
chmod +x /usr/local/bin/gosu; \
# verify that the binary works
gosu nobody true; \
\
apk del .gosu-deps
RUN apk add --update iputils
RUN apk add --update htop
# COPY ./setup-slave.sh /docker-entrypoint-initdb.d
COPY ./docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
CMD ["gosu", "postgres", "pg_ctl", "-D/var/lib/postgresql/data", "start"]
And this is my docker-entrypoint.sh:
#!/bin/bash
if [ ! -s "$PGDATA/PG_VERSION" ]; then
echo '*:*:*:myuser:123456' > ~/.pgpass
chmod 0600 ~/.pgpass
until ping -c 1 -W 1 pg_master
do
echo "Waiting for master to ping..."
sleep 1s
done
until pg_basebackup -h pg_master -D ${PGDATA} -U arioo -vP -W
do
echo "Waiting for master to connect..."
sleep 1s
done
echo "host replication all 0.0.0.0/0 md5" >> "$PGDATA/pg_hba.conf"
set -e
cat >> ${PGDATA}/postgresql.conf <<EOF
wal_level = hot_standby
max_wal_senders = 8
wal_keep_segments = 32
hot_standby = off
EOF
cat > ${PGDATA}/recovery.conf <<EOF
standby_mode = on
primary_conninfo = 'host=pg_master port=5432 user=rep password=123456'
trigger_file = '/tmp/touch_me_to_promote_to_me_master'
EOF
chown postgres. ${PGDATA} -R
chmod 700 ${PGDATA} -R
fi
exec "$#"
The whole thing works just fine except for one thing. Docker immediately exits the slave container upon start. From my understanding pg_ctl start should start the postgres in foreground. But why is docker exiting still?
I use docker-compose to run the cluster.
I even tried putting an endless loop at end of the docker-entrypoint.sh like the code below and it's still exiting no matter what I do:
while true; do
sleep 1s
done
It seems that running postgres instead of pg_ctl start was the solution. pg_ctl is actually a utility to control the postgres daemon so it is logical that it runs postgres in the background.
I wanted to write a little script using wget to get some files. I was using the direct URL and everything seemed to work nice. After the script finished its work I checked the directories for the files and some were missing. I took a closer look at the terminal and I found that wget somehow managed to change the source URL. It either just typed some random characters or it changed 4 characters from the original URL to wget.
Here's a screen so you know what I mean:
Is this a known problem?
I tried wget with several added options none of them worked for me:
wget
wget -c
wget -r -np -nc --restrict-file-names=nocontrol
If you need to have a closer look at the whole source code, here it is:
mkdir ETH
cd ETH
mkdir Analysis\ I Lineare\ Algebra Diskrete\ Mathematik Einfuehrung\ in\ die\ Programmierung
cd Analysis\ I
mkdir Serien Loesungen Skript
cd ..
cd Lineare\ Algebra
mkdir Serien Loesungen Skript
cd ..
cd Diskrete\ Mathematik
mkdir Serien Loesungen
cd ..
cd Einfuehrung\ in\ die\ Programmierung
mkdir Serien Loesungen Probeklausuren Vorlesungsfolien Uebungsfolien
cd ..
cd Analysis\ I
cd Serien
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Serie01-Ana1-D-INFK.pdf
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Serie02-Ana1-D-INFK.pdf
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Serie03-Ana1-D-INFK.pdf
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Serie04-Ana1-D-INFK.pdf
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Serie05-Ana1-D-INFK.pdf
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Serie06-Ana1-D-INFK.pdf
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Serie07-Ana1-D-INFK.pdf
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Serie08-Ana1-D-INFK.pdf
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Serie09-Ana1-D-INFK.pdf
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Serie10-Ana1-D-INFK.pdf
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Serie11-Ana1-D-INFK.pdf
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Serie12-Ana1-D-INFK.pdf
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Serie13-Ana1-D-INFK.pdf
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Serie14-Ana1-D-INFK.pdf
cd ..
cd Loesungen
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Loesung01-Ana1-D-INFK.pdf
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Loesung02-Ana1-D-INFK.pdf
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Loesung03-Ana1-D-INFK.pdf
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Loesung04-Ana1-D-INFK.pdf
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Loesung05-Ana1-D-INFK.pdf
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Loesung06-Ana1-D-INFK.pdf
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Loesung07-Ana1-D-INFK.pdf
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Loesung08-Ana1-D-INFK.pdf
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Loesung09-Ana1-D-INFK.pdf
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Loesung10-Ana1-D-INFK.pdf
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Loesung11-Ana1-D-INFK.pdf
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Loesung12-Ana1-D-INFK.pdf
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Loesung13-Ana1-D-INFK.pdf
wget -c https://www2.math.ethz.ch/education/bachelor/lectures/hs2015/other/analysis1_infk/Loesung14-Ana1-D-INFK.pdf
cd ..
cd Skript
wget -c http://www.math.ethz.ch/~struwe/Skripten/InfAnalysis-bbm-8-11-2010.pdf
cd ../..
cd Lineare\ Algebra
cd Serien
wget -c http://cvg.ethz.ch/teaching/linalg/exercisesheets/s01.pdf
wget -c http://cvg.ethz.ch/teaching/linalg/exercisesheets/s02.pdf
wget -c http://cvg.ethz.ch/teaching/linalg/exercisesheets/s02.zip
wget -c http://cvg.ethz.ch/teaching/linalg/exercisesheets/s03.pdf
wget -c http://cvg.ethz.ch/teaching/linalg/exercisesheets/s04.pdf
wget -c http://cvg.ethz.ch/teaching/linalg/exercisesheets/s05.pdf
wget -c http://cvg.ethz.ch/teaching/linalg/exercisesheets/s05.zip
wget -c http://cvg.ethz.ch/teaching/linalg/exercisesheets/s06.pdf
wget -c http://cvg.ethz.ch/teaching/linalg/exercisesheets/s07.pdf
wget -c http://cvg.ethz.ch/teaching/linalg/exercisesheets/s08.pdf
wget -c http://cvg.ethz.ch/teaching/linalg/exercisesheets/s09.pdf
wget -c http://cvg.ethz.ch/teaching/linalg/exercisesheets/s10.pdf
wget -c http://cvg.ethz.ch/teaching/linalg/exercisesheets/s11.pdf
wget -c http://cvg.ethz.ch/teaching/linalg/exercisesheets/s12.pdf
wget -c http://cvg.ethz.ch/teaching/linalg/exercisesheets/s13.pdf
cd ..
cd Loesungen
wget -c http://cvg.ethz.ch/teaching/linalg/mastersolutions/l01.pdf
wget -c http://cvg.ethz.ch/teaching/linalg/mastersolutions/l02.pdf
wget -c http://cvg.ethz.ch/teaching/linalg/mastersolutions/l03.pdf
wget -c http://cvg.ethz.ch/teaching/linalg/mastersolutions/l04.pdf
wget -c http://cvg.ethz.ch/teaching/linalg/mastersolutions/l05.pdf
wget -c http://cvg.ethz.ch/teaching/linalg/mastersolutions/l06.pdf
wget -c http://cvg.ethz.ch/teaching/linalg/mastersolutions/l07.pdf
wget -c http://cvg.ethz.ch/teaching/linalg/mastersolutions/l08.pdf
wget -c http://cvg.ethz.ch/teaching/linalg/mastersolutions/l09.pdf
wget -c http://cvg.ethz.ch/teaching/linalg/mastersolutions/l10.pdf
wget -c http://cvg.ethz.ch/teaching/linalg/mastersolutions/l11.pdf
wget -c http://cvg.ethz.ch/teaching/linalg/mastersolutions/l12.pdf
wget -c http://cvg.ethz.ch/teaching/linalg/mastersolutions/l01.zip
wget -c http://cvg.ethz.ch/teaching/linalg/mastersolutions/l02.zip
wget -c http://cvg.ethz.ch/teaching/linalg/mastersolutions/l03.zip
wget -c http://cvg.ethz.ch/teaching/linalg/mastersolutions/l04.zip
wget -c http://cvg.ethz.ch/teaching/linalg/mastersolutions/l05.zip
wget -c http://cvg.ethz.ch/teaching/linalg/mastersolutions/l06.zip
wget -c http://cvg.ethz.ch/teaching/linalg/mastersolutions/l07.zip
wget -c http://cvg.ethz.ch/teaching/linalg/mastersolutions/l08.zip
wget -c http://cvg.ethz.ch/teaching/linalg/mastersolutions/l09.zip
wget -c http://cvg.ethz.ch/teaching/linalg/mastersolutions/l10.zip
wget -c http://cvg.ethz.ch/teaching/linalg/mastersolutions/l11.zip
cd ..
cd Skript
wget -c http://www.sam.math.ethz.ch/~mhg/unt/LA/HS07/LAS07.pdf
cd ../..
cd Diskrete\ Mathematik
cd Serien
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/u01.pdf
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/u02.pdf
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/u03.pdf
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/u04.pdf
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/u05.pdf
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/u06.pdf
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/u07.pdf
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/u08.pdf
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/u09.pdf
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/u10.pdf
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/u11.pdf
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/u12.pdf
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/u13.pdf
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/u14.pdf
cd ..
cd Loesungen
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/l01.pdf
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/l02.pdf
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/l03.pdf
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/l04.pdf
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/l05.pdf
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/l06.pdf
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/l07.pdf
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/l08.pdf
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/l09.pdf
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/l10.pdf
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/l11.pdf
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/l12.pdf
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/l13.pdf
wget -c http://www.crypto.ethz.ch/teaching/lectures/DM15/l14.pdf
cd ../..
cd Einfuehrung\ in\ die\ Programmierung
cd Serien
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/assignments/01/assignment_1.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/assignments/02/assignment_2.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/assignments/03/assignment_3.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/assignments/04/assignment_4.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/assignments/05/assignment_5.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/assignments/06/assignment_6.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/assignments/07/assignment_7.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/assignments/08/assignment_8.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/assignments/09/assignment_9.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/assignments/10/assignment_10.pdf
cd ..
cd Loesungen
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/assignments/02/assignment_2_solution.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/assignments/03/assignment_3_solution.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/assignments/04/assignment_4_solution.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/assignments/05/assignment_5_solution.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/assignments/06/assignment_6_solution.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/assignments/07/assignment_7_solution.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/assignments/08/assignment_8_solution.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/assignments/09/assignment_9_solution.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/assignments/10/assignment_10_solution.pdf
cd ..
cd Probeklausuren
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/mock_exams/1/exam.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/mock_exams/1/solution.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/mock_exams/2/exam.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/mock_exams/2/solution.pdf
cd ..
cd Vorlesungsfolien
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/lectures/01_overview.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/lectures/02_objects.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/lectures/03_conventions.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/lectures/04_interface.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/lectures/05_logic.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/lectures/06_creation.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/lectures/07_references_assignments.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/lectures/08_bnf.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/lectures/08_control.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/lectures/09_abstraction.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/lectures/10_dynamic_model.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/lectures/11_inheritance.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/lectures/12_recursion.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/lectures/13_data_structures.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/lectures/15_topological_sort.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/lectures/14_multiple_inheritance.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/lectures/18_undo.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/lectures/17_agents.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/lectures/19_software_engineering.pdf
cd ..
cd Uebungsfolien
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/exercise_sessions/exercise_session_02cm.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/exercise_sessions/exercise_session_03cm.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/exercise_sessions/exercise_session_04cm.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/exercise_sessions/exercise_session_05cm.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/exercise_sessions/exercise_session_06cm.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/exercise_sessions/exercise_session_07cm.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/exercise_sessions/exercise_session_09cm.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/exercise_sessions/exercise_session_10cm.pdf
wget -c http://se.inf.ethz.ch/courses/2015b_fall/eprog/exercise_sessions/exercise_session_13cm.pdf
Thank you very much.
The corruption is happening in your terminal window, long before wget sees any command.
Corruption is very common when you do large copy-and-paste operations into terminal sessions running bash. Copy and paste doesn't play well with the way bash reads from the terminal.
You should run your script file directly, using the source command (also called .), or by starting a subshell.
What I mean is that I want to create a docker image for postgis that will be completely usable right after build. So that if user runs
docker run -e POSTGRES_USER=user somepostgis
the user database would be created and extensions already installed?
The official postgres image can't be used for that AFAIK.
Basically need to write script and tell that it would be entrypoint. This script should create database and create extensions with porstgres server running on different port and then restart it on port 5432.
But I don't know sh enough and docker to do that. Right now it's saying that there is no pg_ctl command
If you want to help you can fork
FROM ubuntu:15.04
#ENV RELEASE_NAME lsb_release -sc
#RUN apt-get update && apt-get install wget
#RUN echo "deb http://apt.postgresql.org/pub/repos/apt ${RELEASE_NAME}-pgdg main" >> /etc/apt/sources.list
#RUN cat /etc/apt/sources.list
#RUN wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
postgresql-9.4-postgis-2.1 \
curl \
&& curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture)" \
&& curl -o /usr/local/bin/gosu.asc -SL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture).asc" \
&& gpg --verify /usr/local/bin/gosu.asc \
&& rm /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu \
&& apt-get purge -y --auto-remove curl
RUN mkdir /docker-entrypoint-initdb.d
COPY docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
RUN chmod +x /docker-entrypoint.sh
RUN ls -l /docker-entrypoint.sh
EXPOSE 5432
CMD ["postgres"]
So I'm trying to do somethink like that, but it doesn't work.
#!/bin/bash
${POSTGRES_DB:=$POSTGRES_USER}
gosu postgres pg_ctl start -w -D ${PGDATA} -0 "-p 5433"
gosu postgres createuser ${POSTGRES_USER}
gosu postgres createdb ${POSTGRES_DB} -s -E UTF8
gosu postgres psql -d ${POSTGRES_DB} -c "create extension if not exists postgis;"
gosu postgres psql -d ${POSTGRES_DB} -c "create extension if not exists postgis_topology;"
pg_ctl -w restart