0
点赞
收藏
分享

微信扫一扫

redmine添加webhook

棒锤_45f2 2022-04-01 阅读 52
docker

redmin使用docker安装版本具体版本如图:

 安装使用自建数据库,参考Guide - Redmine

我使用mysql,搭建完后使用sql:

CREATE DATABASE redmine CHARACTER SET utf8mb4;
CREATE USER 'redmine'@'%' IDENTIFIED BY 'redmin';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'%';

redmin搭建docker-compose.yml

version: '2'

networks:
  redmine-network:
services:
  redmine:
    image: bitnami/redmine:latest
    container_name: redmine
    ports:
      - 3001:3000
    networks:
      - redmine-network
    volumes:
      - ./plugins:/bitnami/redmine/plugins
      - ./themes:/bitnami/redmine/public/themes
      - ./files:/bitnami/redmine/files
      - ./config/:/bitnami/redmine/config
    environment:
      # Host name matches the MySQL container name.
      REDMINE_DB_MYSQL: 192.168.227.5
      REDMINE_DB_PORT: 3306
      REDMINE_DB_USERNAME: redmine
      REDMINE_DB_PASSWORD: redmine
      REDMINE_DB_DATABASE: redmine
      REDMINE_DB_ENCODING: utf8mb4
    restart: always

同级创建config,plugins,files,themes文件夹,config下创建两个文件

# Default setup is given for MySQL 5.7.7 or later.
# Examples for PostgreSQL, SQLite3 and SQL Server can be found at the end.
# Line indentation must be 2 spaces (no tabs).

production:
  adapter: mysql2
  database: redmine
  host: 192.168.227.5
  username: redmine
  password: "redmine"
  # Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7
  encoding: utf8mb4

development:
  adapter: mysql2
  database: redmine_development
  host: localhost
  username: root
  password: ""
  # Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7
  encoding: utf8mb4

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: mysql2
  database: redmine
  host: localhost
  username: root
  password: "root"
  # Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7
  encoding: utf8mb4

# PostgreSQL configuration example
#production:
#  adapter: postgresql
#  database: redmine
#  host: localhost
#  username: postgres
#  password: "postgres"

# SQLite3 configuration example
#production:
#  adapter: sqlite3
#  database: db/redmine.sqlite3

# SQL Server configuration example
#production:
#  adapter: sqlserver
#  database: redmine
#  host: localhost
#  username: jenkins
#  password: jenkins
# = Redmine configuration file
#
# Each environment has its own configuration options.  If you are only
# running in production, only the production block needs to be configured.
# Environment specific configuration options override the default ones.
#
# Note that this file needs to be a valid YAML file.
# DO NOT USE TABS! Use 2 spaces instead of tabs for indentation.

