Creating map db cluster in pi-gen build. Removing duplicate pgpass creation.

This commit is contained in:
Roland 2025-01-04 10:51:14 -07:00
parent 8e4d173791
commit 11bdbc4dc7
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
4 changed files with 12 additions and 16 deletions

View file

@ -293,7 +293,7 @@ export function ChannelPage({create, header}) {
color='violet'
onClick={handleTagEditChannel}
obeyWROLMode={true}
>Save</APIButton>
>{moveToTagDirectory ? 'Move' : 'Save'}</APIButton>
</ModalActions>
</Modal>;
}

View file

@ -14,8 +14,8 @@ EOF
# Create WROLPi user. This user will own the media directory, API, and App.
useradd -md /home/wrolpi wrolpi -s "$(command -v bash)"
# Change default postgresql port to 5432.
sed -i 's/port = 5433/port = 5432/' /etc/postgresql/15/main/postgresql.conf
# Change postgresql "main" cluster port to 5432.
sed -i 's/port =.*/port = 5432/' /etc/postgresql/15/main/postgresql.conf
# Install Node console commands.
npm i -g serve@12.0.1 single-file-cli@1.1.54 readability-extractor@0.0.6 carto@1.2.0

View file

@ -3,18 +3,24 @@
set -e
set -x
# Create postgres cluster for map.
pg_createcluster 15 map --port=5433
# Create mapnik config.
git clone https://github.com/lrnselfreliance/openstreetmap-carto.git /opt/openstreetmap-carto
git config --global --add safe.directory /opt/openstreetmap-carto
(cd /opt/openstreetmap-carto && git fetch && git checkout master && git reset --hard origin/master && git pull --ff)
chown -R wrolpi:wrolpi /opt/openstreetmap-carto
(cd /opt/openstreetmap-carto && carto project.mml >/opt/openstreetmap-carto/mapnik.xml)
# Append port line after dbname configuration line.
sed -i '/dbname: "gis"/a \ port: 5433' /opt/openstreetmap-carto/project.mml
(cd /opt/openstreetmap-carto/ && carto project.mml >mapnik.xml)
# All users can access wrolpi and map database.
cat >/etc/skel/.pgpass <<'EOF'
127.0.0.1:5432:gis:_renderd:wrolpi
127.0.0.1:5433:gis:_renderd:wrolpi
127.0.0.1:5432:wrolpi:wrolpi:wrolpi
EOF
chmod 0600 /etc/skel/.pgpass
cat >/etc/skel/.gitconfig <<'EOF'
[safe]
directory = /opt/wrolpi
@ -48,11 +54,6 @@ chown -R _renderd:_renderd /var/cache/renderd/tiles
# Create the media directory for the wrolpi user.
echo '/dev/sda1 /media/wrolpi auto defaults,nofail 0 0' | tee -a /etc/fstab
mkdir -p /media/wrolpi
cat >/home/wrolpi/.pgpass <<'EOF'
127.0.0.1:5432:gis:_renderd:wrolpi
127.0.0.1:5432:wrolpi:wrolpi:wrolpi
EOF
chmod 0600 /home/wrolpi/.pgpass
chown -R wrolpi:wrolpi /media/wrolpi /home/wrolpi /opt/wrolpi*
set +x

View file

@ -98,11 +98,6 @@ sudo -iu postgres psql -c "alter user wrolpi with superuser"
if [ ! -d /opt/openstreetmap-carto ]; then
echo "/opt/openstreetmap-carto does not exist! Has install completed?" && exit 1
fi
chown -R _renderd:_renderd /opt/openstreetmap-carto
if [[ ! -f /opt/openstreetmap-carto/mapnik.xml || ! -s /opt/openstreetmap-carto/mapnik.xml ]]; then
(cd /opt/openstreetmap-carto && carto project.mml >/opt/openstreetmap-carto/mapnik.xml)
fi
chown -R _renderd:_renderd /opt/openstreetmap-carto
cp /opt/wrolpi/etc/raspberrypios/renderd.conf /etc/renderd.conf
# Enable mod_tile.
@ -119,8 +114,8 @@ grep -q 'port: 5433' /opt/openstreetmap-carto/project.mml || (
# Append port line after dbname configuration line.
sed -i '/dbname: "gis"/a \ port: 5433' /opt/openstreetmap-carto/project.mml
(cd /opt/openstreetmap-carto/ && carto project.mml >mapnik.xml)
chown -R _renderd:_renderd /opt/openstreetmap-carto
)
chown -R _renderd:_renderd /opt/openstreetmap-carto
cp /opt/wrolpi/etc/raspberrypios/renderd.conf /etc/renderd.conf
# Configure Apache2 to listen on 8084.