Skip to content

Commit

Permalink
Add sqlite3 CLI (remix-run#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkurt authored Apr 1, 2022
1 parent 799ad4a commit d51a99c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
9 changes: 8 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ FROM node:16-bullseye-slim as base
ENV NODE_ENV production

# Install openssl for Prisma
RUN apt-get update && apt-get install -y openssl
RUN apt-get update && apt-get install -y openssl sqlite3

# Install all node_modules, including dev dependencies
FROM base as deps
Expand Down Expand Up @@ -41,6 +41,13 @@ RUN npm run build
# Finally, build the production image with minimal footprint
FROM base

ENV DATABASE_URL=file:/data/sqlite.db
ENV PORT = "8080"
ENV NODE_ENV = "production"

# add shortcut for connecting to database CLI
RUN echo "#!/bin/sh\nset -x\nsqlite3 \$DATABASE_URL" > /usr/local/bin/database-cli && chmod +x /usr/local/bin/database-cli

WORKDIR /myapp

COPY --from=production-deps /myapp/node_modules /myapp/node_modules
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ Prior to your first deployment, you'll need to do a few things:

Now that everything is set up you can commit and push your changes to your repo. Every commit to your `main` branch will trigger a deployment to your production environment, and every commit to your `dev` branch will trigger a deployment to your staging environment.

### Connecting to your database

The sqlite database lives at `/data/sqlite.db` in your deployed application. You can connect to the live database by running `fly ssh console -C database-cli`.

### Getting Help with Deployment

If you run into any issues deploying to Fly, make sure you've followed all of the steps above and if you have, then post as many details about your deployment (including your app name) to [the Fly support community](https://community.fly.io). They're normally pretty responsive over there and hopefully can help resolve any of your deployment issues and questions.

## GitHub Actions
Expand Down
5 changes: 0 additions & 5 deletions fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[env]
DATABASE_URL = "file:/data/sqlite.db"
PORT = "8080"
NODE_ENV = "production"

[experimental]
allowed_public_ports = []
auto_rollback = true
Expand Down

0 comments on commit d51a99c

Please sign in to comment.