mirror of
https://github.com/stevenhowes/osgrid-server.git
synced 2026-05-26 15:53:42 +01:00
Conversion to Makefile and systemd unit
This commit is contained in:
@@ -1 +0,0 @@
|
||||
node_modules
|
||||
@@ -1,2 +0,0 @@
|
||||
node_modules
|
||||
.idea/
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
FROM paulcager/go-base:latest as build
|
||||
|
||||
COPY * ./
|
||||
RUN CGO_ENABLED=0 go install -v ./... && \
|
||||
sha256sum /go/bin/osgrid-server
|
||||
|
||||
FROM scratch
|
||||
WORKDIR /app
|
||||
COPY --from=build /go/bin/osgrid-server .
|
||||
EXPOSE 9090
|
||||
|
||||
CMD [ "/app/osgrid-server" ]
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
.DEFAULT_GOAL := build
|
||||
|
||||
clean:
|
||||
rm -f osgrid-server
|
||||
|
||||
fmt:
|
||||
go fmt ./...
|
||||
.PHONY:fmt
|
||||
|
||||
lint: fmt
|
||||
golint ./...
|
||||
.PHONY:lint
|
||||
|
||||
vet: fmt
|
||||
go vet ./...
|
||||
.PHONY:vet
|
||||
|
||||
build: vet
|
||||
go build
|
||||
.PHONY:build
|
||||
|
||||
run: build
|
||||
./osgrid-server
|
||||
.PHONY:run
|
||||
|
||||
install: build
|
||||
mkdir -p /opt/sartools/
|
||||
useradd sartools || true
|
||||
chown sartools:sartools /opt/sartools/
|
||||
cp osgrid-server /opt/sartools/
|
||||
cp osgrid-server.service /etc/systemd/system/
|
||||
@@ -1,13 +1,22 @@
|
||||
# osgrid-server - _Ordnance Survey Grid Ref Converter_
|
||||
|
||||
This project implements a simple REST server to allow conversion between Ordnance Survey
|
||||
grid references and latitude / longitude.
|
||||
grid references and latitude / longitude. This fork runs without docker and includes
|
||||
a makefile implementing install, run, build, vet, lint, fmt and clean. As this is part
|
||||
of an intended set of SAR tools, installation is to /opt/sartools/ and will create the
|
||||
user 'sartools' if it does not exist.
|
||||
|
||||
## Pre-requisites
|
||||
- go
|
||||
- make
|
||||
- golint (optional)
|
||||
|
||||
## Usage
|
||||
|
||||
The easiest way is to start the server using Docker:
|
||||
To use this stand-alone (non Docker variant) on http://localhost:9090 just run:
|
||||
|
||||
docker run -d --rm --name osgrid-server -p 9090:9090 paulcager/osgrid-server
|
||||
make install
|
||||
service osgrid-server
|
||||
|
||||
A grid reference may then be converted to a lat / lon:
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
[Unit]
|
||||
Description=OS Grid Server
|
||||
ConditionPathExists=/opt/sartools/osgrid-server
|
||||
After=network.target
|
||||
[Service]
|
||||
Type=simple
|
||||
User=sartools
|
||||
Group=sartools
|
||||
WorkingDirectory=/opt/sartools/
|
||||
ExecStart=/opt/sartools/osgrid-server --port localhost:9090
|
||||
Restart=on-failure
|
||||
RestartSec=10
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog
|
||||
SyslogIdentifier=osgrid-server
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user