Skip to content

Commit

Permalink
Merge branch 'master' into feature/cacheformat
Browse files Browse the repository at this point in the history
  • Loading branch information
dooman87 committed Apr 22, 2016
2 parents 6f18254 + cbef4e8 commit 1aa60f8
Show file tree
Hide file tree
Showing 6 changed files with 180 additions and 1 deletion.
57 changes: 57 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
FROM ubuntu:14.04

MAINTAINER Dmitry Pokidov <dooman87@gmail.com>

WORKDIR /

ENV GO15VENDOREXPERIMENT=0
ENV PATH=/opt/go/bin:/gohome/bin:$PATH
ENV GOPATH=/gohome
ENV GOROOT=/opt/go

RUN apt-get update && \
apt-get -y install automake bison flex g++ git libboost1.54-all-dev libevent-dev libssl-dev libtool make \
pkg-config wget \
python-mapnik libmapnik-dev \
protobuf-compiler libprotobuf-dev \
jq cmake libncurses5-dev && \
rm -rf /var/lib/apt/lists/*

#Installing apache thrift
RUN wget http://apache.uberglobalmirror.com/thrift/0.9.3/thrift-0.9.3.tar.gz && \
tar -xzvf thrift-0.9.3.tar.gz && \
rm ./thrift-0.9.3.tar.gz && \
cd /thrift-0.9.3 && \
./configure --without-java && \
make && \
make install

#Install golang 1.6
WORKDIR /opt
RUN wget https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz && \
tar -xzvf go1.6.linux-amd64.tar.gz && \
rm go1.6.linux-amd64.tar.gz && \
mkdir -p /gohome/bin && \
mkdir -p /gohome/pkg && \
mkdir /gohome/src

RUN go get github.com/mattn/gom

RUN mkdir /gopnik
ADD . /gopnik
WORKDIR /gopnik
RUN gom install && \
gom exec ./bootstrap.bash && \
gom exec ./build.bash

RUN mkdir /gopnik_data
COPY example/dockerconfig.json /gopnik_data/config.json
COPY sampledata/stylesheet.xml /gopnik_data/
COPY sampledata/world_merc.shp /gopnik_data/
COPY sampledata/world_merc.dbf /gopnik_data/
VOLUME /gopnik_data

EXPOSE 8080
EXPOSE 9090

ENTRYPOINT ./entrypoint.sh
17 changes: 17 additions & 0 deletions Gomfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
gom 'github.com/cheggaaa/pb', :commit => '8808370bf63524e115da1371ba42bce6739f3a6b'
gom 'github.com/davecgh/go-spew/spew', :commit => '5215b55f46b2b919f50a1df0eaa5886afe4e3b3d'
gom 'github.com/golang/protobuf/proto', :commit => 'dda510ac0fd43b39770f22ac6260eb91d377bce3'
gom 'github.com/golang/protobuf/protoc-gen-go', :commit => 'dda510ac0fd43b39770f22ac6260eb91d377bce3'
gom 'github.com/go-martini/martini', :commit => 'b174c4f35f9f3805e960be6286d888bc79534755'
gom 'github.com/martini-contrib/staticbin', :commit => 'b9631fb8c188bec7aefed202f05fb3b76abadced'
gom 'github.com/op/go-logging', :commit => '970db520ece77730c7e4724c61121037378659d9'
gom 'github.com/orofarne/hmetrics2', :commit => '006bcad088fa29b689daa57700c58094d1031664'
gom 'github.com/orofarne/hmetrics2-graphite', :commit => '9888dcbe67c94e48fa715ff4d3e18ae5b7549abd'
gom 'github.com/stretchr/testify/assert', :commit => '0744955171b0b6e1871ff9d7366abc2b7a7fcec0'
gom 'github.com/stretchr/testify/require', :commit => '0744955171b0b6e1871ff9d7366abc2b7a7fcec0'
gom 'github.com/yosssi/rendergold', :commit => '5cd20c624fd531597e1a6566196d7dd6ff342ae2'
gom 'github.com/orofarne/strict-json', :commit => 'e220748385bad49f5bf127fa5521559723f48a4c'
gom 'github.com/orofarne/freetype-go/freetype', :commit => '066003d5bbffa8f5927858a65bec052b312a3792'
gom 'github.com/jteeuwen/go-bindata/go-bindata', :commit => 'a0ff2567cfb70903282db057e799fd826784d41d'
gom 'git.apache.org/thrift.git/lib/go/thrift', :commit => '3aa461b97b3230d357543808f1facf9898818f71'
gom 'gopkg.in/check.v1', :commit => '4f90aeace3a26ad7021961c297b22c42160c7b25'
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,21 @@ BUILD

./bootstrap.bash
./build.bash

BUILD AND RUN USING DOCKER
==========================

* To build an image:

`$ docker build -t gopnik .`

* Run gopnik server with example:

`$ docker run -it --rm -p 8080:8080 -p 9090:9090 gopnik`

To see an example open example/index.html in your favorite browser and zoom out a map to
level 1.

Image is exposing volume /gopnik_data/. You can customise configuration by mounting your volume with
config.json file inside and other helper stuff, e.g. styles. Also, you can use this image as a base
image for your configurations.
5 changes: 5 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

cd /gopnik/bin
./gopnikrender --config /gopnik_data/config.json &
./gopnikdispatcher --config /gopnik_data/config.json
81 changes: 81 additions & 0 deletions example/dockerconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"Dispatcher": {
"Addr": ":8080",
"HTTPReadTimeout": "60s",
"HTTPWriteTimeout": "60s",
"RequestTimeout": "600s",
"PingPeriod": "30s",
"Threads": -1,
"Logging": {
"Backend": "Console",
"Level": "Debug",
"Options": {
"Color": true
}
},
"ClusterPlugin": {
"Plugin": "ClusterConfigPlugin",
"PluginConfig": {
"Nodes": ["localhost:8090"]
}
}
},
"Render": {
"Addr": ":8090",
"DebugAddr": ":9090",
"Logging": {
"Backend": "Console",
"Level": "Debug",
"Options": {
"Color": true
}
}
},
"Prerender": {
"UIAddr": ":8088",
"PerfLog": "/tmp/prerender.perf",
"Logging": {
"Backend": "Console",
"Level": "Debug",
"Options": {
"Color": false
}
},
"Slaves": {
"Plugin": "ClusterConfigPlugin",
"PluginConfig": {
"Nodes": ["localhost:8095"]
}
}
},
"PrerenderSlave": {
"RPCAddr": ":8095",
"Logging": {
"Backend": "Console",
"Level": "Debug",
"Options": {
"Color": false
}
}
},
"MetaSize": 8,
"TileSize": 256,

"CachePlugin": {
"Plugin": "SimpleFileCachePlugin",
"PluginConfig": {
"Root": "/tmp/tiles"
}
},
"RenderPools": [
{
"Cmd": ["/gopnik/bin/gopnikslave", "-stylesheet", "/gopnik_data/stylesheet.xml", "-pluginsPath", "/usr/lib/mapnik/2.2/input"],
"MinZoom": 1,
"MaxZoom": 8,
"PoolSize": 1,
"HPQueueSize": 100,
"LPQueueSize": 100,
"RenderTTL": 10
}
]
}
3 changes: 2 additions & 1 deletion src/tileserver/thrift_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"gopnikrpc/types"
"gopnikrpcutils"
"rpcbaseservice"
"math"
)

type thriftTileServer struct {
Expand Down Expand Up @@ -51,7 +52,7 @@ func RunServer(addr string, tileServer *TileServer) error {
if err != nil {
return err
}
transportFactory := thrift.NewTFramedTransportFactory(thrift.NewTTransportFactory())
transportFactory := thrift.NewTFramedTransportFactoryMaxLength(thrift.NewTTransportFactory(), uint32(math.MaxUint32))
protocolFactory := thrift.NewTBinaryProtocolFactoryDefault()

server := thrift.NewTSimpleServer4(processor, transport, transportFactory, protocolFactory)
Expand Down

0 comments on commit 1aa60f8

Please sign in to comment.