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

Many Many Fixes #23

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# editorconfig.org
root = true

[*]
indent_style = tab
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ bin
pkg
src/github.com
.go-bindata
tmp
go.sum
assets
64 changes: 51 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,28 +1,66 @@
cesium_version:=$(shell cat $(CURDIR)/docker/cesium-version.txt)
checkout:=$(shell cat $(CURDIR)/docker/cts-checkout.txt)
CESIUM_VERSION:=1.63.1
checkout:=$(or $(FRIENDLY_CHECKOUT),$(shell git branch --show-current))
FRIENDLY_CHECKOUT:=$(or $(FRIENDLY_CHECKOUT),$(shell echo $(checkout) | sed 's/\//-/g'))
GOFILES:=$(shell find . -name '*.go')

GOBINDATA := $(GOPATH)/bin/go-bindata
GOROOT:=$(or $(GOROOT),/usr/local/go)
GOBIN:=$(or $(GOBIN),/usr/local/go/bin)
GOBINDATA:=$(GOBIN)/go-bindata
DOCKER_REPO:=geo-data/cesium-terrain-server
DOCKER_LOCAL_NAME:=$(DOCKER_REPO):local
LATEST_TAG=$(shell git tag -l --sort=-v:refname | awk 'FNR == 1')
LATEST_TAG_STABLE=$(shell git tag -l --sort=-v:refname | grep -v alpha | awk 'FNR == 1')

install: $(GOFILES) assets/assets.go
go get ./... && go install ./...

assets/assets.go: $(GOBINDATA) data
$(GOBINDATA) -ignore \\.gitignore -nocompress -pkg="assets" -o assets/assets.go data

$(GOBINDATA): data/smallterrain-blank.terrain
go get github.com/jteeuwen/go-bindata/... && touch $(GOBINDATA)
$(GOBINDATA):
go get -u github.com/go-bindata/go-bindata/...

data/smallterrain-blank.terrain:
curl --location --progress-bar https://raw.github.com/geo-data/cesium-terrain-builder/master/data/smallterrain-blank.terrain > data/smallterrain-blank.terrain

docker-local: docker/local/cesium-terrain-server-$(checkout).tar.gz docker/local/Cesium-$(cesium_version).zip
docker build -t geodata/cesium-terrain-server:local docker
docker-local: docker/local/cesium-terrain-server-$(FRIENDLY_CHECKOUT).tar.gz docker/local/Cesium-$(CESIUM_VERSION).zip
docker build --build-arg FRIENDLY_CHECKOUT=$(FRIENDLY_CHECKOUT) --build-arg CESIUM_VERSION=$(CESIUM_VERSION) -t $(DOCKER_LOCAL_NAME) docker

docker/local/Cesium-$(CESIUM_VERSION).zip:
curl --location --progress-bar https://github.com/AnalyticalGraphicsInc/cesium/releases/download/$(CESIUM_VERSION)/Cesium-$(CESIUM_VERSION).zip > docker/local/Cesium-$(CESIUM_VERSION).zip

docker/local/cesium-terrain-server-$(FRIENDLY_CHECKOUT).tar.gz: $(GOFILES) Makefile
git archive HEAD --prefix=cesium-terrain-server-$(FRIENDLY_CHECKOUT)/ --format=tar.gz -o docker/local/cesium-terrain-server-$(FRIENDLY_CHECKOUT).tar.gz

docker-tag:
docker tag $(DOCKER_LOCAL_NAME) $(DOCKER_REPO):$(TO_VERSION)

docker-push:
docker push $(DOCKER_REPO):$(TO_VERSION)

docker-tag-latest:
make docker-tag TO_VERSION=latest

docker-push-latest:
make docker-push TO_VERSION=latest

docker-tag-version:
make docker-tag TO_VERSION=$(LATEST_TAG)

docker-push-version:
make docker-push TO_VERSION=$(LATEST_TAG)

docker-tag-stable:
make docker-tag TO_VERSION=$(LATEST_TAG_STABLE)

docker-push-stable:
make docker-push TO_VERSION=$(LATEST_TAG_STABLE)

docker/local/Cesium-$(cesium_version).zip: docker/cesium-version.txt
curl --location --progress-bar https://cesiumjs.org/releases/Cesium-$(cesium_version).zip > docker/local/Cesium-$(cesium_version).zip

docker/local/cesium-terrain-server-$(checkout).tar.gz: $(GOFILES) docker/cts-checkout.txt docker/cesium-version.txt Makefile
git archive HEAD --prefix=cesium-terrain-server-$(checkout)/ --format=tar.gz -o docker/local/cesium-terrain-server-$(checkout).tar.gz
debug:
echo CESIUM_VERSION: $(CESIUM_VERSION)
echo checkout: $(checkout)
echo FRIENDLY_CHECKOUT: $(FRIENDLY_CHECKOUT)
echo GOFILES: $(GOFILES)
echo GOBINDATA: $(GOBINDATA)

.PHONY: docker-local install
.PHONY: docker-local install docker-tag docker-push git-latest-tag debug
25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ tools.

This project also provides a [Docker](https://www.docker.com/) container to
further simplify deployment of the server and testing of tilesets. See the
[Docker Registry](https://registry.hub.docker.com/u/geodata/cesium-terrain-server/)
[Docker Registry](https://registry.hub.docker.com/u/geo-data/cesium-terrain-server/)
for further details.

## Usage
Expand Down Expand Up @@ -160,13 +160,32 @@ A program called `cesium-terrain-server` should then be available under your

## Developing

The code has been developed on a Linux platform. After downloading the package
The code has been developed on a Linux/macOS platform. After downloading the package
you should be able to run `make` from the project root to build the server,
which will be available as `./bin/cesium-terrain-server`.

Note: Getting this building has been an absolute blast ... (not really many fixes)

Note: to make things mich less painful make sure you have set

- `GOPATH`
- `GOROOT`
- `GOBIN`
- `GO111MODULE` - optional

macOS / brew example ~/.zshrc

```.zshrc
export GOPATH="$HOME/go"
export GOROOT="$GOPATH"
export GOBIN="$GOROOT"/bin
# OPTIONAL, it might already be set
export GO111MODULE=on
```

Executing `make docker-local` will create a docker image tagged
`geodata/cesium-terrain-server:local` which when run with a bind mount to the
project source directory is very handy for developing and testing.
project source directory is very handy for developing and testing. NOTE: for your local changes to take effect within a docker image the local changes must be committed!

## Issues and Contributing

Expand Down
195 changes: 0 additions & 195 deletions assets/assets.go

This file was deleted.

Loading