# Garage [![Build Status](https://cicd.apps.glenux.net/api/badges/glenux-opencontainers/service-garage/status.svg)](https://cicd.apps.glenux.net/glenux-opencontainers/service-garage) ## Installation ### DNS setup the following DNS records *.s3.apps.example.com 10800 IN CNAME dokku.host s3.apps.example.com 10800 IN CNAME dokku.host *.pages.apps.example.com 10800 IN CNAME dokku.host pages.apps.example.com 10800 IN CNAME dokku.host ### Main app Create app dokku apps:create objstorage Setup internal network dokku network:create objstorage_net dokku network:set objstorage attach-post-create objstorage_net Setup storage mkdir -p /var/lib/dokku/data/storage/objstorage/{meta,data} touch /var/lib/dokku/data/storage/objstorage/garage.toml dokku storage:mount objstorage /var/lib/dokku/data/storage/objstorage/garage.toml:/etc/garage.toml dokku storage:mount objstorage /var/lib/dokku/data/storage/objstorage/meta/:/var/lib/garage/meta/ dokku storage:mount objstorage /var/lib/dokku/data/storage/objstorage/data/:/var/lib/garage/data/ Deploy image dokku git:from-image objstorage glenux/service-garage:xxxx Setup proxy dokku proxy:ports-clear objstorage dokku proxy:report objstorage Restart dokku ps:restart objstorage ### Web proxy Create app dokku apps:create objstorage-web Setup internal network dokku network:set objstorage-web attach-post-create objstorage_net Setup domain dokku domains:add objstorage-web pages.apps.example.com dokku domains:add objstorage-web *.pages.apps.example.com Configure docker options dokku config:set objstorage-web SERVICE_HOST=objstorage.web dokku config:set objstorage-web SERVICE_PORT=3902 # dokku config:set objstorage-web PORT=5000 Deploy image dokku git:from-image objstorage-web dokku/service-proxy:latest Setup proxy dokku proxy:ports-clear objstorage-web dokku proxy:ports-set objstorage-web http:80:5000 dokku proxy:report objstorage-web Setup TLS dokku letsencrypt:set objstorage-web email username@example.com dokku letsencrypt:enable objstorage-web Restart dokku ps:restart objstorage-web ### S3 proxy Create app dokku apps:create objstorage-s3 Setup internal network dokku network:set objstorage-s3 attach-post-create objstorage_net Setup domain dokku domains:add objstorage-s3 pages.apps.example.com dokku domains:add objstorage-s3 *.pages.apps.example.com Configure docker options dokku config:set objstorage-s3 SERVICE_HOST=objstorage.web dokku config:set objstorage-s3 SERVICE_PORT=3902 # dokku config:set objstorage-s3 PORT=5000 Deploy image dokku git:from-image objstorage-s3 dokku/service-proxy:latest Setup proxy dokku proxy:ports-clear objstorage-s3 dokku proxy:ports-set objstorage-s3 http:80:5000 dokku proxy:report objstorage-s3 Setup TLS dokku letsencrypt:set objstorage-s3 email username@example.com dokku letsencrypt:enable objstorage-s3 Restart dokku ps:restart objstorage-s3 ## For each new bucket dokku domains:add objstorage-s3 BUCKETNAME.s3.apps.example.com dokku letsencrypt:enable objstorage-s3 dokku domains:add objstorage-web BUCKETNAME.pages.apps.example.com dokku letsencrypt:enable objstorage-web alias garage="sudo docker exec -it objstorage.web.1 /garage" garage bucket create BUCKETNAME garage bucket list garage bucket info BUCKETNAME garage key create BUCKETNAME-key garage key list garage key info BUCKETNAME-key garage bucket allow \ --read \ --write \ --owner \ BUCKETNAME \ --key BUCKETNAME-key ## References * [Garage: Cookbook](https://garagehq.deuxfleurs.fr/documentation/cookbook/real-world/) * [Dokku: Network Management](https://dokku.com/docs/networking/network/) * [Dokku: Routing to non-Dokku managed apps](https://dokku.com/blog/2021/dokku-0.25.0/#routing-to-non-dokku-managed-apps)