mirror of
https://github.com/opf/openproject.git
synced 2026-06-13 19:20:00 +00:00
Add files required for packaging OpenProject with Packager.io
This commit is contained in:
+1
-1
@@ -68,7 +68,7 @@
|
||||
/*.rbc
|
||||
/doc/app
|
||||
#/Gemfile.lock
|
||||
/Gemfile.local
|
||||
#/Gemfile.local
|
||||
/Gemfile.plugins
|
||||
/.rvmrc*
|
||||
/.ruby-version
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
user: openproject
|
||||
group: openproject
|
||||
targets:
|
||||
debian-7:
|
||||
build_dependencies:
|
||||
- libmagickwand-dev
|
||||
- libsqlite3-dev
|
||||
dependencies:
|
||||
- debconf
|
||||
- memcached
|
||||
before_precompile: "./packaging/debian/setup.sh"
|
||||
after_install: "packaging/debian/postinst"
|
||||
addons:
|
||||
- mysql
|
||||
- apache2
|
||||
- svn-dav
|
||||
- smtp
|
||||
crons:
|
||||
- packaging/cron/openproject-clear-old-sessions
|
||||
- packaging/cron/openproject-create-svn-repositories
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
ruby '2.1.1'
|
||||
group :production do
|
||||
gem 'rails_12factor'
|
||||
gem 'unicorn'
|
||||
end
|
||||
|
||||
@@ -175,6 +175,7 @@ GEM
|
||||
json_spec (1.1.1)
|
||||
multi_json (~> 1.0)
|
||||
rspec (~> 2.0)
|
||||
kgio (2.9.2)
|
||||
launchy (2.3.0)
|
||||
addressable (~> 2.3)
|
||||
letter_opener (1.0.0)
|
||||
@@ -251,8 +252,13 @@ GEM
|
||||
rails-dev-tweaks (0.6.1)
|
||||
actionpack (~> 3.1)
|
||||
railties (~> 3.1)
|
||||
rails_12factor (0.0.2)
|
||||
rails_serve_static_assets
|
||||
rails_stdout_logging
|
||||
rails_autolink (1.1.0)
|
||||
rails (> 3.1)
|
||||
rails_serve_static_assets (0.0.2)
|
||||
rails_stdout_logging (0.0.3)
|
||||
railties (3.2.19)
|
||||
actionpack (= 3.2.19)
|
||||
activesupport (= 3.2.19)
|
||||
@@ -260,6 +266,7 @@ GEM
|
||||
rake (>= 0.8.7)
|
||||
rdoc (~> 3.4)
|
||||
thor (>= 0.14.6, < 2.0)
|
||||
raindrops (0.13.0)
|
||||
rake (10.3.2)
|
||||
rb-fsevent (0.9.3)
|
||||
rb-inotify (0.9.2)
|
||||
@@ -350,6 +357,10 @@ GEM
|
||||
uglifier (2.1.1)
|
||||
execjs (>= 0.3.0)
|
||||
multi_json (~> 1.0, >= 1.0.2)
|
||||
unicorn (4.8.3)
|
||||
kgio (~> 2.6)
|
||||
rack
|
||||
raindrops (~> 0.7)
|
||||
websocket (1.0.7)
|
||||
will_paginate (3.0.5)
|
||||
xpath (2.0.0)
|
||||
@@ -417,6 +428,7 @@ DEPENDENCIES
|
||||
rack_session_access
|
||||
rails (~> 3.2.19)
|
||||
rails-dev-tweaks (~> 0.6.1)
|
||||
rails_12factor
|
||||
rails_autolink
|
||||
rb-fsevent
|
||||
rb-readline
|
||||
@@ -444,4 +456,5 @@ DEPENDENCIES
|
||||
thin
|
||||
timecop (~> 0.6.1)
|
||||
uglifier (>= 1.0.3)
|
||||
unicorn
|
||||
will_paginate (~> 3.0)
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
web: bundle exec unicorn --host ${HOST:="127.0.0.1"} --port ${PORT:="8080"} --env ${RAILS_ENV:="development"}
|
||||
worker: bundle exec rake jobs:work
|
||||
backup: ./packaging/scripts/backup
|
||||
@@ -0,0 +1,2 @@
|
||||
15 1 * * * root openproject run rake -s db:sessions:expire[7] >> /var/log/openproject/cron-clear-old-sessions.log 2>&1
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
*/10 * * * * root /opt/openproject/packaging/scripts/create-svn-repositories >> /var/log/openproject/cron-create-svn-repositories.log 2>&1
|
||||
@@ -0,0 +1,11 @@
|
||||
default:
|
||||
rails_cache_store: :memcache
|
||||
session_store: :cache_store
|
||||
email_delivery_method: <%= ENV.fetch('EMAIL_DELIVERY_METHOD') { :sendmail } %>
|
||||
smtp_address: <%= ENV['SMTP_HOST'] %>
|
||||
smtp_port: <%= ENV.fetch('SMTP_PORT') { 25 }.to_i %>
|
||||
smtp_domain: <%= ENV.fetch('SMTP_DOMAIN') { ENV['HOSTNAME'] } %>
|
||||
smtp_authentication: :login
|
||||
smtp_user_name: <%= ENV['SMTP_USERNAME'] %>
|
||||
smtp_password: <%= ENV['SMTP_PASSWORD'] %>
|
||||
attachments_storage_path: <%= ENV.fetch('ATTACHMENTS_STORAGE_PATH') { "/var/db/openproject/files" } %>
|
||||
Executable
+69
@@ -0,0 +1,69 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
# summary of how this script can be called:
|
||||
# * <postinst> `configure' <most-recently-configured-version>
|
||||
# * <old-postinst> `abort-upgrade' <new version>
|
||||
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
|
||||
# <new-version>
|
||||
# * <postinst> `abort-remove'
|
||||
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
|
||||
# <failed-install-package> <version> `removing'
|
||||
# <conflicting-package> <version>
|
||||
# for details, see http://www.debian.org/doc/debian-policy/ or
|
||||
# the debian-policy package
|
||||
|
||||
APP_NAME="openproject"
|
||||
CLI="${APP_NAME}"
|
||||
|
||||
# source debconf library
|
||||
. /usr/share/debconf/confmodule
|
||||
|
||||
case "$1" in
|
||||
|
||||
configure)
|
||||
rake_commands="db:migrate"
|
||||
if [ "$2" = "" ]; then
|
||||
rake_commands="${rake_commands} db:seed"
|
||||
fi
|
||||
|
||||
# create attachments folder
|
||||
attachments_path=$(${CLI} config:get ATTACHMENTS_STORAGE_PATH || echo "/var/db/openproject/files")
|
||||
mkdir -p "${attachments_path}"
|
||||
chown ${APP_NAME}.${APP_NAME} "${attachments_path}"
|
||||
${CLI} config:set ATTACHMENTS_STORAGE_PATH="${attachments_path}"
|
||||
|
||||
# set SECRET_TOKEN env variable
|
||||
secret_token=$(${CLI} config:get SECRET_TOKEN || ( < /dev/urandom tr -dc a-z0-9 | head -c128; echo ))
|
||||
${CLI} config:set SECRET_TOKEN="$secret_token"
|
||||
|
||||
# migrate
|
||||
${CLI} run rake ${rake_commands} || true
|
||||
|
||||
sys_api_key=$(${CLI} config:get SYS_API_KEY)
|
||||
|
||||
# set various settings
|
||||
db_get openproject/server/hostname
|
||||
if [ -z "$RET" ]; then web_hostname=$(hostname -f); else web_hostname="$RET"; fi
|
||||
db_get openproject/server/ssl
|
||||
if [ "$RET" = "true" ]; then web_protocol="https"; else web_protocol="http"; fi
|
||||
|
||||
${CLI} run rake setting:set[host_name=${web_hostname},protocol=${web_protocol},sys_api_enabled=1,sys_api_key=${sys_api_key}] 1>/dev/null
|
||||
|
||||
# scale
|
||||
${CLI} scale web=1 worker=1 || true
|
||||
|
||||
# let the admin reboot when he's ready
|
||||
;;
|
||||
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
exit 0
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "postinst called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# we need postgresql for asset precompilation
|
||||
# see: https://packager.io/documentation
|
||||
sudo service postgresql start
|
||||
|
||||
cp -f packaging/debian/conf/configuration.yml config/configuration.yml
|
||||
|
||||
Executable
+61
@@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
TARGET=${TARGET:=$ORIGINAL_PWD}
|
||||
TARGET=${TARGET:=$(pwd)}
|
||||
TARGET="/var/db/openproject/backup"
|
||||
|
||||
mkdir -p "${TARGET}"
|
||||
|
||||
timestamp=$(date +"%Y%m%d%H%M%S")
|
||||
|
||||
echo -n "* Generating database backup..." >&2
|
||||
|
||||
tmpfile=$(mktemp)
|
||||
|
||||
database=$(ruby -ruri -e 'puts URI(ENV["DATABASE_URL"]).path[1..-1]')
|
||||
|
||||
ruby -ruri -e '
|
||||
uri = URI(ENV["DATABASE_URL"])
|
||||
config=<<CONFIG
|
||||
[client]
|
||||
password="#{uri.password}"
|
||||
user="#{uri.user}"
|
||||
host="#{uri.host}"
|
||||
port="#{uri.port}"
|
||||
CONFIG
|
||||
puts config' > ${tmpfile}
|
||||
|
||||
dst="${TARGET}/mysql-dump-${timestamp}.sql.gz"
|
||||
mysqldump --defaults-file=${tmpfile} --single-transaction "${database}" | gzip > "$dst"
|
||||
echo " done" >&2
|
||||
echo "$dst"
|
||||
rm -f ${tmpfile}
|
||||
|
||||
if [ -d "$SVN_REPOSITORIES" ]; then
|
||||
dst="${TARGET}/svn-repositories-${timestamp}.tar.gz"
|
||||
echo -n "* Generating SVN repositories backup..." >&2
|
||||
if tar czf "$dst" -C "${SVN_REPOSITORIES}" . ; then
|
||||
echo " done" >&2
|
||||
echo "$dst"
|
||||
else
|
||||
echo " failed" >&2
|
||||
fi
|
||||
else
|
||||
echo "* No SVN repositories folder. Ignoring." >&2
|
||||
fi
|
||||
|
||||
if [ -d "$ATTACHMENTS_STORAGE_PATH" ]; then
|
||||
dst="${TARGET}/attachments-${timestamp}.tar.gz"
|
||||
echo -n "* Generating attachments backup..." >&2
|
||||
if tar czf "$dst" -C "${ATTACHMENTS_STORAGE_PATH}" . ; then
|
||||
echo " done" >&2
|
||||
echo "$dst"
|
||||
else
|
||||
echo " failed" >&2
|
||||
fi
|
||||
else
|
||||
echo "* No attachments folder. Ignoring." >&2
|
||||
fi
|
||||
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
SVN_REPOSITORIES=$(openproject config:get SVN_REPOSITORIES)
|
||||
PORT=$(openproject config:get PORT)
|
||||
SYS_API_KEY=$(openproject config:get SYS_API_KEY)
|
||||
|
||||
/opt/openproject/bin/ruby /opt/openproject/extra/svn/reposman.rb \
|
||||
--openproject-host "http://127.0.0.1:${PORT}" \
|
||||
--owner "www-data" \
|
||||
--group "openproject" \
|
||||
--public-mode '2750' \
|
||||
--private-mode '2750' \
|
||||
--svn-dir "${SVN_REPOSITORIES}" \
|
||||
--url "file://${SVN_REPOSITORIES}" \
|
||||
--key "${SYS_API_KEY}" \
|
||||
--scm Subversion \
|
||||
--verbose
|
||||
|
||||
Reference in New Issue
Block a user