Skip to content

Commit

Permalink
Fix deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
8hantanu committed Nov 7, 2024
1 parent 82855bf commit 930b4dc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@ RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
RUN cargo build --release --bin mdow

FROM flyio/litefs:0.5 AS runtime
# Install required packages
FROM debian:bookworm-slim AS runtime
# Install required packages and litefs
COPY --from=flyio/litefs:0.5 /usr/local/bin/litefs /usr/local/bin/litefs
RUN apt-get update && apt-get install -y \
ca-certificates \
fuse3 \
sqlite3 \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /app
COPY --from=builder /app/target/release/mdow /usr/local/bin
COPY litefs.yml /etc/litefs.yml

ENV DATABASE_URL="sqlite:/litefs/mdow.db"
ENTRYPOINT ["/usr/local/bin/litefs"]
ENTRYPOINT litefs mount
3 changes: 2 additions & 1 deletion fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ primary_region = 'lhr'
[env]
PORT = '8081'
DATABASE_URL = "sqlite:/litefs/mdow.db"
PRIMARY_REGION = "lhr"
FLY_CONSUL_URL = "consul+tls://fly-consul.fly.dev:8501"

[http_service]
internal_port = 8080
internal_port = 8081
force_https = true
auto_stop_machines = 'stop'
auto_start_machines = true
Expand Down
9 changes: 4 additions & 5 deletions litefs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ proxy:
target: "localhost:8081"
db: "mdow.db"

exec:
- cmd: "/usr/local/bin/mdow"
if-primary: true

lease:
type: "consul"
consul:
url: "${FLY_CONSUL_URL}"
key: "litefs/${FLY_APP_NAME}"
key: "mdow/primary"

exec:
- cmd: "/usr/local/bin/mdow"

0 comments on commit 930b4dc

Please sign in to comment.