Add docker-compose (#47)

This is a docker-compose based on production config, without mounting of the local folders, which I admit is a strange setup, but this was the simplest for me to get the local development going.

I'm perfectly ok with not merging this PR.

Reviewed-on: #47
Co-authored-by: Tocho Tochev <tocho@tochev.net>
Co-committed-by: Tocho Tochev <tocho@tochev.net>
This commit is contained in:
Tocho Tochev 2024-06-01 12:29:46 +03:00 committed by Petko Bordjukov
parent cd8c3bbcc7
commit 486a763277
4 changed files with 66 additions and 8 deletions

View File

@ -1,11 +1,29 @@
Clarion
=======
# Clarion
A CfP automation system for OpenFest.
Installation
------------
## Installation
### For local development
1. `git clone https://github.com/ignisf/clarion.git`
2. Run `bundle install; bin/rake bootstrap`
3. You can now run the rails server with `bin/rails s`
3. You can now run the rails server with `bin/rails s`
### For production
`docker build -t clarion:latest -f Dockerfile .`
Note that the docker image contains a default user (for credentials see `db/seeds.rb`).
### docker-compose
`docker-compose up` will bring everything up on `http://127.0.0.1:3000` with production configuration.
## Initial Usage
1. Go to `http://127.0.0.1:3000/management/`
2. Login (for initial creds see `db/seeds.rb`)
3. Change the credentials
3. Create a conference.
- NB: When creating a conference make sure to use the same `domain` as the one you are currently using, otherwise nothing will be shown.

View File

@ -79,7 +79,7 @@ test:
#
production:
<<: *default
host: host.containers.internal
host: <%= ENV.fetch("CLARION_DATABASE_HOST") { "host.containers.internal" } %>
database: clarion
username: clarion
password: <%= ENV["CLARION_DATABASE_PASSWORD"] %>

View File

@ -49,7 +49,7 @@ Rails.application.configure do
# config.assume_ssl = true
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = true
config.force_ssl = ENV["CLARION_USE_PLAINTEXT"] != "yes"
# Log to STDOUT by default
config.logger = ActiveSupport::Logger.new(STDOUT)
@ -90,7 +90,7 @@ Rails.application.configure do
config.action_mailer.default_options = {from: "OpenFest <cfp@openfest.org>"}
config.action_mailer.default_url_options = {host: "cfp.openfest.org"}
config.action_mailer.smtp_settings = {
address: "mail.openfest.org"
address: ENV.fetch("CLARION_MAIL_SERVER", "mail.openfest.org")
}
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to

40
docker-compose.yml Normal file
View File

@ -0,0 +1,40 @@
services:
clarion:
build:
dockerfile: Dockerfile
context: .
environment:
RAILS_ENV: production
CLARION_DATABASE_HOST: db
CLARION_DATABASE_PASSWORD: not-a-real-db-password-tiliez4phei9oZoo1Shoyitee2zoon8O
REDIS_URL: redis://redis:6379/1
CLARION_MAIL_SERVER: mail-dummy
CLARION_USE_PLAINTEXT: yes
SECRET_KEY_BASE: not-a-real-secret-oodeig8etho1usik5Eehoh9jah9yuS3o
ports:
- 127.0.0.1:3000:3000
depends_on:
- db
- redis
- mail-dummy
db:
image: postgres:16.3
environment:
POSTGRES_USER: clarion
POSTGRES_PASSWORD: not-a-real-db-password-tiliez4phei9oZoo1Shoyitee2zoon8O
POSTGRES_DB: clarion
volumes:
- pgdata:/var/lib/postgresql/data
redis:
image: redis:7
mail-dummy:
image: python:3.11-slim
command: python3 -m smtpd --debug --class DebuggingServer 0.0.0.0:25
expose:
- 25
volumes:
pgdata: