Remove the need for a DATABASE_URL

Since the application does not use a database, it's confusing to have to
set a bogus database URL environment variable. This change follows [the
Lucky guide][1] suggestion for disabling the need for database
configuration. That makes the setup a little easier.

Michael Herold 9 months ago committed by Edward Loveall
parent 93f5cb2d9e
commit 098f7fe0f9
No known key found for this signature in database
GPG Key ID: A7606DFEC2BA731F

@ -6,8 +6,6 @@ This is a project written using [Lucky]( It's main w
I'd love it if you deployed your own version of this app! A [few others](docs/ have already. To do so currently will take some knowledge of how a webserver runs. This app is built with the [Lucky framework]( and there are a bunch of different ways to deploy. The main instance runs on [Ubuntu]( but there are also directions for [Heroku]( or [Dokku](
One thing to note is that this app doesn't currently use a database. Any instructions around postgres can be safely ignored. However, Lucky (and it's dependency Avram) do require a `DATABASE_URL` formatted for postgres. It doesn't need to be the URL of an actual database server though. Here's mine: `DATABASE_URL=postgres://does@not/mater`
Hopefully a more comprehensive guide will be written at some point, but for now feel free to reach out to the [mailing list]( if you have any questions.
### Docker (Unsupported)
@ -23,7 +21,7 @@ $ docker build [--build-arg PUID=1000] [--build-arg PGID=1000] -t scribe:latest
To run (generating a base config from environment variables):
$ docker run -it --rm -p 8080:8080 -e SCRIBE_PORT=8080 -e SCRIBE_HOST= -e SCRIBE_DB=postgres://does@not/matter scribe:latest
$ docker run -it --rm -p 8080:8080 -e SCRIBE_PORT=8080 -e SCRIBE_HOST= scribe:latest
To run with mounted config from local fs:
@ -42,8 +40,6 @@ Other configuration needed when in `production` mode:
* PORT: The port Scribe should run on
* SECRET_KEY_BASE: A 32-bit string. Can be generated with `lucky gen.secret_key`
* DATABASE_URL: May be any valid postgres url since Scribe doesn't use a database
* Example: `postgres://does@not/matter`
* GITHUB_PERSONAL_ACCESS_TOKEN: to proxy gists with authenticated GitHub API requests
* GITHUB_USERNAME: to proxy gists with authenticated GitHub API requests

@ -1,24 +1,10 @@
database_name = "scribe_#{LuckyEnv.environment}"
class UnusedDB < Avram::Database
AppDatabase.configure do |settings|
if LuckyEnv.production?
settings.credentials = Avram::Credentials.parse(ENV["DATABASE_URL"])
settings.credentials = Avram::Credentials.parse?(ENV["DATABASE_URL"]?) ||
database: database_name,
hostname: ENV["DB_HOST"]? || "localhost",
port: ENV["DB_PORT"]?.try(&.to_i) || 5432,
username: ENV["DB_USERNAME"]? || "postgres",
password: ENV["DB_PASSWORD"]? || "postgres"
UnusedDB.configure do |settings|
settings.credentials = Avram::Credentials.void
Avram.configure do |settings|
settings.database_to_migrate = AppDatabase
settings.lazy_load_enabled = LuckyEnv.production?
# Always parse `Time` values with these specific formats.
# Used for both database values, and datetime input fields.
# settings.time_formats << "%F"
settings.database_to_migrate = UnusedDB

@ -1,4 +1,4 @@
echo -e "port: ${SCRIBE_PORT}\nhost: ${SCRIBE_HOST}\ndatabase: ${SCRIBE_DB}" > ./config/watch.yml
echo -e "port: ${SCRIBE_PORT}\nhost: ${SCRIBE_HOST}" > ./config/watch.yml

@ -6,7 +6,6 @@ Lucky::AssetHelpers.load_manifest "public/mix-manifest.json"
require "./version"
require "../config/server"
require "../config/**"
require "./app_database"
require "./constants"
require "./models/base_model"
require "./models/mixins/**"

@ -1,2 +0,0 @@
class AppDatabase < Avram::Database

@ -1,3 +1,3 @@
module Scribe
VERSION = "2022-04-04"
VERSION = "2022-05-21"