Initial commit

This commit is contained in:
bain 2024-08-01 23:06:48 +02:00
commit aa8462c951
Signed by: bain
GPG key ID: 31F0F25E3BED0B9B
10 changed files with 104 additions and 0 deletions

9
.gitmodules vendored Normal file
View file

@ -0,0 +1,9 @@
[submodule "ticker"]
path = ticker
url = https://github.com/systemli/ticker
[submodule "ticker-admin"]
path = ticker-admin
url = https://github.com/systemli/ticker-admin
[submodule "ticker-frontend"]
path = ticker-frontend
url = https://github.com/systemli/ticker-frontend

17
Dockerfile Normal file
View file

@ -0,0 +1,17 @@
FROM alpine
RUN apk add nginx libc6-compat gcompat sqlite
# believe or not, this is what the official image does
RUN ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log
COPY ticker-web.conf /etc/nginx/http.d/default.conf
COPY ticker-admin/dist /var/www/admin
COPY ticker-frontend/dist /var/www/frontend
COPY ticker/ticker /ticker-bin
WORKDIR /ticker
CMD [ "sh", "-c", "nginx; /ticker-bin run --config /config.yml" ]

8
README.md Normal file
View file

@ -0,0 +1,8 @@
# Ticker AIO docker image
Publishes:
- ticker API on 8080
- frontend for tickers on 8081
- admin frontend on 8082
See `config.yml.sample` and `docker-compose.yml` for a setup example.

25
build.sh Executable file
View file

@ -0,0 +1,25 @@
#!/bin/env bash
set -e
if [ -z "$TICKER_API_URL" ]; then
echo "TICKER_API_URL env not set";
exit 1;
fi
pushd ticker-admin
yarn
yarn run build
popd
pushd ticker-frontend
yarn
yarn run build
popd
pushd ticker
go build -ldflags '-linkmode external -extldflags -static -w' .
popd
docker build -t ticker-aio .
echo "successfully build ticker-aio image"

11
config.yml.sample Normal file
View file

@ -0,0 +1,11 @@
# listen binds ticker to specific address and port
listen: "0.0.0.0:8080"
# log_level sets log level for logrus
log_level: "error"
# configuration for the database
database:
type: "sqlite" # postgres, mysql, sqlite
dsn: "ticker.db" # postgres: "host=localhost port=5432 user=ticker dbname=ticker password=ticker sslmode=disable"
# secret used for JSON Web Tokens
secret: "SECRETTTTTTTTTT"

10
docker-compose.yml Normal file
View file

@ -0,0 +1,10 @@
services:
ticker:
build: .
volumes:
- ./ticker-mount:/ticker
- ./config.yml:/config.yml
ports:
- 8080:8080
- 8081:8081
- 8082:8082

1
ticker Submodule

@ -0,0 +1 @@
Subproject commit dd0ba8768f67ae380d2113d6426740ff77fca936

1
ticker-admin Submodule

@ -0,0 +1 @@
Subproject commit 9b5e60b5fbb5a2bf2d1866f8f2974057a71ed0e4

1
ticker-frontend Submodule

@ -0,0 +1 @@
Subproject commit f2cb391b27b8b88398725d322edb68fe1a18a6bd

21
ticker-web.conf Normal file
View file

@ -0,0 +1,21 @@
server {
listen 8081 default_server;
server_name _;
root /var/www/frontend;
location / {
try_files $uri $uri/ =404;
}
}
server {
listen 8082 default_server;
server_name _;
root /var/www/admin;
location / {
try_files $uri $uri/ =404;
}
}