Skip to content

Commit

Permalink
Change default pygeoapi port to 5001
Browse files Browse the repository at this point in the history
macOS Monterey runs AirPlay Receiver on port 5000 by default,
which prevents our pygeoapi instance from starting on the same port.
Changing pygeoapi port to 5001 avoids the conflict and makes life
easier for ourselves and others.

See also https://anandtripathi5.medium.com/port-5000-already-in-use-macos-monterey-issue-d86b02edd36c

Thanks to Drew Rotheram for initial research to this problem.
  • Loading branch information
anthonyfok committed Jan 27, 2022
1 parent 4872f98 commit 645d4da
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ http://localhost:5601

Check pygeoapi to make sure the collections can be accessed

http://localhost:5000/collections
http://localhost:5001/collections

Feature collections can be accessed as follows or by clicking on the links provided on the collections page

http://localhost:5000/collections/afm7p2_lrdmf_scenario_shakemap_intensity_building/items?f=json&limit=1
http://localhost:5001/collections/afm7p2_lrdmf_scenario_shakemap_intensity_building/items?f=json&limit=1

You should see something similar to:

Expand Down Expand Up @@ -139,31 +139,31 @@ You should see something similar to:
"type": "application/geo+json",
"rel": "self",
"title": "This document as GeoJSON",
"href": "http://localhost:5000/collections/afm7p2_lrdmf_scenario_shakemap_intensity_building/items?f=json&limit=1"
"href": "http://localhost:5001/collections/afm7p2_lrdmf_scenario_shakemap_intensity_building/items?f=json&limit=1"
},
{
"rel": "alternate",
"type": "application/ld+json",
"title": "This document as RDF (JSON-LD)",
"href": "http://localhost:5000/collections/afm7p2_lrdmf_scenario_shakemap_intensity_building/items?f=jsonld&limit=1"
"href": "http://localhost:5001/collections/afm7p2_lrdmf_scenario_shakemap_intensity_building/items?f=jsonld&limit=1"
},
{
"type": "text/html",
"rel": "alternate",
"title": "This document as HTML",
"href": "http://localhost:5000/collections/afm7p2_lrdmf_scenario_shakemap_intensity_building/items?f=html&limit=1"
"href": "http://localhost:5001/collections/afm7p2_lrdmf_scenario_shakemap_intensity_building/items?f=html&limit=1"
},
{
"type": "application/geo+json",
"rel": "next",
"title": "items (next)",
"href": "http://localhost:5000/collections/afm7p2_lrdmf_scenario_shakemap_intensity_building/items?startindex=1&limit=1"
"href": "http://localhost:5001/collections/afm7p2_lrdmf_scenario_shakemap_intensity_building/items?startindex=1&limit=1"
},
{
"type": "application/json",
"title": "Economic loss buildings",
"rel": "collection",
"href": "http://localhost:5000/collections/afm7p2_lrdmf_scenario_shakemap_intensity_building"
"href": "http://localhost:5001/collections/afm7p2_lrdmf_scenario_shakemap_intensity_building"
}
],
"timeStamp": "2020-08-18T22:46:10.513010Z"
Expand All @@ -175,17 +175,17 @@ You should see something similar to:

Refer to the pygeoapi documentation for general guidance:

http://localhost:5000/openapi?f=html
http://localhost:5001/openapi?f=html

> NOTE: querying is currently limited to spatial extent and exact value queries. For more complex querying use Elasticsearch (see below).
#### To filter on a specfic attribute

http://localhost:5000/collections/afm7p2_lrdmf_scenario_shakemap_intensity_building/items?sH_Mag=7.2
http://localhost:5001/collections/afm7p2_lrdmf_scenario_shakemap_intensity_building/items?sH_Mag=7.2

#### To filter using a bounding box

http://localhost:5000/collections/afm7p2_lrdmf_scenario_shakemap_intensity_building/items?bbox=-119,48.8,-118.9,49.8&f=json
http://localhost:5001/collections/afm7p2_lrdmf_scenario_shakemap_intensity_building/items?bbox=-119,48.8,-118.9,49.8&f=json

### Querying Elasticsearch

Expand Down Expand Up @@ -290,7 +290,7 @@ You have two options:

1. Add a "New Connection" by right clicking on the "WFS / OGC API -Features" data type in the browser
2. Enter a name for your connection (i.e. "OpenDRR")
3. Enter `http://localhost:5000` in the URL field
3. Enter `http://localhost:5001` in the URL field
4. Select "OGC API - Features" in the "Version" dropdown
4. Click the "OK" button

Expand Down
2 changes: 1 addition & 1 deletion docker-compose-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ services:
build: ./pygeoapi

ports:
- 5000:80
- 5001:80

depends_on:
- elasticsearch-opendrr
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ services:
build: ./pygeoapi

ports:
- 5000:80
- 5001:80

depends_on:
- elasticsearch-opendrr
Expand Down
4 changes: 2 additions & 2 deletions pygeoapi/opendrr.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
server:
bind:
host: 0.0.0.0
port: 5000
url: http://localhost:5000
port: 5001
url: http://localhost:5001
mimetype: application/json; charset=UTF-8
encoding: utf-8
languages:
Expand Down
4 changes: 2 additions & 2 deletions python/gen_pygeoapi_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ def main():
server:
bind:
host: 0.0.0.0
port: 5000
url: http://localhost:5000
port: 5001
url: http://localhost:5001
mimetype: application/json; charset=UTF-8
encoding: utf-8
language: en-US
Expand Down
4 changes: 2 additions & 2 deletions python/gen_pygeoapi_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ docker build -t temp_image --no-cache .

# instantiate the container
echo 'Starting the container...'
docker run -d --name temp_container -p 5000:80 temp_image
docker run -d --name temp_container -p 5001:80 temp_image

# make sure Elasticsearch is ready prior to creating indexes
until curl -sSf -XGET --insecure 'http://localhost:5000' > /dev/null; do
until curl -sSf -XGET --insecure 'http://localhost:5001' > /dev/null; do
printf 'pygeoapi not ready yet, trying again in 10 seconds \n'
sleep 10
done
Expand Down

0 comments on commit 645d4da

Please sign in to comment.