Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Phillip Ross
@phillipross
i'm actually testing to see if maybe there's something missing from your script... unfortunately, for postgis docker images, there's non tutorials at the moment
ZENinjaneer
@ZENinjaneer
Oh geez... I found the solution. Apparently after you have done all of the fun stuff and reconfigured postgis with the new schema you have to disconnect from the database and reconnect. Cue "have you tried turning it off and back on again?" memes
Phillip Ross
@phillipross
haha, ohh, yes that makes sense
i'm just not sure immediately how that is accomplished with the current way the container initialization happens with postgis/postgis images
maybe just separating into 2 scripts
ZENinjaneer
@ZENinjaneer
        \connect postgres
        CREATE SCHEMA analytic_results;
                CREATE EXTENSION IF NOT EXISTS postgis WITH SCHEMA analytic_results;
        ALTER DATABASE postgres OWNER TO usr;
        UPDATE pg_extension
        SET extrelocatable = TRUE
        WHERE extname = 'postgis';
        ALTER EXTENSION postgis
        SET SCHEMA analytic_results;
        ALTER DATABASE postgres
        SET search_path = public, analytic_results, postgis;
        GRANT ALL ON SCHEMA analytic_results TO usr;
        GRANT ALL ON SCHEMA public TO usr;
        GRANT ALL PRIVILEGES ON DATABASE postgres TO usr;
        GRANT ALL ON ALL TABLES IN SCHEMA analytic_results TO usr;
        GRANT ALL PRIVILEGES ON DATABASE postgres TO usr;
        \disconnect
        \connect postgres
        CREATE TABLE analytic_results."trevor-table" (
        fid INTEGER,
        geom geometry(point),
        timestamp TIMESTAMP);
i just throw in a \disconnect
somehow that works?
maybe it's the \connect
Phillip Ross
@phillipross
yeah, actually, the disconnect won't be necessary, you'll just need the connect
ZENinjaneer
@ZENinjaneer
I have been banging my head on the wall for so long trying to get that to work.
Thanks for your help @phillipross
Phillip Ross
@phillipross
yep, no problem
Christian Giordano
@nuthinking_gitlab
Hi everyone! Has anyone experience with this image on Gitlab CI? We are getting a bit mental. Last error we get is : ERROR: getaddrinfo ENOTFOUND postgres postgres:5432 🤷‍♂️ thank you so much!
Christian Giordano
@nuthinking_gitlab
I think I sorted it, it was the host name :D
Taro Matsuzawa aka. btm
@smellman
I miss the mean sorted.
Phillip Ross
@phillipross
hehe, the expression "sorted" or "sorted it out" often refers to resolving something ;) it's not a technical term
Axel
@Micromegass

Hi everyone! Is there an easy way of adding/enabling postgis in my postgres10 dockerfile?

This is my dockerfile:

FROM postgres:10.4

