diff --git a/README.md b/README.md index 468c8e0c..ee6aa7a1 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,14 @@ By using a Ruby version manager (such as [asdf](https://asdf-vm.com/), you can e docker compose up --build ``` +To seed the database: + +```sh +docker exec -it kudo-o-matic_web sh +# in the shell of the docker container: +bundle exec rake db:seed +``` + When everything runs: ```sh @@ -74,14 +82,6 @@ Copy environment variables. Following the dependency setup instructions below wi cp env.example .env ``` -#### Database configuration - -Copy default database configuration (change if needed) - -```bash -cp config/database.yml.example config/database.yml -``` - #### Database Create the databases and initialize it with the seed data. diff --git a/compose.yml b/compose.yml index 67dd2cd9..df2ca345 100644 --- a/compose.yml +++ b/compose.yml @@ -14,6 +14,8 @@ services: depends_on: db: condition: service_healthy + redis: + condition: service_healthy command: bash -c "bundle install && bundle exec rake db:migrate && bundle exec puma" @@ -43,3 +45,13 @@ services: - ./dockerfiles/development/db/init.sh:/docker-entrypoint-initdb.d/init.sh # Data volume for persistent storage - ./dockerfiles/development/db/data:/var/lib/postgresql/data + + redis: + image: redis:7 + ports: + - "${REDIS_PORT_LOCAL:-6379}:6379" + healthcheck: + test: ["CMD", "redis-cli", "--raw", "incr", "ping"] + interval: 1s + timeout: 3s + retries: 5 diff --git a/db/seeds.rb b/db/seeds.rb index 0aecdda8..4137a84c 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -16,7 +16,7 @@ users.each do |user| user = User.create( name: user, - email: "#{user}@example.com", + email: "#{user.downcase}@example.com", password: 'password', password_confirmation: 'password' ) diff --git a/dockerfiles/development/web/Dockerfile b/dockerfiles/development/web/Dockerfile index 7c3c97eb..7ff27898 100644 --- a/dockerfiles/development/web/Dockerfile +++ b/dockerfiles/development/web/Dockerfile @@ -7,6 +7,8 @@ ENV RACK_ENV development ENV ROOT_URL 0.0.0.0 ENV DATABASE_NAME kudo-o-matic_development ENV DATABASE_URL postgres://kudo_user:kudos@db:5432 +ENV DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL true +ENV REDIS_URL redis://redis:6379/0 # Install Node.js, npm, Yarn, Python, and build-essential RUN apt-get update -qq && \