Skip to content

Commit

Permalink
Add support for SQLite as a database
Browse files Browse the repository at this point in the history
  • Loading branch information
phylor committed Oct 23, 2022
1 parent 4c0d9c4 commit 5b8af25
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ app/views/pages/data_privacy.html.haml

/app/assets/builds/*
!/app/assets/builds/.keep
db/development.sqlite3
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ gem "puma", "~> 6.0"
gem "rails", "~> 7.0.3", ">= 7.0.3.1"
gem "rqrcode"
gem "simple_form"
gem "sqlite3"
gem "stimulus-rails"
gem "tailwindcss-rails"
gem "turbo-rails"
Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ GEM
simple_form (5.1.0)
actionpack (>= 5.2)
activemodel (>= 5.2)
sqlite3 (1.5.3-x86_64-linux)
standard (1.16.1)
rubocop (= 1.35.1)
rubocop-performance (= 1.14.3)
Expand Down Expand Up @@ -338,6 +339,7 @@ DEPENDENCIES
rspec-rails
selenium-webdriver
simple_form
sqlite3
standard
stimulus-rails
tailwindcss-rails
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,18 @@ A home for all your coupons and loyalty cards. Free to use at https://coupon.met

## Setup

Using a PostgreSQL database:

```shell
docker-compose -f docker-compose.example.yml up
```

Using a SQLite database:

```shell
docker-compose -f docker-compose.sqlite.yml up
```

### Instance specific configuration

Add a page for data privacy by creating a file at `app/views/pages/data_privacy.html.haml`.
Expand All @@ -31,6 +39,13 @@ bin/dev
## Environment variables

- `DEVISE_SENDER_EMAIL`: the email address you are sending emails from
- `DATABASE_URL`: allows to set the database. PostgreSQL or SQLite3 are supported.

Example for SQLite3:

```
DATABASE_URL=sqlite3:db/development.sqlite3
```
## License
Expand Down
15 changes: 15 additions & 0 deletions docker-compose.sqlite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: '3.9'
services:
web:
image: metikular/coupon-store
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 80 -b '0.0.0.0'"
environment:
- DATABASE_URL=sqlite3:db/data/coupons.sqlite3
- SECRET_KEY_BASE=change-me
hostname: web
restart: unless-stopped
volumes:
- coupon-store-database:/app/db/data

volumes:
coupon-store-database:

0 comments on commit 5b8af25

Please sign in to comment.