COPY ./compose/production/postgres/maintenance /usr/local/bin/maintenance
RUN chmod +x /usr/local/bin/maintenance/*
RUN mv /usr/local/bin/maintenance/* /usr/local/bin \
    && rmdir /usr/local/bin/maintenance

I tried to add:

RUN apt-get update && \
     apt-get -y install sudo

RUN service postgresql start \
     && sudo -u postgres psql -c "CREATE EXTENSION postgis;"
RUN service postgresql stop

but I get the error:

psql: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

But I am not sure if that is even the way to go. Has anyone done this before? Thanks is advance!!

Phillip Ross
@phillipross
i believe what you're running into is the fact that the postgres:10.4 image that you are inheriting from does not have the postgis extension. you'd probably want to either swap out that postgres:10.4 image with a postgis image, or add the commands to your dockerfile to install postgis
Axel
@Micromegass
Thanks @phillipross I used the official postgis image now (https://hub.docker.com/r/postgis/postgis) and removed my postgres image. That works now. Thanks!!
Ulrich Knaack
@UlrichK_gitlab

Hi :-) I've created a container from image postgis/postgis:12-3.0 and tried to apply German language settings:

environment:
            POSTGRES_USER: bop
            POSTGRES_PASS: mypass
            POSTGRES_DBNAME: pgis
            DEFAULT_COLLATION: de_DE.UTF-8
            DEFAULT_CTYPE: de_DE.UTF-8
            DEFAULT_ENCODIG: UTF8

But the database is created with ctype and collation C.UTF-8. Did I make a mistake ?

Phillip Ross
@phillipross
@UlrichK_gitlab if you haven't done so already, but might want to take a look at the official Postgres docker image on dockerhub which has instructions on setting the locale in a custom image. The official PostGIS images are based on the official Postgres images and function the same way regarding locale config.
Ulrich Knaack
@UlrichK_gitlab
@phillipross thank you, I´ve got informations on postgis/docker-postgis#198
Dillan Mann
@dillanmann
Hey folks, does anyone know how to get a postgis extension to use the .pgpass file to set the database password? I have tried copying it to /home/postgres/.pgpass, doing chown postgres:postgres /home/postgres/.pgpass and chmod 0600 /home/postgres/.pgpass but when the container starts up it still says the password is unset
Davis Ford
@davisford
hi all -- i'm having trouble using the address_standardizer extension. when i CREATE EXTENSION address_standardizer that is fine, but then try to access and it says the function normalize_address or pagc_normalize_address are not found. The user I am logged in is a superuser (not the default postgres user), but if I login as the postgres user, the functions are available and work fine. I'm not clear on the permissions structure for this extension. Can someone advise?
Davis Ford
@davisford

Can someone help me understand how this is happening? ```posapi=# select * from parse_address('');
num | street | street2 | address1 | city | state | zip | zipplus | country
-----+--------+---------+----------+------+-------+-----+---------+---------
| | | | | | | | US
(1 row)

posapi=# select from normalize_address('');
ERROR: function normalize_address(unknown) does not exist
LINE 1: select
from normalize_address('');
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.```

i.e. parse_address is there...but normalize_address is not
Davis Ford
@davisford
For anyone else that ever has the issue I did above. It appears that address_standardizer must be created by the same user that will be using it. Also, it depends on postgis_tiger_geocoder and if that extension is not also installed, it will just fail by saying the function doesn't exist. I had to trial/error several docker image builds to figure this out. Let me know if you would accept a PR on improving documentation around this because I lost several hours this week having this fail on us.
Phillip Ross
@phillipross
@davisford I'm sorry to hear you lost so much time on this issue. I would say that the documentation around what is installed and what's not when you deploy the container would be helpful and welcome, but there is currently discussions around HOW extensions should/shouldn't be loaded when the container is deployed: postgis/docker-postgis#187
The fact that postgis behavior is not as intuitive with regards to the address standardizer depending on tiger geocoder and error messages you're receiving is probably better addressed by the main postgis project. You can direct these types of questions/concerns to the postgis mailing list to get feedback from the postgis project directly.
And of course, feel free to join in the discussion on issue #187 !
Taro Matsuzawa aka. btm
@smellman
@phillipross @nyurik I upload #180 patch. Please review it.
Davis Ford
@davisford
. @phillipross thanks for the info. my vote. is for this approach https://github.com/postgis/docker-postgis/issues/187#issuecomment-668816710 -- also is there some way to know if one extension implicitly depends on another? shouldn't postgres itself warn the user if you try to load an extension that has dependencies that are not already present?
Christian Frugard
@frugardc
Anyone know of issues with the combination of Postgres 11 and PostGIS 3? I have a query that joins using st_intersects, and the spatial indexes wind up not used by the planned in the PG11/PostGIS3 combination. The index is used properly in PG11/PostGIS2, and also is used properly in PG13/PostGIS3
Christian Frugard
@frugardc
I believe this might be related to https://trac.osgeo.org/postgis/ticket/4802, but the workaround proposed there does not work for me
fly
@fly:asra.gr
[m]
I'm trying to pull the 13-master docker image https://hub.docker.com/r/postgis/postgis but I get an error denied: requested access to the resource is denied
Is this intended?
Phillip Ross
@phillipross
hmmm, let me see if there's currently an issue, but no... it's not intended
i was able to pull normally, but i'm logged in with my account which might have elevated privileges... give me a few mins and i'll try from a fresh vm so i can try from scratch
Phillip Ross
@phillipross
@fly:asra.gr I tested with fresh install of ubuntu 20.04 with docker-ce that is NOT authenticated to dockerhub, and pulling 13-master from dockerhub seems to have worked fine.
fly
@fly:asra.gr
[m]
@phillipross thanks for checking... it seems to be some podman weirdness then...
fly
@fly:asra.gr
[m]
works... thank you so much for creating it
fly
@fly:asra.gr
[m]
running my db in the container gives me an error I've never seen on bare metal:
psycopg2.errors.DiskFull: could not resize shared memory segment "/PostgreSQL.550616896" to 8388608 bytes: No space left on device
The machine has enough storage space amd RAM available so I'm not sure where this comes from.
Any idea?
Phillip Ross
@phillipross
@fly:asra.gr it's likely you're hitting the default shared memory cap, but you can increase that. Check the caveats section of the official postgres image on docker hub, and I believe you'll find the parameters for increasing the shared memory for your containers.
fly
@fly:asra.gr
[m]
thanks
isimsiz
@fblidev_twitter
hi
Hello. I have Postgresql running on docker. I have tables and data in this database. I don't want these to disappear. How do I install Postgis with this postgresqle?
James Howe
@OrangeDog
Can creating the extensions be disabled? I need them in a different schema, not in postgres.public.
James Howe
@OrangeDog
Deleting or overwriting /docker-entrypoint-initdb.d/10_postgis.sh seems to be the way.
akshayjn93
@akshayjn93
hi, need to increase the max connections in postgis container
Phillip Ross
@phillipross
@akshayjn93 the postgis container images inherit from the postgres official images. you can check the docs for the postgres image to see how to customize configuration: https://hub.docker.com/_/postgres
I believe max_connections is in the example there