Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Dockerfile and lighttpd.conf #213

Merged
merged 5 commits into from Jul 4, 2020

Conversation

mmd-osm
Copy link
Collaborator

@mmd-osm mmd-osm commented Dec 22, 2019

Dockerfile

  • openstreetmap-cgimap binary now statically built
  • Enable JSON output
  • Multi-stage build for smaller image (1GB -> 120 MB)
  • Run cgimap as non-root user (sec)

lighttpd

  • Update lighttpd.conf to include all supported endpoints,
  • Forward unknown requests to Rails port on port 3000 (reverse proxy)
  • Include config example for Dockerfile

@mmd-osm
Copy link
Collaborator Author

mmd-osm commented Dec 23, 2019

Extending docker-compose.yml in openstreetmap/openstreetmap-website#2409 to be used alongside cgimap and lighttpd:

Exposes a working stack on http://localhost:31500 (including cgimap features) and http://localhost:3000 (Rails port only)

docker-compose

version: "3.2"

services:
  lighttpd:
    image: sebp/lighttpd:latest
    volumes:
      - type: bind
        source: ./docker/lighttpd/config
        target: /etc/lighttpd
    ports:
      - "31500:31337"
    command:
      - start.sh
    depends_on:
      - cgimap
      - web

  cgimap:
    image: cgimap:latest
    environment:
     - CGIMAP_HOST=db
     - CGIMAP_DBNAME=openstreetmap
     - CGIMAP_USERNAME=openstreetmap
     - CGIMAP_PASSWORD=openstreetmap
    command: /usr/local/bin/openstreetmap-cgimap --port=8000 --instances=30
    depends_on:
      - db

  web:
    build:
      context: .
    volumes:
      - .:/app
    ports:
      - "3000:3000"
    command: bundle exec rails s -p 3000 -b '0.0.0.0'
    depends_on:
      - db

  db:
    build:
      context: .
      dockerfile: docker/postgres/Dockerfile
    ports:
      - "54321:5432"
    environment:
      POSTGRES_DB: openstreetmap
    volumes:
      - ./docker-db-data:/var/lib/postgresql/data

Local (relative) directory docker/lighttpd/config contains lighttpd.conf, with adjusted host names:

$HTTP["url"] =~ "^/(?!(dispatch\.map))" {
    proxy.server = ( "" => ( ( "host" => "web", "port" => "3000" ) ) )
}

fastcgi.server = ( ".map" =>
  (( "host"   => "cgimap",
     "port"   => 8000,
     "check-local" => "disable",
  ))
)

docker

@mmd-osm mmd-osm merged commit 53fff92 into zerebubuth:master Jul 4, 2020
@mmd-osm mmd-osm deleted the patch/docker branch August 28, 2020 12:22
@mmd-osm mmd-osm mentioned this pull request Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant