Skip to content

Commit

Permalink
Making images, items, metadata configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
boggydigital committed Aug 17, 2023
1 parent 265c79a commit 90ac7fb
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 41 deletions.
10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ VOLUME /etc/vangogh
VOLUME /var/tmp
#app logs
VOLUME /var/log/vangogh
#app artifacts: checksums, images, metadata, recycle_bin, videos
#application data root (cold store): checksums, recycle_bin, videos
VOLUME /var/lib/vangogh
#ffmpeg (and dependencies) location
VOLUME /usr/local/sbin
#images (warm store)
VOLUME /var/lib/vangogh/images
#items (warm store)
VOLUME /var/lib/vangogh/items
#metadata (warm store)
VOLUME /var/lib/vangogh/metadata

ENTRYPOINT ["/usr/bin/vg"]
CMD ["serve","-port", "1853", "-stderr"]
10 changes: 0 additions & 10 deletions cli/dirs/dirs.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
package dirs

import "github.com/arelate/vangogh_local_data"

var AbsLogsDir = ""

func SetStateDir(d string) {
vangogh_local_data.ChRoot(d)
}

func SetTempDir(d string) {
vangogh_local_data.SetTempDir(d)
}

func SetLogsDir(d string) {
AbsLogsDir = d
}
26 changes: 16 additions & 10 deletions directories-example.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
config
# configuration: settings.txt
/etc/vangogh
# configuration: settings.txt
/etc/vangogh
logs
# logs
/var/log/vangogh
state
# directories: checksums, downloads, images, metadata, recycle_bin, videos
# files: skiplist.txt
/var/lib/vangogh
# logs
/var/log/vangogh
root
# directories: checksums, downloads, recycle_bin, videos
# files: skiplist.txt
/var/lib/vangogh
images
/var/lib/vangogh/images
items
/var/lib/vangogh/items
metadata
/var/lib/vangogh/metadata
temp
# temporary data: cookies.txt
/var/tmp
# temporary data: cookies.txt
/var/tmp
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
module github.com/arelate/vangogh

go 1.20
go 1.21

require (
github.com/arelate/southern_light v0.1.28
github.com/arelate/vangogh_local_data v0.2.94
github.com/arelate/vangogh_local_data v0.2.95
github.com/boggydigital/atomus v0.1.9
github.com/boggydigital/clo v0.3.6
github.com/boggydigital/coost v0.3.8
github.com/boggydigital/dolo v0.2.11
github.com/boggydigital/dolo v0.2.12
github.com/boggydigital/issa v0.1.10
github.com/boggydigital/kvas v0.3.28
github.com/boggydigital/kvas_dolo v0.1.6
github.com/boggydigital/middleware v0.1.10
github.com/boggydigital/nod v0.1.21
github.com/boggydigital/packer v0.1.0
github.com/boggydigital/wits v0.2.3
github.com/boggydigital/yt_urls v0.1.24
golang.org/x/exp v0.0.0-20230807204917-050eac23e9de
github.com/boggydigital/yt_urls v0.1.25
golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb
)

