-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/review setup (#52) #54
base: main
Are you sure you want to change the base?
Changes from all commits
c779cc6
8350f87
367178f
dfef10b
0448392
e47af6b
82de2a9
2523780
79ad499
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,24 @@ | ||
# Gemfile | ||
GEM_PG_VERSION=1.2.2 | ||
# Database | ||
DB_HOST=postgis | ||
DB_NAME=gtt | ||
DB_USER=gtt | ||
DB_PASS=gtt | ||
DB_PORT=5432 | ||
|
||
# docker-compose.yml - postgres | ||
POSTGRES_USER=gtt | ||
POSTGRES_PASSWORD=gtt | ||
POSTGRES_DB=gtt | ||
|
||
# config/configuration.yml | ||
SMTP_ENABLE_STARTTLS_AUTO=true # (or false) | ||
SMTP_ADDRESS=smtp.gmail.com | ||
SMTP_PORT=587 | ||
SMTP_DOMAIN=smtp.gmail.com | ||
SMTP_AUTHENTICATION=plain # (or login) | ||
SMTP_ADDRESS=smtp | ||
SMTP_DOMAIN=smtp.example.com | ||
SMTP_PORT=1025 | ||
SMTP_USER_NAME=YOUR_EMAIL_ADDRESS | ||
SMTP_PASSWORD=YOUR_PASSWORD | ||
SMTP_ENABLE_STARTTLS_AUTO=true | ||
|
||
# Setup | ||
REDMINE_LANG=en | ||
[email protected] | ||
|
||
# System | ||
RAILS_ENV=production | ||
RAILS_LOG_TO_STDOUT=1 | ||
RAILS_MEMORY_LIMIT=1024 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
PUMA_WORKERS=3 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dkastl (CC: @smellman, @nobnisai) When I set
The following is the default (
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"MD029": false, | ||
"MD033": false, | ||
"MD038": false, | ||
"MD041": false | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,22 @@ | ||
FROM ruby:2.7-slim-buster | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
# GTT Builder | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
FROM node:16-bullseye-slim as gtt-builder | ||
|
||
WORKDIR /app | ||
|
||
COPY plugins/redmine_gtt/ ./redmine_gtt/ | ||
|
||
RUN apt update; \ | ||
apt install -y git; \ | ||
cd redmine_gtt; \ | ||
yarn; \ | ||
yarn webpack | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a slight thing, but in |
||
|
||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
# GTT Base | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
FROM ruby:3.1-slim-bullseye as base | ||
|
||
# explicitly set uid/gid to guarantee that it won't change in the future | ||
# the values 999:999 are identical to the current user/group id assigned | ||
|
@@ -10,19 +28,11 @@ RUN set -eux; \ | |
ca-certificates \ | ||
wget \ | ||
\ | ||
# bzr \ | ||
# git \ | ||
# mercurial \ | ||
openssh-client \ | ||
# subversion \ | ||
\ | ||
# we need "gsfonts" for generating PNGs of Gantt charts | ||
# and "ghostscript" for creating PDF thumbnails (in 4.1+) | ||
ghostscript \ | ||
gsfonts \ | ||
imagemagick \ | ||
# https://github.com/docker-library/ruby/issues/344 | ||
shared-mime-info \ | ||
# grab gosu for easy step-down from root | ||
gosu \ | ||
# grab tini for signal processing and zombie killing | ||
|
@@ -44,89 +54,42 @@ RUN set -eux; \ | |
chown redmine:redmine "$HOME"; \ | ||
chmod 1777 "$HOME" | ||
|
||
ARG REDMINE_VERSION="4.2.3" | ||
ARG REDMICA_VERSION="" | ||
# ENV REDMINE_DOWNLOAD_SHA256 ad4109c3425f1cfe4c8961f6ae6494c76e20d81ed946caa1e297d9eda13b41b4 | ||
# Defined in docker-compose.yml | ||
ARG REDMINE_VERSION | ||
ARG REDMINE_DOWNLOAD_SHA256 | ||
|
||
RUN set -eux; \ | ||
if [ -n "$REDMINE_VERSION" ]; then \ | ||
wget -O redmine.tar.gz "https://www.redmine.org/releases/redmine-${REDMINE_VERSION}.tar.gz"; \ | ||
# echo "$REDMINE_DOWNLOAD_SHA256 *redmine.tar.gz" | sha256sum -c -; | ||
elif [ -n "$REDMICA_VERSION" ]; then \ | ||
wget -O redmine.tar.gz "https://github.com/redmica/redmica/archive/v${REDMICA_VERSION}.tar.gz"; \ | ||
fi; \ | ||
# bullseye hack | ||
wget --no-check-certificate -O redmine.tar.gz "https://www.redmine.org/releases/redmine-${REDMINE_VERSION}.tar.gz"; \ | ||
echo "${REDMINE_DOWNLOAD_SHA256} *redmine.tar.gz" | sha256sum -c -; \ | ||
tar -xf redmine.tar.gz --strip-components=1; \ | ||
rm redmine.tar.gz files/delete.me log/delete.me; \ | ||
mkdir -p log public/plugin_assets sqlite tmp/pdf tmp/pids; \ | ||
chown -R redmine:redmine ./; \ | ||
# log to STDOUT (https://github.com/docker-library/redmine/issues/108) | ||
echo 'config.logger = Logger.new(STDOUT)' > config/additional_environment.rb; \ | ||
# fix permissions for running as an arbitrary user | ||
chmod -R ugo=rwX config db sqlite; \ | ||
find log tmp -type d -exec chmod 1777 '{}' + | ||
mkdir -p log public/plugin_assets tmp/pdf tmp/pids; \ | ||
chown -R redmine:redmine ./ ; \ | ||
chmod -R ugo=rwX config ; \ | ||
find log tmp -type d -exec chmod 1777 '{}' + | ||
|
||
COPY --from=gtt-builder --chown=redmine:redmine /app/ ./plugins/ | ||
|
||
# for Redmine patches | ||
ARG PATCH_STRIP=1 | ||
ARG PATCH_DIRS="" | ||
COPY patches/ ./patches/ | ||
COPY --chown=redmine:redmine config/ ./config/ | ||
|
||
# for GTT gem native extensions | ||
ARG GEM_PG_VERSION="1.2.3" | ||
COPY Gemfile.local ./ | ||
COPY plugins/ ./plugins/ | ||
COPY --chown=redmine:redmine Gemfile.local ./ | ||
|
||
RUN set -eux; \ | ||
\ | ||
savedAptMark="$(apt-mark showmanual)"; \ | ||
apt-get update; \ | ||
apt-get install -y --no-install-recommends \ | ||
# freetds-dev \ | ||
gcc \ | ||
# libmariadbclient-dev \ | ||
libpq-dev \ | ||
# libsqlite3-dev \ | ||
libgeos-dev \ | ||
make \ | ||
patch \ | ||
# in 4.1+, libmagickcore-dev and libmagickwand-dev are no longer necessary/used: https://www.redmine.org/issues/30492 | ||
libmagickcore-dev libmagickwand-dev \ | ||
# for GTT dependencies | ||
g++ \ | ||
libgeos-dev \ | ||
curl \ | ||
; \ | ||
rm -rf /var/lib/apt/lists/*; \ | ||
\ | ||
if [ -n "$PATCH_DIRS" ]; then \ | ||
for dir in $(echo $PATCH_DIRS | sed "s/,/ /g"); do \ | ||
for file in ./patches/"$dir"/*; do \ | ||
patch -p"$PATCH_STRIP" < $file; \ | ||
done; \ | ||
done; \ | ||
rm -rf ./patches/*; \ | ||
fi; \ | ||
curl -sL https://deb.nodesource.com/setup_14.x | bash -; \ | ||
apt-get install -y --no-install-recommends nodejs; \ | ||
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -; \ | ||
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list; \ | ||
apt-get update; \ | ||
apt-get install -y --no-install-recommends yarn; \ | ||
for plugin in ./plugins/*; do \ | ||
if [ -f "$plugin/webpack.config.js" ]; then \ | ||
cd "$plugin" && yarn && npx webpack && rm -rf node_modules && cd ../..; \ | ||
fi; \ | ||
done; \ | ||
export GEM_PG_VERSION="$GEM_PG_VERSION"; \ | ||
gosu redmine bundle config --local without 'development test'; \ | ||
# fill up "database.yml" with bogus entries so the redmine Gemfile will pre-install all database adapter dependencies | ||
# https://github.com/redmine/redmine/blob/e9f9767089a4e3efbd73c35fc55c5c7eb85dd7d3/Gemfile#L50-L79 | ||
echo '# the following entries only exist to force `bundle install` to pre-install all database adapter dependencies -- they can be safely removed/ignored' > ./config/database.yml; \ | ||
# for adapter in mysql2 postgresql sqlserver sqlite3; do \ | ||
for adapter in postgis; do \ | ||
echo "$adapter:" >> ./config/database.yml; \ | ||
echo " adapter: $adapter" >> ./config/database.yml; \ | ||
done; \ | ||
gosu redmine bundle install --jobs "$(nproc)"; \ | ||
rm ./config/database.yml; \ | ||
# fix permissions for running as an arbitrary user | ||
chmod -R ugo=rwX Gemfile.lock "$GEM_HOME"; \ | ||
rm -rf ~redmine/.bundle; \ | ||
|
@@ -145,11 +108,10 @@ RUN set -eux; \ | |
; \ | ||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false | ||
|
||
COPY config/ ./config/ | ||
VOLUME /usr/src/redmine/files | ||
|
||
COPY docker-entrypoint.sh / | ||
ENTRYPOINT ["/docker-entrypoint.sh"] | ||
COPY --chown=redmine:redmine docker-entrypoint.sh / | ||
|
||
EXPOSE 3000 | ||
CMD ["rails", "server", "-b", "0.0.0.0"] | ||
|
||
ENTRYPOINT [ "/docker-entrypoint.sh" ] | ||
|
||
CMD [ "rails", "s", "-b", "0.0.0.0" ] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
source 'https://rubygems.org' | ||
|
||
# each plugin's native extensions should be added to here | ||
gem "rgeo" | ||
gem "pg", (ENV['GEM_PG_VERSION'] ? "~> #{ENV['GEM_PG_VERSION']}" : "~> 1.2.3") | ||
gem 'puma' | ||
gem 'puma_worker_killer' | ||
gem 'lograge' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dkastl (CC: @smellman) Also, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure ... but we actually run it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Okay, sure at this moment... For debugging purpose, multiple workers (=3) and
How about this ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By the way, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, don't know very much about these details. Could you just make a change that works good for development and push it to this branch? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Do you mean only the following part ?
If so, it's okay for me. But if it's also gem dependencies ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the question is, what the "target audience" of this Docker setup is. I think your perspective is the developer point of view. But there could be also the point of view of someone, who wants to use this to deploy and use the service. For example some SMASH user. Of course it's best to support both use cases, for example with ENV settings. But we don't need to have this all ready with the first PR. Maybe the non-developer use case should be priority, because a developer can also adjust the Docker setup. What do you think? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,25 @@ | ||
# docker-gtt | ||
# Docker GTT | ||
|
||
Docker image for GTT Project | ||
|
||
## Quick start | ||
|
||
After cloning this repository run: | ||
|
||
``` | ||
```sh | ||
git submodule update --init | ||
cp .env.example .env | ||
docker-compose up --build | ||
docker compose up --build | ||
``` | ||
|
||
Open the application on http://localhost:3000/ | ||
Open the application on `http://localhost:3000/` | ||
|
||
Default user is `admin/admin`. | ||
|
||
## How to use GTT: | ||
## How to use GTT | ||
|
||
Find more information [how to get started with the GTT plugin](https://github.com/gtt-project/redmine_gtt#how-to-use). | ||
|
||
## LICENSE | ||
|
||
This program is free software. See [LICENSE](LICENSE) for more information. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,15 +21,10 @@ default: | |
email_delivery: | ||
delivery_method: :smtp | ||
smtp_settings: | ||
enable_starttls_auto: <%= ENV['SMTP_ENABLE_STARTTLS_AUTO'] %> | ||
enable_starttls_auto: <%= ENV['SMTP_ENABLE_STARTTLS_AUTO'] || true %> | ||
address: <%= ENV['SMTP_ADDRESS'] %> | ||
port: <%= ENV['SMTP_PORT'] %> | ||
port: <%= ENV['SMTP_PORT'] || 587 %> | ||
domain: <%= ENV['SMTP_DOMAIN'] %> | ||
authentication: <%= ENV['SMTP_AUTHENTICATION'] %> | ||
authentication: :plain | ||
dkastl marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dkastl (CC: @smellman) Is there some reason to drop this configuration ? |
||
user_name: <%= ENV['SMTP_USER_NAME'] %> | ||
password: <%= ENV['SMTP_PASSWORD'] %> | ||
|
||
# ==== Sendmail command | ||
# | ||
# email_delivery: | ||
# delivery_method: :sendmail |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
default: &default | ||
adapter: postgis | ||
database: <%= ENV['DB_NAME'] %> | ||
host: <%= ENV['DB_HOST'] %> | ||
username: <%= ENV['DB_USER'] %> | ||
password: <%= ENV['DB_PASS'] %> | ||
port: <%= ENV['DB_PORT'] || 5432 %> | ||
encoding: utf8 | ||
|
||
production: | ||
<<: *default | ||
|
||
test: | ||
<<: *default | ||
|
||
development: | ||
<<: *default |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# frozen_string_literal: true | ||
|
||
Rails.application.configure do | ||
# Settings specified here will take precedence over those in config/application.rb | ||
|
||
# Code is not reloaded between requests. | ||
config.cache_classes = true | ||
|
||
# Eager load code on boot. This eager loads most of Rails and | ||
# your application in memory, allowing both threaded web servers | ||
# and those relying on copy on write to perform better. | ||
# Rake tasks automatically ignore this option for performance. | ||
config.eager_load = true | ||
|
||
# Full error reports are disabled and caching is turned on. | ||
config.consider_all_requests_local = false | ||
config.action_controller.perform_caching = true | ||
|
||
# Disable delivery errors | ||
config.action_mailer.raise_delivery_errors = false | ||
|
||
# No email in production log | ||
config.action_mailer.logger = nil | ||
|
||
# Print deprecation notices to the Rails logger. | ||
config.active_support.deprecation = :log | ||
|
||
# Logging by JSON | ||
if ENV["RAILS_LOG_TO_STDOUT"].present? | ||
dkastl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
logger = ActiveSupport::Logger.new(STDOUT) | ||
logger.formatter = config.log_formatter | ||
config.logger = ActiveSupport::TaggedLogging.new(logger) | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Rails.application.configure do | ||
config.lograge.enabled = true | ||
config.lograge.formatter = Lograge::Formatters::Json.new | ||
config.lograge.custom_payload do |controller| | ||
current_user = controller.find_current_user | ||
user_name = current_user&.logged? ? "#{current_user.login}" : "anonymous" | ||
user_id = current_user&.logged? ? "#{current_user.id}" : "0" | ||
{ | ||
remote_ip: controller.request.remote_ip, | ||
user_name: user_name, | ||
user_id: user_id | ||
} | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
workers (ENV['PUMA_WORKERS'] || 3).to_i | ||
|
||
before_fork do | ||
require 'puma_worker_killer' | ||
|
||
PumaWorkerKiller.config do |config| | ||
config.ram = (ENV['RAILS_MEMORY_LIMIT'] || 2048).to_i | ||
dkastl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
config.frequency = 10 | ||
config.percent_usage = 0.8 | ||
config.rolling_restart_frequency = false | ||
config.reaper_status_logs = false | ||
end | ||
|
||
PumaWorkerKiller.start | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dkastl (CC: @smellman @nobnisai)
From yesterday's internal discussion, we agreed not to support other
development
andtest
environments, so thisRAILS_ENV
line will not be necessary. (Because, current code doesn't support configuration.)Note that plugin's test will not be available if we stick to
production
environment, so to develop plugins with tests, we need to setup another environment.