# default configuration options for all environments
default:
  # Outgoing emails configuration
  # See the examples below and the Rails guide for more configuration options:
  # http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration
  email_delivery:

  # ==== Simple SMTP server at localhost
  #
  #  email_delivery:
  #    delivery_method: :smtp
  #    smtp_settings:
  #      address: "localhost"
  #      port: 25
  #
  # ==== SMTP server at example.com using LOGIN authentication and checking HELO for foo.com
  #
  #  email_delivery:
  #    delivery_method: :smtp
  #    smtp_settings:
  #      address: "example.com"
  #      port: 25
  #      authentication: :login
  #      domain: 'foo.com'
  #      user_name: 'myaccount'
  #      password: 'password'
  #
  # ==== SMTP server at example.com using PLAIN authentication
  #
  #  email_delivery:
  #    delivery_method: :smtp
  #    smtp_settings:
  #      address: "example.com"
  #      port: 25
  #      authentication: :plain
  #      domain: 'example.com'
  #      user_name: 'myaccount'
  #      password: 'password'
  #
  # ==== SMTP server at using TLS (GMail)
  # This might require some additional configuration. See the guides at:
  # http://www.redmine.org/projects/redmine/wiki/EmailConfiguration
  #
  #  email_delivery:
  #    delivery_method: :smtp
  #    smtp_settings:
  #      enable_starttls_auto: true
  #      address: "smtp.gmail.com"
  #      port: 587
  #      domain: "smtp.gmail.com" # 'your.domain.com' for GoogleApps
  #      authentication: :plain
  #      user_name: "your_email@gmail.com"
  #      password: "your_password"
  #
  # ==== Sendmail command
  #
  #  email_delivery:
  #    delivery_method: :sendmail

  # Absolute path to the directory where attachments are stored.
  # The default is the 'files' directory in your Redmine instance.
  # Your Redmine instance needs to have write permission on this
  # directory.
  # Examples:
  # attachments_storage_path: /var/redmine/files
  # attachments_storage_path: D:/redmine/files
  attachments_storage_path:

  # Configuration of the autologin cookie.
  # autologin_cookie_name: the name of the cookie (default: autologin)
  # autologin_cookie_path: the cookie path (default: /)
  # autologin_cookie_secure: true sets the cookie secure flag (default: false)
  autologin_cookie_name:
  autologin_cookie_path:
  autologin_cookie_secure:

  # Configuration of SCM executable command.
  #
  # Absolute path (e.g. /usr/local/bin/hg) or command name (e.g. hg.exe, bzr.exe)
  # On Windows + CRuby, *.cmd, *.bat (e.g. hg.cmd, bzr.bat) does not work.
  #
  # On Windows + JRuby 1.6.2, path which contains spaces does not work.
  # For example, "C:\Program Files\TortoiseHg\hg.exe".
  # If you want to this feature, you need to install to the path which does not contains spaces.
  # For example, "C:\TortoiseHg\hg.exe".
  #
  # Examples:
  # scm_subversion_command: svn                                       # (default: svn)
  # scm_mercurial_command:  C:\Program Files\TortoiseHg\hg.exe        # (default: hg)
  # scm_git_command:        /usr/local/bin/git                        # (default: git)
  # scm_cvs_command:        cvs                                       # (default: cvs)
  # scm_bazaar_command:     bzr.exe                                   # (default: bzr)
  #
  scm_subversion_command:
  scm_mercurial_command:
  scm_git_command:
  scm_cvs_command:
  scm_bazaar_command:

  # SCM paths validation.
  #
  # You can configure a regular expression for each SCM that will be used to
  # validate the path of new repositories (eg. path entered by users with the
  # "Manage repositories" permission and path returned by reposman.rb).
  # The regexp will be wrapped with \A \z, so it must match the whole path.
  # And the regexp is case sensitive.
  #
  # You can match the project identifier by using %project% in the regexp.
  #
  # You can also set a custom hint message for each SCM that will be displayed
  # on the repository form instead of the default one.
  #
  # Examples:
  # scm_subversion_path_regexp: file:///svnpath/[a-z0-9_]+
  # scm_subversion_path_info: SVN URL (eg. file:///svnpath/foo)
  #
  # scm_git_path_regexp: /gitpath/%project%(\.[a-z0-9_])?/
  #
  scm_subversion_path_regexp:
  scm_mercurial_path_regexp:
  scm_git_path_regexp:
  scm_cvs_path_regexp:
  scm_bazaar_path_regexp:
  scm_filesystem_path_regexp:

设置完两个文件就可以启动了

webhook我试了很久,使用docker安装默认使用production配置,但是现在了操作。

过程为,下载webhook,更换为deployment开发模式,然后将webhook需要的包修改添加到Gemfile文件,然后跑起来

下载webhook文件到plugins

返回原路径

修改redmine Gemfile文件,添加gem 'faraday'

镜像里没有编辑软件,我用docker cp替换的。

source 'https://rubygems.org'

ruby '>= 2.4.0', '< 2.8.0'
gem 'bundler', '>= 1.12.0'