require (
github.com/boggydigital/match_node v0.1.14 // indirect
golang.org/x/image v0.11.0 // indirect
golang.org/x/net v0.12.0 // indirect
golang.org/x/net v0.14.0 // indirect
)
12 changes: 12 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@ github.com/arelate/southern_light v0.1.28 h1:aq56O1ixk3bfBY2kUlZ7PaEEPQrdm2fG78T
github.com/arelate/southern_light v0.1.28/go.mod h1:5P7A0MoqwBKSWhss/U26ny5qSwXkWJ83+PAWYQlvAXY=
github.com/arelate/vangogh_local_data v0.2.94 h1:rif8srnV3mgSNpgbJjmzEP+YhC4hriYofwCdR2N00W4=
github.com/arelate/vangogh_local_data v0.2.94/go.mod h1:b4VYneIcErLTW59EaV9ahJdeRUhKsF/nySvszZhBoz4=
github.com/arelate/vangogh_local_data v0.2.95 h1:w0q+I/+QW15exnk/TybYoqciCEoGItpwbTW4+QwS22w=
github.com/arelate/vangogh_local_data v0.2.95/go.mod h1:LAN01fnSbM2BKqAnWv6+/0yB3S4QkczNzjVc+/4FanQ=
github.com/boggydigital/atomus v0.1.9 h1:zAmXtAAXtBzMfz/83nEO4x8/uSLlPOq5wynW1jR/rbk=
github.com/boggydigital/atomus v0.1.9/go.mod h1:mvPDNDMrpFZ7RHbyMrt30hVXFU+VoeCvHnT83Zhj91I=
github.com/boggydigital/clo v0.3.6 h1:syeucZIM2/9B3jsUZqDo3TOYqgvJ6C1ketRgSuDoUf4=
github.com/boggydigital/clo v0.3.6/go.mod h1:7QbdMB008okXsdk41qJyJ6k/oJALIIXQ0GLYSxY9WFM=
github.com/boggydigital/clo v1.0.3 h1:Y9vmopsu/WLn+P37oRMzVUZvdBOPSTnI/OzvSFXLf1M=
github.com/boggydigital/clo v1.0.3/go.mod h1:Vd6WItzFzxrzpV7PRwytJwRHi7FaPs4zzVoaDYaNB68=
github.com/boggydigital/coost v0.3.8 h1:LMHuC5ftC60uSA8/eMv2/qOj5F/tK86XcQ/3qzEI33Y=
github.com/boggydigital/coost v0.3.8/go.mod h1:f5wbDShRqPvjX7ZBtrevnCFjcOe/lGBh0zV3KXsO/LY=
github.com/boggydigital/dolo v0.2.11 h1:L/VotXRJbuV7VN7H+eW4HQinYZHzUCeUOQ01++MFsPE=
github.com/boggydigital/dolo v0.2.11/go.mod h1:KyIaQOp2cV85hC6lTMRwHtzofzjxXr+msOgcs89t078=
github.com/boggydigital/dolo v0.2.12 h1:MrHk5IBqGrTMaaUfO6Ksnue9e5C7HpjqGlSKz1x6hF8=
github.com/boggydigital/dolo v0.2.12/go.mod h1:xOzQ4WPcyETrETGpuHRQRtXTFu8kkdXKQCcddbhU/tQ=
github.com/boggydigital/issa v0.1.9 h1:Na0WO1gdF6wKGnoNXADBINLlUultOHY9x2F3qVSjkn4=
github.com/boggydigital/issa v0.1.9/go.mod h1:TNYZ7A1mx+Ib7/o4nGQ/G9QLm3JPKV2xP8qBy+DA+ck=
github.com/boggydigital/issa v0.1.10 h1:zHSRJHkOz3DwVvp4/YL06qq/VHXexL7qrn4m48hRf/o=
Expand All @@ -31,11 +37,15 @@ github.com/boggydigital/wits v0.2.3 h1:Z0eB+QlIA18fJmblyV6ZJQ/swPYSFhOxfgMXOQz4/
github.com/boggydigital/wits v0.2.3/go.mod h1:aR/z0vfMLtg0b4hcts0qiSTZcA51O8A2N3U9laqd2Lc=
github.com/boggydigital/yt_urls v0.1.24 h1:aZSCOjHGc7jcLH/HaJSmps69Ce/VsYvWIJ9rXQ8mvdY=
github.com/boggydigital/yt_urls v0.1.24/go.mod h1:SmZeJzMogVwcY5VyL7o1w0Xkf4adR2L0N1ywtFmoRcA=
github.com/boggydigital/yt_urls v0.1.25 h1:rVfxPAuUss5w5Y3LBNi+VW2dOlf5co31xQnkIPMUveA=
github.com/boggydigital/yt_urls v0.1.25/go.mod h1:SmZeJzMogVwcY5VyL7o1w0Xkf4adR2L0N1ywtFmoRcA=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/exp v0.0.0-20230807204917-050eac23e9de h1:l5Za6utMv/HsBWWqzt4S8X17j+kt1uVETUX5UFhn2rE=
golang.org/x/exp v0.0.0-20230807204917-050eac23e9de/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb h1:mIKbk8weKhSeLH2GmUTrvx8CjkyJmnU1wFmg59CUjFA=
golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/image v0.11.0 h1:ds2RoQvBvYTiJkwpSFDwCcDFNX7DqjL2WsUgTNk0Ooo=
golang.org/x/image v0.11.0/go.mod h1:bglhjqbqVuEb9e9+eNR45Jfu7D+T4Qan+NhQk8Ck2P8=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
Expand All @@ -46,6 +56,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50=
golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down
46 changes: 34 additions & 12 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/arelate/vangogh/cli"
"github.com/arelate/vangogh/cli/dirs"
"github.com/arelate/vangogh/clo_delegates"
"github.com/arelate/vangogh_local_data"
"github.com/boggydigital/clo"
"github.com/boggydigital/nod"
"github.com/boggydigital/wits"
Expand All @@ -30,10 +31,13 @@ const (
)

var (
configDir = "/etc/vangogh"
logsDir = "/var/log/vangogh"
stateDir = "/var/lib/vangogh"
tempDir = "/var/tmp"
configDir = "/etc/vangogh"
logsDir = "/var/log/vangogh"
rootDir = "/var/lib/vangogh"
imagesDir = rootDir + "/images"
itemsDir = rootDir + "/items"
metadataDir = rootDir + "/metadata"
tempDir = "/var/tmp"
)

func main() {
Expand All @@ -49,8 +53,11 @@ func main() {
}

//set directories context in vangogh_cli_api
dirs.SetTempDir(tempDir)
dirs.SetStateDir(stateDir)
vangogh_local_data.SetTempDir(tempDir)
vangogh_local_data.ChRoot(rootDir)
vangogh_local_data.SetImagesDir(imagesDir)
vangogh_local_data.SetItemsDir(itemsDir)
vangogh_local_data.SetMetadataDir(metadataDir)
dirs.SetLogsDir(logsDir)

defs, err := clo.Load(
Expand Down Expand Up @@ -167,8 +174,17 @@ func readUserDirectories() error {
if ld, ok := dirs["logs"]; ok {
logsDir = ld
}
if sd, ok := dirs["state"]; ok {
stateDir = sd
if rd, ok := dirs["root"]; ok {
rootDir = rd
}
if imd, ok := dirs["images"]; ok {
imagesDir = imd
}
if itd, ok := dirs["items"]; ok {
itemsDir = itd
}
if md, ok := dirs["metadata"]; ok {
metadataDir = md
}
if td, ok := dirs["temp"]; ok {
tempDir = td
Expand All @@ -178,15 +194,21 @@ func readUserDirectories() error {
if _, err := os.Stat(configDir); err != nil {
return err
}

if _, err := os.Stat(logsDir); err != nil {
return err
}

if _, err := os.Stat(stateDir); err != nil {
if _, err := os.Stat(rootDir); err != nil {
return err
}
if _, err := os.Stat(imagesDir); err != nil {
return err
}
if _, err := os.Stat(itemsDir); err != nil {
return err
}
if _, err := os.Stat(metadataDir); err != nil {
return err
}

if _, err := os.Stat(tempDir); err != nil {
return err
}
Expand Down

0 comments on commit 90ac7fb

Please sign in to comment.