diff --git a/.gitignore b/.gitignore index 802a2fd..0895097 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ app/views/pages/data_privacy.html.haml /app/assets/builds/* !/app/assets/builds/.keep +db/development.sqlite3 diff --git a/Gemfile b/Gemfile index 3edfd3d..cc865a7 100644 --- a/Gemfile +++ b/Gemfile @@ -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" diff --git a/Gemfile.lock b/Gemfile.lock index e7d0272..a68c178 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -338,6 +339,7 @@ DEPENDENCIES rspec-rails selenium-webdriver simple_form + sqlite3 standard stimulus-rails tailwindcss-rails diff --git a/README.md b/README.md index 7ca10eb..5eb31db 100644 --- a/README.md +++ b/README.md @@ -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`. @@ -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 diff --git a/docker-compose.sqlite.yml b/docker-compose.sqlite.yml new file mode 100644 index 0000000..ee62a83 --- /dev/null +++ b/docker-compose.sqlite.yml @@ -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: