Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- set -e
- [ -z "${MYSQL_PASSWD}" ] && MYSQL_PASSWD=mysql
- [ -z "${REDMINE_PASSWD}" ] && REDMINE_PASSWD=redmine
- redmine_install()
- {
- sudo pacman -Sy --noconfirm ruby ruby-bundler
- for f in ruby gem rake bundle; do
- sudo ln -s "$(which ${f}-2.3)" /usr/bin/"${f}"
- done
- # Ruby on Rails.
- cd /usr/share/webapps/redmine/
- cat <<EOF | sudo tee config/database.yml
- production:
- adapter: mysql2
- database: redmine
- host: localhost
- username: redmine
- password: "${REDMINE_PASSWD}"
- encoding: utf8
- EOF
- sudo bundle install --without development test
- sudo RAILS_ENV=production bundle exec rake generate_secret_token
- sudo RAILS_ENV=production bundle exec rake db:migrate
- echo "en" | \
- sudo RAILS_ENV=production bundle exec rake redmine:load_default_data
- sudo chown -R http:http files log tmp public/plugin_assets
- }
- apache_install()
- {
- sudo pacman -Sy --noconfirm apache
- sudo systemctl enable httpd
- # ssl configuration.
- # Country Name (2 letter code) [AU]:
- # State or Province Name (full name) [Some-State]:
- # Locality Name (eg, city) []:
- # Organization Name (eg, company) [Internet Widgits Pty Ltd]:
- # Organizational Unit Name (eg, section) []:
- # Common Name (e.g. server FQDN or YOUR name) []:
- # Email Address []:
- cat <<EOF | sudo openssl req -new -x509 -nodes -newkey rsa:4096 -days 1095 \
- -keyout /etc/httpd/conf/server.key \
- -out /etc/httpd/conf/server.crt
- AU
- Some-State
- city
- company
- section
- EOF
- sudo sed -i /etc/httpd/conf/httpd.conf \
- -e 's/^#LoadModule ssl_module/LoadModule ssl_module/g' \
- -e 's/^#LoadModule socache_shmcb_module/LoadModule socache_shmcb_module/g'
- cat <<EOF | sudo tee -a /etc/httpd/conf/httpd.conf
- Include conf/extra/httpd-ssl.conf
- EOF
- # rewrite configuration.
- sudo sed -i /etc/httpd/conf/httpd.conf \
- -e 's/^#LoadModule rewrite_module/LoadModule rewrite_module/g'
- cat << EOF | sudo tee /etc/httpd/conf/extra/redirect-to-https.conf
- RewriteEngine On
- RewriteCond %{HTTPS} off
- RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI}
- EOF
- cat <<EOF | sudo tee -a /etc/httpd/conf/httpd.conf
- Include conf/extra/redirect-to-https.conf
- EOF
- # passenger configuration.
- sudo gem install --no-user-install passenger
- cd /opt/ruby2.3/lib/ruby/gems/2.3.0/gems/passenger-5.1.11/bin
- echo "1" | sudo ./passenger-install-apache2-module
- cat << EOF | sudo tee /etc/httpd/conf/extra/passenger.conf
- PassengerRoot /opt/ruby2.3/lib/ruby/gems/2.3.0/gems/passenger-5.1.11
- PassengerDefaultRuby /opt/ruby2.3/bin/ruby-2.3
- PassengerDefaultUser http
- RailsBaseURI /redmine
- EOF
- cat <<EOF | sudo tee -a /etc/httpd/conf/httpd.conf
- LoadModule passenger_module \
- /opt/ruby2.3/lib/ruby/gems/2.3.0/gems/passenger-5.1.11/buildout/apache2/mod_passenger.so
- Include conf/extra/passenger.conf
- EOF
- # redmine configuration.
- sudo ln -s /usr/share/webapps/redmine/public /srv/http/redmine
- cat << EOF | sudo tee /etc/httpd/conf/extra/redmine.conf
- <Directory /redmine>
- Options FollowSymLinks
- PassengerResolveSymlinksInDocumentRoot on
- AllowOverride None
- </Directory>
- EOF
- cat <<EOF | sudo tee -a /etc/httpd/conf/httpd.conf
- Include conf/extra/redmine.conf
- EOF
- sudo systemctl restart httpd
- }
- redmine_main()
- {
- redmine_install
- apache_install
- }
- redmine_main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement