Create docker-compose to run ledger utilities
This commit is contained in:
parent
08e3260a31
commit
02f78d4c0e
7
.env
Normal file
7
.env
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# The parent folder containing your ledger files
|
||||||
|
LEDGER_DIR=data
|
||||||
|
# The name of your primary ledger file
|
||||||
|
LEDGER_FILE=all.ledger
|
||||||
|
|
||||||
|
HLEDGER_PORT=5000
|
||||||
|
HLEDGER_BASE_URL=http://localhost:5000
|
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
data/*
|
||||||
|
!data/.gitinclude
|
||||||
|
ledgerbil-settings.py
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "ledgerbil"]
|
||||||
|
path = ledgerbil
|
||||||
|
url = git@github.com:scarpent/ledgerbil.git
|
21
Dockerfile
21
Dockerfile
@ -1,21 +0,0 @@
|
|||||||
FROM dastapov/hledger:1.18.1
|
|
||||||
|
|
||||||
WORKDIR /data
|
|
||||||
|
|
||||||
RUN sudo useradd \
|
|
||||||
--shell /bin/bash \
|
|
||||||
--home-dir /data \
|
|
||||||
--no-create-home \
|
|
||||||
--uid 1000 \
|
|
||||||
hledger-user
|
|
||||||
|
|
||||||
# Setup for ledgerbill
|
|
||||||
RUN sudo apt update && sudo apt install -y curl python3 python3-pip
|
|
||||||
RUN sudo mkdir /ledgerbil \
|
|
||||||
&& sudo chown hledger /ledgerbil \
|
|
||||||
&& curl -L https://github.com/scarpent/ledgerbil/archive/main.tar.gz | tar -xz --strip-components=1 -C /ledgerbil \
|
|
||||||
&& cd /ledgerbil \
|
|
||||||
&& pip3 install -r requirements.txt
|
|
||||||
RUN echo 'alias ledgerbil="python3 /ledgerbil/main.py"' >> ~/.bashrc
|
|
||||||
|
|
||||||
|
|
17
README.md
Normal file
17
README.md
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# MetaLedger
|
||||||
|
|
||||||
|
## Setting Up
|
||||||
|
|
||||||
|
- Initialize the submodules
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git submodule init
|
||||||
|
git submodule update
|
||||||
|
```
|
||||||
|
|
||||||
|
- Put your ledger files in the data folder.
|
||||||
|
- Edit `.env` and fill in your desired values.
|
||||||
|
- Copy `ledgerbil/ledgerbil/settings.py.example` to `ledgerbil-settings.py` and fill in the values with your data.
|
||||||
|
- Start the services with `docker-compose up -d`
|
||||||
|
|
||||||
|
You can now access the web UI for hledger at your chosen URL (from the `.env` file), ledger-analytics, and use the helper scripts in the `bin` directory to use the various utilities. All utilities should be pre-configured with your ledger file location.
|
3
bin/hledger
Normal file
3
bin/hledger
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo TODO
|
3
bin/ledger
Normal file
3
bin/ledger
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo TODO
|
3
bin/ledgerbil
Normal file
3
bin/ledgerbil
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo TODO
|
3
bin/reconcile
Normal file
3
bin/reconcile
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo TODO
|
0
data/.gitinclude
Normal file
0
data/.gitinclude
Normal file
34
docker-compose.yaml
Normal file → Executable file
34
docker-compose.yaml
Normal file → Executable file
@ -1,12 +1,26 @@
|
|||||||
version: "3"
|
version: "3"
|
||||||
services:
|
services:
|
||||||
metaledger:
|
# TODO: Consider adding https://github.com/sbridges/ledgerble
|
||||||
image: "tgrosinger/metaledger"
|
ledgerbil:
|
||||||
build: "."
|
# https://github.com/scarpent/ledgerbil
|
||||||
ports:
|
image: "ledgerbil:latest"
|
||||||
- "5000:5000"
|
build: "ledgerbil/."
|
||||||
user: "1000"
|
volumes:
|
||||||
environment:
|
- "${LEDGER_DIR}:/data"
|
||||||
- HLEDGER_JOURNAL_FILE=/data/all.ledger
|
- "ledgerbil-settings.py:/code/ledgerbil/settings.py"
|
||||||
volumes:
|
ledger-analytics:
|
||||||
- "/home/tgrosinger/metaledger:/data"
|
# https://github.com/kendricktan/ledger-analytics
|
||||||
|
image: "ledger-analytics:latest"
|
||||||
|
build: "ledger-analytics/."
|
||||||
|
volumes:
|
||||||
|
- "${LEDGER_DIR}:/data"
|
||||||
|
entrypoint: ["ledger-analytics", "-f", "/data/${LEDGER_FILE}"]
|
||||||
|
hledger:
|
||||||
|
image: "dastapov/hledger:1.26"
|
||||||
|
ports:
|
||||||
|
- "${HLEDGER_PORT}:5000"
|
||||||
|
user: "1000"
|
||||||
|
environment:
|
||||||
|
- HLEDGER_JOURNAL_FILE=/data/${LEDGER_FILE}
|
||||||
|
volumes:
|
||||||
|
- "${LEDGER_DIR}:/data"
|
||||||
|
8
ledger-analytics/Dockerfile
Normal file
8
ledger-analytics/Dockerfile
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
FROM node:lts-slim
|
||||||
|
|
||||||
|
RUN npm install --location=global ledger-analytics
|
||||||
|
RUN apt update && apt install -y ledger
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
ENTRYPOINT ledger-analytics
|
1
ledgerbil
Submodule
1
ledgerbil
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 02dd7a843850a781c49881fb0e7026ebf98b189f
|
@ -1,8 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
docker run \
|
|
||||||
--rm \
|
|
||||||
-it \
|
|
||||||
--entrypoint bash \
|
|
||||||
-v /mnt/c/Users/tony/Documents/atrium/Ledger.md:/data/all.ledger \
|
|
||||||
-e "LEDGER_FILE=/data/all.ledger" \
|
|
||||||
tgrosinger/metaledger
|
|
Reference in New Issue
Block a user