Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
Update docker compose files (#100)
Browse files Browse the repository at this point in the history
# Goals

Update all configs for full singularity, update local config setup to
talk to devnet

# Implementation

- also makes singularity params configurable by env var
- makes verified deal attribute configurable
- production docker compose (docker-compose.yml) is probably pretty
close to what we want
- local docker compose is just for running with local building of the
repo -- not trying to get it to work with devnet
- using this as a base to test prod deal making.
  • Loading branch information
hannahhoward authored Sep 8, 2023
2 parents 9700f09 + c5f551b commit 268ec06
Show file tree
Hide file tree
Showing 7 changed files with 162 additions and 14 deletions.
1 change: 0 additions & 1 deletion .env

This file was deleted.

17 changes: 17 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
SINGULARITY_TAG=v0.3.2
MOTION_STORAGE_PROVIDERS=
#MOTION_PRICE_PER_GIB_EPOCH=
#MOTION_PRICE_PER_GIB=
#MOTION_PRICE_PER_DEAL=
#MOTION_DEAL_START_DELAY=
#MOTION_DEAL_DURATION=
#MOTION_VERIFIED_DEAL=
#LOTUS_TEST=
#LOTUS_API=
#LOTUS_TOKEN=
#MOTION_SINGULARITY_MAX_CAR_SIZE=
#MOTION_SINGULARITY_PACK_THRESHOLD=
#MOTION_SINGULARITY_SCHEDULE_CRON=
#MOTION_SINGULARITY_SCHEDULE_DEAL_NUMBER=
MOTION_WALLET_KEY=
SINGULARITY_CONTENT_PROVIDER_DOMAIN=
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
extern
extern
.env
.env.local
24 changes: 19 additions & 5 deletions cmd/motion/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,24 @@ func main() {
EnvVars: []string{"MOTION_DEAL_DURATION"},
},
&cli.StringFlag{
Name: "singularityMaxCarSize",
Usage: "The maximum Singularity generated CAR size",
Value: "31.5GiB",
Name: "singularityMaxCarSize",
Usage: "The maximum Singularity generated CAR size",
Value: "31.5GiB",
EnvVars: []string{"MOTION_SINGULARITY_MAX_CAR_SIZE"},
},
&cli.Int64Flag{
Name: "singularityPackThreshold",
Usage: "The Singularity store pack threshold in number of bytes",
DefaultText: "17,179,869,184 (i.e. 16 GiB)",
Value: 16 << 30,
EnvVars: []string{"MOTION_SINGULARITY_PACK_THRESHOLD"},
},
&cli.BoolFlag{
Name: "verifiedDeal",
Usage: "whether deals made with motion should be verified deals",
DefaultText: "Deals are verified",
Value: true,
EnvVars: []string{"MOTION_VERIFIED_DEAL"},
},
&cli.StringFlag{
Name: "experimentalSingularityContentURLTemplate",
Expand All @@ -142,12 +151,16 @@ func main() {
&cli.StringFlag{
Name: "experimentalSingularityScheduleCron",
Usage: "When using a singularity as the storage engine, if set, setups up the cron schedule to send out batch deals.",
DefaultText: "disabled",
DefaultText: "runs every minute",
Value: "* * * * *",
EnvVars: []string{"MOTION_SINGULARITY_SCHEDULE_CRON"},
},
&cli.IntFlag{
Name: "experimentalSingularityScheduleDealNumber",
Usage: "When using a singularity as the storage engine, if set, setups up the max deal number per triggered schedule.",
DefaultText: "unlimited",
DefaultText: "1 per trigger",
Value: 1,
EnvVars: []string{"MOTION_SINGULARITY_SCHEDULE_DEAL_NUMBER"},
},
},
Action: func(cctx *cli.Context) error {
Expand Down Expand Up @@ -206,6 +219,7 @@ func main() {
singularity.WithScheduleUrlTemplate(cctx.String("experimentalSingularityContentURLTemplate")),
singularity.WithScheduleCron(cctx.String("experimentalSingularityScheduleCron")),
singularity.WithScheduleDealNumber(cctx.Int("experimentalSingularityScheduleDealNumber")),
singularity.WithVerifiedDeal(cctx.Bool("verifiedDeal")),
)
if err != nil {
logger.Errorw("Failed to instantiate singularity store", "err", err)
Expand Down
72 changes: 70 additions & 2 deletions compose-local-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,99 @@ services:
extends:
file: docker-compose.yml
service: db

singularity_api:
extends:
file: docker-compose.yml
service: singularity_api
depends_on:
db:
condition: service_healthy
networks:
- default
- devnet

singularity_dataset_worker:
extends:
file: docker-compose.yml
service: singularity_dataset_worker
depends_on:
db:
condition: service_healthy
networks:
- default
- devnet

singularity_deal_pusher:
extends:
file: docker-compose.yml
service: singularity_deal_pusher
depends_on:
db:
condition: service_healthy
networks:
- default
- devnet

singularity_deal_tracker:
extends:
file: docker-compose.yml
service: singularity_deal_tracker
depends_on:
db:
condition: service_healthy
networks:
- default
- devnet

singularity_content_provider:
extends:
file: docker-compose.yml
service: singularity_content_provider
depends_on:
db:
condition: service_healthy
networks:
- default
- devnet

motion:
build: .
entrypoint: motion --experimentalSingularityStore --experimentalRemoteSingularityAPIUrl=http://singularity_api:9090
entrypoint: motion --experimentalSingularityStore --experimentalRemoteSingularityAPIUrl=http://singularity_api:9090 --experimentalSingularityContentURLTemplate=${SINGULARITY_CONTENT_PROVIDER_DOMAIN:-http://singularity_content_provider:7778}/piece/{PIECE_CID}
ports:
- 40080:40080
environment:
- MOTION_STORE_DIR=/usr/src/app/storage
- MOTION_LOCAL_WALLET_DIR=/usr/src/app/wallet
- LOTUS_TEST
- LOTUS_API
- LOTUS_TOKEN
- MOTION_STORAGE_PROVIDERS
- MOTION_PRICE_PER_GIB_EPOCH
- MOTION_PRICE_PER_GIB
- MOTION_PRICE_PER_DEAL
- MOTION_DEAL_START_DELAY
- MOTION_DEAL_DURATION
- MOTION_SINGULARITY_MAX_CAR_SIZE
- MOTION_SINGULARITY_PACK_THRESHOLD
- MOTION_SINGULARITY_SCHEDULE_CRON
- MOTION_SINGULARITY_SCHEDULE_DEAL_NUMBER
- MOTION_WALLET_KEY
- MOTION_VERIFIED_DEAL
volumes:
- motion-singularity-volume:/usr/src/app/storage
depends_on:
- singularity_api
networks:
- default
- devnet

volumes:
motion-singularity-volume:
motion-singularity-volume:

networks:
default:
name: motion
devnet:
name: devnet
external: true
56 changes: 52 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ services:
- 9090:9090
environment:
DATABASE_CONNECTION_STRING: postgres://${SINGULARITY_DB_USER:-postgres}:${SINGULARITY_DB_PASSWORD:-postgres}@db:5432/${SINGULARITY_DB_NAME:-singularity}
LOTUS_TEST:
LOTUS_API:
LOTUS_TOKEN:
depends_on:
db:
condition: service_healthy
Expand All @@ -38,39 +41,84 @@ services:
command: run dataset-worker
environment:
DATABASE_CONNECTION_STRING: postgres://${SINGULARITY_DB_USER:-postgres}:${SINGULARITY_DB_PASSWORD:-postgres}@db:5432/${SINGULARITY_DB_NAME:-singularity}
LOTUS_TEST:
LOTUS_API:
LOTUS_TOKEN:
depends_on:
db:
condition: service_healthy

singularity_deal_pusher:
image: ghcr.io/data-preservation-programs/singularity:main
image: ghcr.io/data-preservation-programs/singularity:${SINGULARITY_TAG}
volumes:
- motion-singularity-volume:/usr/src/app/storage
command: run deal-pusher
environment:
DATABASE_CONNECTION_STRING: postgres://${SINGULARITY_DB_USER:-postgres}:${SINGULARITY_DB_PASSWORD:-postgres}@db:5432/${SINGULARITY_DB_NAME:-singularity}
LOTUS_TEST:
LOTUS_API:
LOTUS_TOKEN:
depends_on:
db:
condition: service_healthy

singularity_deal_tracker:
image: ghcr.io/data-preservation-programs/singularity:main
image: ghcr.io/data-preservation-programs/singularity:${SINGULARITY_TAG}
volumes:
- motion-singularity-volume:/usr/src/app/storage
command: run deal-tracker
environment:
DATABASE_CONNECTION_STRING: postgres://${SINGULARITY_DB_USER:-postgres}:${SINGULARITY_DB_PASSWORD:-postgres}@db:5432/${SINGULARITY_DB_NAME:-singularity}
LOTUS_TEST:
LOTUS_API:
LOTUS_TOKEN:
depends_on:
db:
condition: service_healthy

singularity_content_provider:
image: ghcr.io/data-preservation-programs/singularity:${SINGULARITY_TAG}
command: run content-provider --http-bind :7778
volumes:
- motion-singularity-volume:/usr/src/app/storage
ports:
- 7778:7778
environment:
DATABASE_CONNECTION_STRING: postgres://${SINGULARITY_DB_USER:-postgres}:${SINGULARITY_DB_PASSWORD:-postgres}@db:5432/${SINGULARITY_DB_NAME:-singularity}
LOTUS_TEST:
LOTUS_API:
LOTUS_TOKEN:
depends_on:
db:
condition: service_healthy

motion:
image: ghcr.io/filecoin-project/motion:main
entrypoint: motion --experimentalSingularityStore --experimentalRemoteSingularityAPIUrl=http://singularity_api:9090
entrypoint: motion --experimentalSingularityStore --experimentalRemoteSingularityAPIUrl=http://singularity_api:9090 --experimentalSingularityContentURLTemplate=${SINGULARITY_CONTENT_PROVIDER_DOMAIN:-http://singularity_content_provider:7778}/piece/{PIECE_CID}
ports:
- 40080:40080
environment:
- MOTION_STORE_DIR=/usr/src/app/storage
- MOTION_LOCAL_WALLET_DIR=/usr/src/app/wallet
- LOTUS_TEST
- LOTUS_API
- LOTUS_TOKEN
- MOTION_STORAGE_PROVIDERS
- MOTION_PRICE_PER_GIB_EPOCH
- MOTION_PRICE_PER_GIB
- MOTION_PRICE_PER_DEAL
- MOTION_DEAL_START_DELAY
- MOTION_DEAL_DURATION
- MOTION_SINGULARITY_MAX_CAR_SIZE
- MOTION_SINGULARITY_PACK_THRESHOLD
- MOTION_SINGULARITY_SCHEDULE_CRON
- MOTION_SINGULARITY_SCHEDULE_DEAL_NUMBER
- MOTION_WALLET_KEY
- MOTION_VERIFIED_DEAL
volumes:
- motion-singularity-volume:/usr/src/app/storage
depends_on:
- singularity_api

volumes:
motion-singularity-volume:
motion-singularity-volume:
2 changes: 1 addition & 1 deletion integration/singularity/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func newOptions(o ...Option) (*options, error) {
scheduleDealSize: "0",
totalDealSize: "0",
maxPendingDealSize: "0",
maxPendingDealNumber: 1,
maxPendingDealNumber: 0,
}
for _, apply := range o {
if err := apply(opts); err != nil {
Expand Down

0 comments on commit 268ec06

Please sign in to comment.