diff --git a/Dockerfile b/Dockerfile index 16621e8..3f08bd5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM node:16-bullseye-slim as base # 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 @@ -50,6 +50,9 @@ ARG GITHUB_REPOSITORY ENV GITHUB_REPOSITORY=$GITHUB_REPOSITORY 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 + RUN mkdir /app WORKDIR /app diff --git a/README.md b/README.md index 6eddd6e..0b8a8e8 100644 --- a/README.md +++ b/README.md @@ -260,7 +260,7 @@ You can also log in to the remote console using the `flyctl ssh console` command ### Database -After logging in to the console, you can also inspect the SQLite DB. But first, we have to install SQLite on the remote machine. We can do that using the `apt-get install sqlite3` command. Then, `cd` into the volume using the `cd data` command (Note: `data` refers to the volume's name created from the command line). And then run the command `sqlite3 sqlite.db` to open a command-line interface into the 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`. ## Important links