From d01ba553d55009cd3ccb5a8144d1a99f8399013d Mon Sep 17 00:00:00 2001 From: Tocho Tochev Date: Sat, 18 May 2024 15:40:15 +0300 Subject: [PATCH 1/3] Add docker-compose --- README.md | 28 +++++++++++++++++++----- config/database.yml | 2 +- config/environments/production.rb | 4 ++-- docker-compose.yml | 36 +++++++++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 8 deletions(-) create mode 100644 docker-compose.yml diff --git a/README.md b/README.md index 20f50c4..66f9a3e 100644 --- a/README.md +++ b/README.md @@ -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` \ No newline at end of file +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. diff --git a/config/database.yml b/config/database.yml index 2078e39..827bc92 100644 --- a/config/database.yml +++ b/config/database.yml @@ -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"] %> diff --git a/config/environments/production.rb b/config/environments/production.rb index 6af3a47..f925da5 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -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 "} 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 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..0619732 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,36 @@ +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 + + 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 + + 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 + +volumes: + pgdata: -- 2.40.1 From 73a9c176f6c623dfa1e7ac80ac39ca974428d208 Mon Sep 17 00:00:00 2001 From: Tocho Tochev Date: Sun, 26 May 2024 00:03:37 +0300 Subject: [PATCH 2/3] Add depends_on --- docker-compose.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 0619732..555c9f7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,6 +13,10 @@ services: SECRET_KEY_BASE: not-a-real-secret-oodeig8etho1usik5Eehoh9jah9yuS3o ports: - 127.0.0.1:3000:3000 + depends_on: + - redis + - mail-dummy + - db redis: image: redis:7 -- 2.40.1 From dc456b4e31313a556ace959228837d16cd7958cd Mon Sep 17 00:00:00 2001 From: Tocho Tochev Date: Sun, 26 May 2024 09:44:08 +0300 Subject: [PATCH 3/3] Reorder services --- docker-compose.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 555c9f7..6a4f288 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,18 +14,9 @@ services: ports: - 127.0.0.1:3000:3000 depends_on: + - db - redis - mail-dummy - - db - - 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 db: image: postgres:16.3 @@ -36,5 +27,14 @@ services: 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: -- 2.40.1