gem 'rails', '5.2.6.3'
gem 'sprockets', '~> 3.7.2' if RUBY_VERSION < '2.5'
gem 'globalid', '~> 0.4.2' if Gem.ruby_version < Gem::Version.new('2.6.0')
gem 'rouge', '~> 3.26.0'
gem 'request_store', '~> 1.5.0'
gem "mini_mime", "~> 1.0.1"
gem "actionpack-xml_parser"
gem 'roadie-rails', (RUBY_VERSION < '2.5' ? '~> 1.3.0' : '~> 2.2.0')
gem 'marcel'
gem "mail", "~> 2.7.1"
gem 'csv', (RUBY_VERSION < '2.5' ? ['>= 3.1.1', '<= 3.1.5'] : '~> 3.1.1')
gem 'nokogiri', (RUBY_VERSION < '2.5' ? '~> 1.10.0' : '~> 1.11.1')
gem 'i18n', '~> 1.8.2'
gem "rbpdf", "~> 1.20.0"
gem 'addressable'
gem 'rubyzip', '~> 2.3.0'
#下面这一行是添加的
gem 'faraday'

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :x64_mingw, :mswin]

# TOTP-based 2-factor authentication
gem 'rotp', '>= 5.0.0'
gem 'rqrcode'

# Optional gem for LDAP authentication
group :ldap do
  gem 'net-ldap', '~> 0.17.0'
end

# Optional gem for OpenID authentication
group :openid do
  gem "ruby-openid", "~> 2.9.2", :require => "openid"
  gem "rack-openid"
end

# Optional gem for exporting the gantt to a PNG file
group :minimagick do
  gem 'mini_magick', '~> 4.11.0'
end

# Optional Markdown support, not for JRuby
group :markdown do
  gem 'redcarpet', '~> 3.5.1'
end

# Include database gems for the adapters found in the database
# configuration file
require 'erb'
require 'yaml'
database_file = File.join(File.dirname(__FILE__), "config/database.yml")
if File.exist?(database_file)
  yaml_config = ERB.new(IO.read(database_file)).result
  database_config = YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(yaml_config) : YAML.load(yaml_config)
  adapters = database_config.values.map {|c| c['adapter']}.compact.uniq
  if adapters.any?
    adapters.each do |adapter|
      case adapter
      when 'mysql2'
        gem "mysql2", "~> 0.5.0", :platforms => [:mri, :mingw, :x64_mingw]
      when /postgresql/
        gem "pg", "~> 1.2.2", :platforms => [:mri, :mingw, :x64_mingw]
      when /sqlite3/
        gem "sqlite3", "~> 1.4.0", :platforms => [:mri, :mingw, :x64_mingw]
      when /sqlserver/
        gem "tiny_tds", "~> 2.1.2", :platforms => [:mri, :mingw, :x64_mingw]
        gem "activerecord-sqlserver-adapter", "~> 5.2.1", :platforms => [:mri, :mingw, :x64_mingw]
      else
        warn("Unknown database adapter `#{adapter}` found in config/database.yml, use Gemfile.local to load your own database gems")
      end
    end
  else
    warn("No adapter found in config/database.yml, please configure it first")
  end
else
  warn("Please configure your config/database.yml first")
end

group :development do
  gem "yard"
end

group :test do
  gem "rails-dom-testing"
  gem 'mocha', '>= 1.4.0'
  gem 'simplecov', '~> 0.18.5', :require => false
  gem "ffi", platforms: [:mingw, :x64_mingw, :mswin]
  # For running system tests
  gem 'puma'
  gem 'capybara', '~> 3.31.0'
  gem "selenium-webdriver"
  gem 'webdrivers', '~> 4.4', require: false
  # RuboCop
  gem 'rubocop', '~> 1.12.0'
  gem 'rubocop-performance', '~> 1.10.1'
  gem 'rubocop-rails', '~> 2.9.0'
end

local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local")
if File.exists?(local_gemfile)
  eval_gemfile local_gemfile
end

# Load plugins' Gemfiles
Dir.glob File.expand_path("../plugins/*/{Gemfile,PluginGemfile}", __FILE__) do |file|
  eval_gemfile file
end

gem "passenger"

没有报错,redmin网页管理下插件就能看到了。

举报

相关推荐

0 条评论