Commit 2340a56

Eric Bower  ·  2026-01-16 22:14:04 -0500 EST
parent 67ea1f3
refactor: remove minio

We haven't used minio in months and if we did choose another object storage it wouldn't minio
14 files changed,  +5, -495
M dev.md
M go.mod
M go.sum
+0, -79
......@@ -1,79 +0,0 @@
1-{
2- servers {
3- metrics
4- }
5-}
6-
7-*.minio.{$APP_DOMAIN}, *.{$APP_DOMAIN}, {$APP_DOMAIN} {
8- tls {$APP_EMAIL} {
9- dns cloudflare {$CF_API_TOKEN}
10- resolvers 1.1.1.1
11- }
12- encode zstd gzip
13-
14- header {
15- # disable FLoC tracking
16- Permissions-Policy interest-cohort=()
17-
18- # enable HSTS
19- Strict-Transport-Security max-age=31536000;
20-
21- # disable clients from sniffing the media type
22- X-Content-Type-Options nosniff
23-
24- # clickjacking protection
25- X-Frame-Options DENY
26-
27- # keep referrer data off of HTTP connections
28- Referrer-Policy no-referrer-when-downgrade
29-
30- Content-Security-Policy "default-src 'self'; img-src * 'unsafe-inline'; style-src * 'unsafe-inline'"
31-
32- X-XSS-Protection "1; mode=block"
33- }
34-
35- @caddymetrics {
36- host minio.{$APP_DOMAIN}
37- path /_caddy/metrics
38- }
39-
40- metrics @caddymetrics {
41- disable_openmetrics
42- }
43-
44- @console {
45- host console.minio.{$APP_DOMAIN}
46- }
47-
48- handle @console {
49- reverse_proxy minio:9001
50- }
51-
52- @imgproxy_prometheus {
53- host imgproxy.{$APP_DOMAIN}
54- path /metrics
55- }
56-
57- handle @imgproxy_prometheus {
58- reverse_proxy imgproxy:8081
59- }
60-
61- @imgproxy_root {
62- host imgproxy.{$APP_DOMAIN}
63- path /
64- }
65-
66- handle @imgproxy_root {
67- redir https://pico.sh
68- }
69-
70- @imgproxy {
71- host imgproxy.{$APP_DOMAIN}
72- }
73-
74- handle @imgproxy {
75- reverse_proxy imgproxy:8080
76- }
77-
78- reverse_proxy minio:9000
79-}
M dev.md
+1, -1
......@@ -7,7 +7,7 @@
77 cp ./.env.example .env
88 ```
99
10-If you are running apps outside of docker, remember to change the postgres, minio, and imgproxy hostnames to "localhost" in `.env`.
10+If you are running apps outside of docker, remember to change the postgres, and imgproxy hostnames to "localhost" in `.env`.
1111
1212 Initialize local env variables using direnv
1313
+0, -6
......@@ -5,12 +5,6 @@ services:
55 ports:
66 - "5432:5432"
77 command: -c log_statement=all -c log_destination=stderr
8- minio:
9- env_file:
10- - .env.example
11- ports:
12- - "9000:9000"
13- - "9001:9001"
148 imgproxy:
159 env_file:
1610 - .env.example
+0, -23
......@@ -7,29 +7,6 @@ services:
77 ports:
88 - "5432:5432"
99 command: -N 1024 -B 4096MB
10- minio-caddy:
11- image: ghcr.io/picosh/pico/caddy:latest
12- restart: always
13- env_file:
14- - .env.prod
15- environment:
16- APP_DOMAIN: pico.sh
17- APP_EMAIL: ${MINIO_EMAIL:-hello@pico.sh}
18- volumes:
19- - ${MINIO_CADDYFILE}:/etc/caddy/Caddyfile
20- - ./data/minio-caddy/data:/data
21- - ./data/minio-caddy/config:/config
22- ports:
23- - "80:80"
24- - "443:443"
25- profiles:
26- - minio
27- - all
28- minio:
29- env_file:
30- - .env.prod
31- volumes:
32- - ./data/minio-data:/data
3310 pipemgr:
3411 env_file:
3512 - .env.prod
+0, -8
......@@ -5,18 +5,10 @@ services:
55 profiles:
66 - db
77 - all
8- minio:
9- image: quay.io/minio/minio
10- command: server /data --console-address ":9001"
11- restart: always
12- profiles:
13- - minio
14- - all
158 imgproxy:
169 image: darthsim/imgproxy:latest
1710 restart: always
1811 profiles:
19- - minio
2012 - all
2113 - prose
2214 - pgs
M go.mod
+2, -16
......@@ -42,8 +42,6 @@ require (
4242 github.com/lib/pq v1.10.9
4343 github.com/matryer/is v1.4.1
4444 github.com/microcosm-cc/bluemonday v1.0.27
45- github.com/minio/madmin-go/v3 v3.0.102
46- github.com/minio/minio-go/v7 v7.0.89
4745 github.com/mmcdole/gofeed v1.3.0
4846 github.com/neurosnap/go-exif-remove v0.0.0-20221010134343-50d1e3c35577
4947 github.com/picosh/go-rsync-receiver v0.0.0-20250304201040-fcc11dd22d79
......@@ -150,11 +148,11 @@ require (
150148 github.com/felixge/httpsnoop v1.0.4 // indirect
151149 github.com/forPelevin/gomoji v1.3.0 // indirect
152150 github.com/francoispqt/gojay v1.2.13 // indirect
151+ github.com/fsnotify/fsnotify v1.8.0 // indirect
153152 github.com/gammazero/deque v1.0.0 // indirect
154153 github.com/gkampitakis/ciinfo v0.3.0 // indirect
155154 github.com/gkampitakis/go-diff v1.3.2 // indirect
156155 github.com/go-errors/errors v1.5.1 // indirect
157- github.com/go-ini/ini v1.67.0 // indirect
158156 github.com/go-jose/go-jose/v3 v3.0.4 // indirect
159157 github.com/go-jose/go-jose/v4 v4.0.5 // indirect
160158 github.com/go-logr/logr v1.4.2 // indirect
......@@ -164,11 +162,9 @@ require (
164162 github.com/go-sql-driver/mysql v1.9.1 // indirect
165163 github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
166164 github.com/go-xmlfmt/xmlfmt v1.1.3 // indirect
167- github.com/goccy/go-json v0.10.5 // indirect
168165 github.com/godbus/dbus/v5 v5.1.0 // indirect
169166 github.com/gofrs/flock v0.12.1 // indirect
170167 github.com/gogo/protobuf v1.3.2 // indirect
171- github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
172168 github.com/golang/geo v0.0.0-20250328065203-0b6e08c212fb // indirect
173169 github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
174170 github.com/golang/protobuf v1.5.4 // indirect
......@@ -209,13 +205,10 @@ require (
209205 github.com/mattn/go-isatty v0.0.20 // indirect
210206 github.com/mattn/go-runewidth v0.0.16 // indirect
211207 github.com/mattn/go-sixel v0.0.5 // indirect
212- github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
213208 github.com/maypok86/otter v1.2.4 // indirect
214209 github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
215210 github.com/mholt/acmez/v3 v3.1.2 // indirect
216211 github.com/miekg/dns v1.1.64 // indirect
217- github.com/minio/crc64nvme v1.0.1 // indirect
218- github.com/minio/md5-simd v1.1.2 // indirect
219212 github.com/mitchellh/copystructure v1.2.0 // indirect
220213 github.com/mitchellh/go-ps v1.0.0 // indirect
221214 github.com/mitchellh/reflectwalk v1.0.2 // indirect
......@@ -243,7 +236,6 @@ require (
243236 github.com/opencontainers/go-digest v1.0.0 // indirect
244237 github.com/opencontainers/image-spec v1.1.1 // indirect
245238 github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
246- github.com/philhofer/fwd v1.1.3-0.20240916144458-20a13a1f6b7c // indirect
247239 github.com/pierrec/lz4/v4 v4.1.22 // indirect
248240 github.com/pkg/errors v0.9.1 // indirect
249241 github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
......@@ -252,8 +244,6 @@ require (
252244 github.com/prometheus/client_model v0.6.2 // indirect
253245 github.com/prometheus/common v0.63.0 // indirect
254246 github.com/prometheus/procfs v0.16.0 // indirect
255- github.com/prometheus/prom2json v1.4.1 // indirect
256- github.com/prometheus/prometheus v0.302.1 // indirect
257247 github.com/quic-go/qpack v0.5.1 // indirect
258248 github.com/quic-go/quic-go v0.50.1 // indirect
259249 github.com/redis/rueidis v1.0.56 // indirect
......@@ -262,12 +252,8 @@ require (
262252 github.com/rogpeppe/go-internal v1.13.2-0.20241226121412-a5dc8ff20d0a // indirect
263253 github.com/rs/xid v1.6.0 // indirect
264254 github.com/russross/blackfriday/v2 v2.1.0 // indirect
265- github.com/safchain/ethtool v0.5.10 // indirect
266255 github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect
267- github.com/secure-io/sio-go v0.3.1 // indirect
268- github.com/shirou/gopsutil/v3 v3.24.5 // indirect
269256 github.com/shirou/gopsutil/v4 v4.25.6 // indirect
270- github.com/shoenig/go-m1cpu v0.1.6 // indirect
271257 github.com/shopspring/decimal v1.4.0 // indirect
272258 github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
273259 github.com/sirupsen/logrus v1.9.3 // indirect
......@@ -292,7 +278,6 @@ require (
292278 github.com/tidwall/pretty v1.2.1 // indirect
293279 github.com/tidwall/redcon v1.6.2 // indirect
294280 github.com/tidwall/sjson v1.2.5 // indirect
295- github.com/tinylib/msgp v1.2.5 // indirect
296281 github.com/tklauser/go-sysconf v0.3.15 // indirect
297282 github.com/tklauser/numcpus v0.10.0 // indirect
298283 github.com/urfave/cli v1.22.16 // indirect
......@@ -310,6 +295,7 @@ require (
310295 go.opentelemetry.io/auto/sdk v1.1.0 // indirect
311296 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.59.0 // indirect
312297 go.opentelemetry.io/otel v1.35.0 // indirect
298+ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.34.0 // indirect
313299 go.opentelemetry.io/otel/metric v1.35.0 // indirect
314300 go.opentelemetry.io/otel/trace v1.35.0 // indirect
315301 go.step.sm/crypto v0.60.0 // indirect
M go.sum
+0, -38
......@@ -333,8 +333,6 @@ github.com/go-errors/errors v1.0.2/go.mod h1:psDX2osz5VnTOnFWbDeWwS7yejl+uV3FEWE
333333 github.com/go-errors/errors v1.1.1/go.mod h1:psDX2osz5VnTOnFWbDeWwS7yejl+uV3FEWEp4lssFEs=
334334 github.com/go-errors/errors v1.5.1 h1:ZwEMSLRCapFLflTpT7NKaAc7ukJ8ZPEjzlxt8rPN8bk=
335335 github.com/go-errors/errors v1.5.1/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
336-github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A=
337-github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
338336 github.com/go-jose/go-jose/v3 v3.0.4 h1:Wp5HA7bLQcKnf6YYao/4kpRpVMp/yf6+pJKV8WFSaNY=
339337 github.com/go-jose/go-jose/v3 v3.0.4/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ=
340338 github.com/go-jose/go-jose/v4 v4.0.5 h1:M6T8+mKZl/+fNNuFHvGIzDz7BTLQPIounk/b9dw3AaE=
......@@ -365,8 +363,6 @@ github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZ
365363 github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM=
366364 github.com/go-xmlfmt/xmlfmt v1.1.3 h1:t8Ey3Uy7jDSEisW2K3somuMKIpzktkWptA0iFCnRUWY=
367365 github.com/go-xmlfmt/xmlfmt v1.1.3/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM=
368-github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
369-github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
370366 github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
371367 github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
372368 github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
......@@ -375,8 +371,6 @@ github.com/gofrs/flock v0.12.1/go.mod h1:9zxTsyu5xtJ9DK+1tFZyibEV7y3uwDxPPfbxeeH
375371 github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
376372 github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
377373 github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
378-github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI=
379-github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
380374 github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI=
381375 github.com/golang/geo v0.0.0-20200319012246-673a6f80352d/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI=
382376 github.com/golang/geo v0.0.0-20250328065203-0b6e08c212fb h1:eqdj1jSZjgmPdSl2lr3rAwJykSe9jHxPN1zLuasKVh0=
......@@ -541,7 +535,6 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o
541535 github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
542536 github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
543537 github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
544-github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
545538 github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
546539 github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
547540 github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
......@@ -591,8 +584,6 @@ github.com/mattn/go-sixel v0.0.5/go.mod h1:h2Sss+DiUEHy0pUqcIB6PFXo5Cy8sTQEFr3a9
591584 github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
592585 github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
593586 github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
594-github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
595-github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
596587 github.com/maypok86/otter v1.2.4 h1:HhW1Pq6VdJkmWwcZZq19BlEQkHtI8xgsQzBVXJU0nfc=
597588 github.com/maypok86/otter v1.2.4/go.mod h1:mKLfoI7v1HOmQMwFgX4QkRk23mX6ge3RDvjdHOWG4R4=
598589 github.com/mdelapenya/tlscert v0.2.0 h1:7H81W6Z/4weDvZBNOfQte5GpIMo0lGYEeWbkGp5LJHI=
......@@ -608,14 +599,6 @@ github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKju
608599 github.com/miekg/dns v1.1.45/go.mod h1:e3IlAVfNqAllflbibAZEWOXOQ+Ynzk/dDozDxY7XnME=
609600 github.com/miekg/dns v1.1.64 h1:wuZgD9wwCE6XMT05UU/mlSko71eRSXEAm2EbjQXLKnQ=
610601 github.com/miekg/dns v1.1.64/go.mod h1:Dzw9769uoKVaLuODMDZz9M6ynFU6Em65csPuoi8G0ck=
611-github.com/minio/crc64nvme v1.0.1 h1:DHQPrYPdqK7jQG/Ls5CTBZWeex/2FMS3G5XGkycuFrY=
612-github.com/minio/crc64nvme v1.0.1/go.mod h1:eVfm2fAzLlxMdUGc0EEBGSMmPwmXD5XiNRpnu9J3bvg=
613-github.com/minio/madmin-go/v3 v3.0.102 h1:bqy15D6d9uQOh/3B/sLfzRtWSJgZeuKnAI5VRDhvRQw=
614-github.com/minio/madmin-go/v3 v3.0.102/go.mod h1:pMLdj9OtN0CANNs5tdm6opvOlDFfj0WhbztboZAjRWE=
615-github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=
616-github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM=
617-github.com/minio/minio-go/v7 v7.0.89 h1:hx4xV5wwTUfyv8LarhJAwNecnXpoTsj9v3f3q/ZkiJU=
618-github.com/minio/minio-go/v7 v7.0.89/go.mod h1:2rFnGAp02p7Dddo1Fq4S2wYOfpF0MUTSeLTRC90I204=
619602 github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
620603 github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
621604 github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
......@@ -709,8 +692,6 @@ github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhM
709692 github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
710693 github.com/peterbourgon/diskv/v3 v3.0.1 h1:x06SQA46+PKIUftmEujdwSEpIx8kR+M9eLYsUxeYveU=
711694 github.com/peterbourgon/diskv/v3 v3.0.1/go.mod h1:kJ5Ny7vLdARGU3WUuy6uzO6T0nb/2gWcT1JiBvRmb5o=
712-github.com/philhofer/fwd v1.1.3-0.20240916144458-20a13a1f6b7c h1:dAMKvw0MlJT1GshSTtih8C2gDs04w8dReiOGXrGLNoY=
713-github.com/philhofer/fwd v1.1.3-0.20240916144458-20a13a1f6b7c/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM=
714695 github.com/picosh/go-rsync-receiver v0.0.0-20250304201040-fcc11dd22d79 h1:MyB9P43hlQ6A2FoP9LGeiTBL3WKToW4gcWd6lQPg/Zg=
715696 github.com/picosh/go-rsync-receiver v0.0.0-20250304201040-fcc11dd22d79/go.mod h1:4ZICsr6bESoHP8He9DqROlZiMw4hHHjcbDzhtTTDQzA=
716697 github.com/picosh/pubsub v0.0.0-20241114191831-ec8f16c0eb88 h1:hdxE6rquHHw1/eeqS1b+ojLaxGtN8zOiTUclPwaVbPg=
......@@ -765,10 +746,6 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O
765746 github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
766747 github.com/prometheus/procfs v0.16.0 h1:xh6oHhKwnOJKMYiYBDWmkHqQPyiY40sny36Cmx2bbsM=
767748 github.com/prometheus/procfs v0.16.0/go.mod h1:8veyXUu3nGP7oaCxhX6yeaM5u4stL2FeMXnCqhDthZg=
768-github.com/prometheus/prom2json v1.4.1 h1:7McxdrHgPEOtMwWjkKtd0v5AhpR2Q6QAnlHKVxq0+tQ=
769-github.com/prometheus/prom2json v1.4.1/go.mod h1:CzOQykSKFxXuC7ELUZHOHQvwKesQ3eN0p2PWLhFitQM=
770-github.com/prometheus/prometheus v0.302.1 h1:xqVdrwrB4WNpdgJqxsz5loqFWNUZitsK8myqLuSZ6Ag=
771-github.com/prometheus/prometheus v0.302.1/go.mod h1:YcyCoTbUR/TM8rY3Aoeqr0AWTu/pu1Ehh+trpX3eRzg=
772749 github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI=
773750 github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg=
774751 github.com/quic-go/quic-go v0.50.1 h1:unsgjFIUqW8a2oopkY7YNONpV1gYND6Nt9hnt1PN94Q=
......@@ -792,24 +769,14 @@ github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD
792769 github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
793770 github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
794771 github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
795-github.com/safchain/ethtool v0.5.10 h1:Im294gZtuf4pSGJRAOGKaASNi3wMeFaGaWuSaomedpc=
796-github.com/safchain/ethtool v0.5.10/go.mod h1:w9jh2Lx7YBR4UwzLkzCmWl85UY0W2uZdd7/DckVE5+c=
797772 github.com/schollz/jsonstore v1.1.0 h1:WZBDjgezFS34CHI+myb4s8GGpir3UMpy7vWoCeO0n6E=
798773 github.com/schollz/jsonstore v1.1.0/go.mod h1:15c6+9guw8vDRyozGjN3FoILt0wpruJk9Pi66vjaZfg=
799774 github.com/scylladb/termtables v0.0.0-20191203121021-c4c0b6d42ff4/go.mod h1:C1a7PQSMz9NShzorzCiG2fk9+xuCgLkPeCvMHYR2OWg=
800775 github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I=
801776 github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
802-github.com/secure-io/sio-go v0.3.1 h1:dNvY9awjabXTYGsTF1PiCySl9Ltofk9GA3VdWlo7rRc=
803-github.com/secure-io/sio-go v0.3.1/go.mod h1:+xbkjDzPjwh4Axd07pRKSNriS9SCiYksWnZqdnfpQxs=
804777 github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
805-github.com/shirou/gopsutil/v3 v3.24.5 h1:i0t8kL+kQTvpAYToeuiVk3TgDeKOFioZO3Ztz/iZ9pI=
806-github.com/shirou/gopsutil/v3 v3.24.5/go.mod h1:bsoOS1aStSs9ErQ1WWfxllSeS1K5D+U30r2NfcubMVk=
807778 github.com/shirou/gopsutil/v4 v4.25.6 h1:kLysI2JsKorfaFPcYmcJqbzROzsBWEOAtw6A7dIfqXs=
808779 github.com/shirou/gopsutil/v4 v4.25.6/go.mod h1:PfybzyydfZcN+JMMjkF6Zb8Mq1A/VcogFFg7hj50W9c=
809-github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM=
810-github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ=
811-github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU=
812-github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k=
813780 github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
814781 github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
815782 github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY=
......@@ -926,8 +893,6 @@ github.com/tidwall/redcon v1.6.2 h1:5qfvrrybgtO85jnhSravmkZyC0D+7WstbfCs3MmPhow=
926893 github.com/tidwall/redcon v1.6.2/go.mod h1:p5Wbsgeyi2VSTBWOcA5vRXrOb9arFTcU2+ZzFjqV75Y=
927894 github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY=
928895 github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28=
929-github.com/tinylib/msgp v1.2.5 h1:WeQg1whrXRFiZusidTQqzETkRpGjFjcIhW6uqWH09po=
930-github.com/tinylib/msgp v1.2.5/go.mod h1:ykjzy2wzgrlvpDCRc4LA8UXy6D8bzMSuAF3WD57Gok0=
931896 github.com/tklauser/go-sysconf v0.3.15 h1:VE89k0criAymJ/Os65CSn1IXaol+1wrsFHEB8Ol49K4=
932897 github.com/tklauser/go-sysconf v0.3.15/go.mod h1:Dmjwr6tYFIseJw7a3dRLJfsHAMXZ3nEnL/aZY+0IuI4=
933898 github.com/tklauser/numcpus v0.10.0 h1:18njr6LDBk1zuna922MgdjQuJFjrdppsZG60sHGfjso=
......@@ -1032,7 +997,6 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
1032997 golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
1033998 golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY=
1034999 golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
1035-golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
10361000 golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
10371001 golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
10381002 golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
......@@ -1154,7 +1118,6 @@ golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7w
11541118 golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
11551119 golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
11561120 golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
1157-golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
11581121 golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
11591122 golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
11601123 golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
......@@ -1186,7 +1149,6 @@ golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
11861149 golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
11871150 golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
11881151 golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
1189-golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
11901152 golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
11911153 golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
11921154 golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
+0, -8
......@@ -3,9 +3,7 @@ package pobj
33 import (
44 "errors"
55 "io"
6- "net/http"
76
8- "github.com/minio/minio-go/v7"
97 "github.com/picosh/pico/pkg/send/utils"
108 )
119
......@@ -24,12 +22,6 @@ func (a *AllReaderAt) ReadAt(p []byte, off int64) (n int, err error) {
2422 return
2523 }
2624
27- resp := minio.ToErrorResponse(err)
28-
29- if resp.StatusCode == http.StatusRequestedRangeNotSatisfiable {
30- err = io.EOF
31- }
32-
3325 return
3426 }
3527
+0, -1
......@@ -96,7 +96,6 @@ func (s *StorageFS) GetBucketQuota(bucket Bucket) (uint64, error) {
9696 }
9797
9898 // DeleteBucket will delete all contents regardless if files exist inside of it.
99-// This is different from minio impl which requires all files be deleted first.
10099 func (s *StorageFS) DeleteBucket(bucket Bucket) error {
101100 return os.RemoveAll(bucket.Path)
102101 }
+0, -247
......@@ -1,247 +0,0 @@
1-package storage
2-
3-import (
4- "context"
5- "errors"
6- "fmt"
7- "io"
8- "log/slog"
9- "net/url"
10- "os"
11- "strconv"
12- "strings"
13- "time"
14-
15- "github.com/hashicorp/golang-lru/v2/expirable"
16- "github.com/minio/madmin-go/v3"
17- "github.com/minio/minio-go/v7"
18- "github.com/minio/minio-go/v7/pkg/credentials"
19- "github.com/picosh/pico/pkg/cache"
20- "github.com/picosh/pico/pkg/send/utils"
21-)
22-
23-type StorageMinio struct {
24- Client *minio.Client
25- Admin *madmin.AdminClient
26- BucketCache *expirable.LRU[string, CachedBucket]
27- Logger *slog.Logger
28-}
29-
30-type CachedBucket struct {
31- Bucket
32- Error error
33-}
34-
35-type CachedObjectInfo struct {
36- *ObjectInfo
37- Error error
38-}
39-
40-var (
41- _ ObjectStorage = &StorageMinio{}
42- _ ObjectStorage = (*StorageMinio)(nil)
43-)
44-
45-func NewStorageMinio(logger *slog.Logger, address, user, pass string) (*StorageMinio, error) {
46- endpoint, err := url.Parse(address)
47- if err != nil {
48- return nil, err
49- }
50- ssl := endpoint.Scheme == "https"
51-
52- mClient, err := minio.New(endpoint.Host, &minio.Options{
53- Creds: credentials.NewStaticV4(user, pass, ""),
54- Secure: ssl,
55- })
56- if err != nil {
57- return nil, err
58- }
59-
60- aClient, err := madmin.NewWithOptions(
61- endpoint.Host,
62- &madmin.Options{
63- Creds: credentials.NewStaticV4(user, pass, ""),
64- Secure: ssl,
65- },
66- )
67- if err != nil {
68- return nil, err
69- }
70-
71- mini := &StorageMinio{
72- Client: mClient,
73- Admin: aClient,
74- BucketCache: expirable.NewLRU[string, CachedBucket](2048, nil, cache.CacheTimeout),
75- Logger: logger,
76- }
77- return mini, err
78-}
79-
80-func (s *StorageMinio) GetBucket(name string) (Bucket, error) {
81- if cachedBucket, found := s.BucketCache.Get(name); found {
82- s.Logger.Info("bucket found in lru cache", "name", name)
83- return cachedBucket.Bucket, cachedBucket.Error
84- }
85-
86- s.Logger.Info("bucket not found in lru cache", "name", name)
87-
88- bucket := Bucket{
89- Name: name,
90- }
91-
92- exists, err := s.Client.BucketExists(context.TODO(), bucket.Name)
93- if err != nil || !exists {
94- if err == nil {
95- err = errors.New("bucket does not exist")
96- }
97-
98- s.BucketCache.Add(name, CachedBucket{bucket, err})
99- return bucket, err
100- }
101-
102- s.BucketCache.Add(name, CachedBucket{bucket, nil})
103-
104- return bucket, nil
105-}
106-
107-func (s *StorageMinio) UpsertBucket(name string) (Bucket, error) {
108- bucket, err := s.GetBucket(name)
109- if err == nil {
110- return bucket, nil
111- }
112-
113- err = s.Client.MakeBucket(context.TODO(), name, minio.MakeBucketOptions{})
114- if err != nil {
115- return bucket, err
116- }
117-
118- s.BucketCache.Remove(name)
119-
120- return bucket, nil
121-}
122-
123-func (s *StorageMinio) GetBucketQuota(bucket Bucket) (uint64, error) {
124- info, err := s.Admin.AccountInfo(context.TODO(), madmin.AccountOpts{})
125- if err != nil {
126- return 0, nil
127- }
128- for _, b := range info.Buckets {
129- if b.Name == bucket.Name {
130- return b.Size, nil
131- }
132- }
133-
134- return 0, fmt.Errorf("%s bucket not found in account info", bucket.Name)
135-}
136-
137-func (s *StorageMinio) ListBuckets() ([]string, error) {
138- bcks := []string{}
139- buckets, err := s.Client.ListBuckets(context.Background())
140- if err != nil {
141- return bcks, err
142- }
143- for _, bucket := range buckets {
144- bcks = append(bcks, bucket.Name)
145- }
146-
147- return bcks, nil
148-}
149-
150-func (s *StorageMinio) ListObjects(bucket Bucket, dir string, recursive bool) ([]os.FileInfo, error) {
151- var fileList []os.FileInfo
152-
153- resolved := strings.TrimPrefix(dir, "/")
154-
155- opts := minio.ListObjectsOptions{Prefix: resolved, Recursive: recursive, WithMetadata: true}
156- for obj := range s.Client.ListObjects(context.Background(), bucket.Name, opts) {
157- if obj.Err != nil {
158- return fileList, obj.Err
159- }
160-
161- isDir := strings.HasSuffix(obj.Key, string(os.PathSeparator))
162-
163- modTime := obj.LastModified
164-
165- if mtime, ok := obj.UserMetadata["Mtime"]; ok {
166- mtimeUnix, err := strconv.Atoi(mtime)
167- if err == nil {
168- modTime = time.Unix(int64(mtimeUnix), 0)
169- }
170- }
171-
172- info := &utils.VirtualFile{
173- FName: strings.TrimSuffix(strings.TrimPrefix(obj.Key, resolved), "/"),
174- FIsDir: isDir,
175- FSize: obj.Size,
176- FModTime: modTime,
177- }
178- fileList = append(fileList, info)
179- }
180-
181- return fileList, nil
182-}
183-
184-func (s *StorageMinio) DeleteBucket(bucket Bucket) error {
185- return s.Client.RemoveBucket(context.TODO(), bucket.Name)
186-}
187-
188-func (s *StorageMinio) GetObject(bucket Bucket, fpath string) (utils.ReadAndReaderAtCloser, *ObjectInfo, error) {
189- objInfo := &ObjectInfo{
190- Size: 0,
191- LastModified: time.Time{},
192- ETag: "",
193- }
194-
195- info, err := s.Client.StatObject(context.Background(), bucket.Name, fpath, minio.StatObjectOptions{})
196- if err != nil {
197- return nil, objInfo, err
198- }
199-
200- objInfo.LastModified = info.LastModified
201- objInfo.ETag = info.ETag
202- objInfo.Metadata = info.Metadata
203- objInfo.Size = info.Size
204-
205- if mtime, ok := info.UserMetadata["Mtime"]; ok {
206- mtimeUnix, err := strconv.Atoi(mtime)
207- if err == nil {
208- objInfo.LastModified = time.Unix(int64(mtimeUnix), 0)
209- }
210- }
211-
212- obj, err := s.Client.GetObject(context.Background(), bucket.Name, fpath, minio.GetObjectOptions{})
213- if err != nil {
214- return nil, objInfo, err
215- }
216-
217- return obj, objInfo, nil
218-}
219-
220-func (s *StorageMinio) PutObject(bucket Bucket, fpath string, contents io.Reader, entry *utils.FileEntry) (string, int64, error) {
221- opts := minio.PutObjectOptions{
222- UserMetadata: map[string]string{
223- "Mtime": fmt.Sprint(time.Now().Unix()),
224- },
225- }
226-
227- if entry.Mtime > 0 {
228- opts.UserMetadata["Mtime"] = fmt.Sprint(entry.Mtime)
229- }
230-
231- var objSize int64 = -1
232- if entry.Size > 0 {
233- objSize = entry.Size
234- }
235- info, err := s.Client.PutObject(context.TODO(), bucket.Name, fpath, contents, objSize, opts)
236-
237- if err != nil {
238- return "", 0, err
239- }
240-
241- return fmt.Sprintf("%s/%s", info.Bucket, info.Key), info.Size, nil
242-}
243-
244-func (s *StorageMinio) DeleteObject(bucket Bucket, fpath string) error {
245- err := s.Client.RemoveObject(context.TODO(), bucket.Name, fpath, minio.RemoveObjectOptions{})
246- return err
247-}
+0, -10
......@@ -21,16 +21,6 @@ func EnvDriverDetector(logger *slog.Logger) (storage.ObjectStorage, error) {
2121 switch driver {
2222 case "memory":
2323 return storage.NewStorageMemory(map[string]map[string]string{})
24- case "minio":
25- url := GetEnv("MINIO_URL", "")
26- user := GetEnv("MINIO_ROOT_USER", "")
27- pass := GetEnv("MINIO_ROOT_PASSWORD", "")
28- logger.Info(
29- "object config detected",
30- "url", url,
31- "user", user,
32- )
33- return storage.NewStorageMinio(logger, url, user, pass)
3424 }
3525
3626 // implied driver == "fs"
+1, -2
......@@ -69,8 +69,7 @@ func (f *handler) Filelist(r *sftp.Request) (sftp.ListerAt, error) {
6969 return nil, err
7070 }
7171
72- // an empty string from minio or exact match from filepath base name is what we want
73-
72+ // an empty string or exact match from filepath base name is what we want
7473 if !list {
7574 listData = slices.DeleteFunc(listData, func(f os.FileInfo) bool {
7675 return f.Name() != "" && f.Name() != filepath.Base(r.Filepath)
+1, -7
......@@ -8,18 +8,12 @@ import (
88 )
99
1010 func GetStorageTypeFromEnv() string {
11- return utils.GetEnv("STORAGE_ADAPTER", "minio")
11+ return utils.GetEnv("STORAGE_ADAPTER", "fs")
1212 }
1313
1414 func NewStorage(logger *slog.Logger, adapter string) (StorageServe, error) {
1515 logger.Info("storage adapter", "adapter", adapter)
1616 switch adapter {
17- case "minio":
18- minioURL := utils.GetEnv("MINIO_URL", "")
19- minioUser := utils.GetEnv("MINIO_ROOT_USER", "")
20- minioPass := utils.GetEnv("MINIO_ROOT_PASSWORD", "")
21- logger.Info("using minio storage", "url", minioURL, "user", minioUser)
22- return NewStorageMinio(logger, minioURL, minioUser, minioPass)
2317 case "fs":
2418 fsPath := utils.GetEnv("FS_STORAGE_DIR", "/tmp/pico_storage")
2519 logger.Info("using filesystem storage", "path", fsPath)
+0, -49
......@@ -1,49 +0,0 @@
1-package storage
2-
3-import (
4- "fmt"
5- "io"
6- "log/slog"
7- "net/http"
8- "os"
9- "path/filepath"
10- "strings"
11-
12- sst "github.com/picosh/pico/pkg/pobj/storage"
13- "github.com/picosh/pico/pkg/shared/mime"
14-)
15-
16-type StorageMinio struct {
17- *sst.StorageMinio
18-}
19-
20-func NewStorageMinio(logger *slog.Logger, address, user, pass string) (*StorageMinio, error) {
21- st, err := sst.NewStorageMinio(logger, address, user, pass)
22- if err != nil {
23- return nil, err
24- }
25- return &StorageMinio{st}, nil
26-}
27-
28-func (s *StorageMinio) ServeObject(r *http.Request, bucket sst.Bucket, fpath string, opts *ImgProcessOpts) (io.ReadCloser, *sst.ObjectInfo, error) {
29- var rc io.ReadCloser
30- info := &sst.ObjectInfo{}
31- var err error
32- mimeType := mime.GetMimeType(fpath)
33- if !strings.HasPrefix(mimeType, "image/") || opts == nil || os.Getenv("IMGPROXY_URL") == "" {
34- rc, info, err = s.GetObject(bucket, fpath)
35- if info.Metadata == nil {
36- info.Metadata = map[string][]string{}
37- }
38- // Minio always returns application/octet-stream which needs to be overridden.
39- info.Metadata.Set("content-type", mimeType)
40- } else {
41- filePath := filepath.Join(bucket.Name, fpath)
42- dataURL := fmt.Sprintf("s3://%s", filePath)
43- rc, info, err = HandleProxy(r, s.Logger, dataURL, opts)
44- }
45- if err != nil {
46- return nil, nil, err
47- }
48- return rc, info, err
49-}