Redmine4.1.1使用Thin作为Web服务器(Ubuntu20.04.2)
准备工作
按 Redmine 官方文档 Installation Guide 安装好了Redmine 4.1.1. 具体的环境见最后“环境信息”
使用webrick可以运行redmine:
bundle exec rails server webrick -e production
安装thin
$ sudo apt install thin
$ thin -v
thin 1.7.2 codename Bachmanity
配置 Redmine4.1.1 的gemfile
# samxiao @ rm411 in ~/redmine-4.1.1 [12:16:42]
$ vi Gemfile.local
# samxiao @ rm411 in ~/redmine-4.1.1 [12:17:12]
$ cat Gemfile.local
gem 'thin'
运行thin作为web服务的Redmine
# samxiao @ rm411 in ~/redmine-4.1.1 [12:19:41] C:127
$ bundle exec rails server thin -e production
=> Booting Thin
=> Rails 5.2.4.2 application starting in production on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
2021-02-19 12:19:55 +0800 Thin web server (v1.8.0 codename Possessed Pickle)
2021-02-19 12:19:55 +0800 Maximum connections set to 1024
2021-02-19 12:19:55 +0800 Listening on 0.0.0.0:3000, CTRL+C to stop
后台运行
thin默认端口是3000:
# samxiao @ rm411 in ~/redmine-4.1.1 [12:19:41] C:127
$ bundle exec rails server thin -e production -d
thin指定端口运行,如10086
# samxiao @ rm411 in ~/redmine-4.1.1 [16:17:54]
$ bundle exec rails server thin -e production -p 10086 -d
=> Booting Thin
=> Rails 5.2.4.2 application starting in production on http://0.0.0.0:10086
=> Run `rails server -h` for more startup options
停止thin
# samxiao @ rm411 in ~/redmine-4.1.1 [16:06:20]
$ ps aux | grep thin
samxiao 290351 0.6 8.8 295028 177008 ? Sl 16:06 0:04 /usr/local/bin/ruby bin/rails server thin -e production -d
samxiao 302055 0.0 0.0 6432 672 pts/3 S+ 16:17 0:00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-di
r=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox thin
# samxiao @ rm411 in ~/redmine-4.1.1 [16:17:36]
$ kill -9 290351
# samxiao @ rm411 in ~/redmine-4.1.1 [16:17:44]
$ kill -9 290351
kill: kill 290351 failed: no such process
# samxiao @ rm411 in ~/redmine-4.1.1 [16:24:36] C:1
$ ps aux | grep thin
samxiao 302365 0.3 8.5 287972 171504 ? Sl 16:17 0:01 /usr/local/bin/ruby bin/rails server thin -e production -d
samxiao 309331 0.0 0.0 6432 672 pts/3 S+ 16:24 0:00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-di
r=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox thin
# samxiao @ rm411 in ~/redmine-4.1.1 [16:24:47]
$ kill -9 302365
# samxiao @ rm411 in ~/redmine-4.1.1 [16:24:53]
$
环境信息
Ubuntu
Ubuntu 20.04.2 LTS \n \l
-------------------------------
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
-------------------------------
Linux rm411 5.4.0-65-generic #73-Ubuntu SMP Mon Jan 18 17:25:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
-------------------------------
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 60
model name : Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz
stepping : 3
microcode : 0x24
cpu MHz : 2494.236
cache size : 6144 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe
1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc cpuid pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2
x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm cpuid_fault invpcid_single pti ibrs ibpb stibp
fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid xsaveopt arat arch_capabilities
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit srbds
bogomips : 4988.47
clflush size : 64
cache_alignment : 64
address sizes : 43 bits physical, 48 bits virtual
power management:
mysql/apache2/ruby/rails/...
# samxiao @ rm411 in ~ [12:52:03]
$ mysql -V
mysql Ver 8.0.23-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu))
$ rails -v
Rails 6.1.3
# samxiao @ rm411 in ~/redmine-4.1.1 [12:52:53]
$ rails -v
Rails 5.2.4.2
$ apache2 -v
Server version: Apache/2.4.41 (Ubuntu)
Server built: 2020-08-12T19:46:17
$ thin -v
thin 1.8.0 codename Possessed Pickle
$ ruby -v
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
$ rake -V
rake, version 13.0.3
$ bundle -v
Bundler version 2.1.4
$ gem -v
3.1.4
不同路径下使用的rails 版本不同
gem
# samxiao @ rm411 in ~/redmine-4.1.1 [12:48:43] C:130
$ gem list
gem list
*** LOCAL GEMS ***
actioncable (6.1.3, 5.2.4.2)
actionmailbox (6.1.3)
actionmailer (6.1.3, 5.2.4.2)
actionpack (6.1.3, 5.2.4.2)
actionpack-xml_parser (2.0.1)
actiontext (6.1.3)
actionview (6.1.3, 5.2.4.2)
activejob (6.1.3, 5.2.4.2)
activemodel (6.1.3, 5.2.4.2)
activerecord (6.1.3, 5.2.4.2)
activestorage (6.1.3, 5.2.4.2)
activesupport (6.1.3, 5.2.4.2)
addressable (2.7.0)
arel (9.0.0)
benchmark (default: 0.1.0)
bigdecimal (default: 2.0.0)
loofah (2.9.0)
mail (2.7.1)
marcel (0.3.3)
matrix (default: 0.2.0)
method_source (1.0.0)
mimemagic (0.3.5)
mini_magick (4.9.5)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.14.3, 5.13.0)
mutex_m (default: 0.1.0)
mysql2 (0.5.3)
net-ldap (0.16.3)
net-pop (default: 0.1.0)
net-smtp (default: 0.1.0)
net-telnet (0.2.0)
nio4r (2.5.5)
nokogiri (1.11.1 x86_64-linux, 1.10.10)
observer (default: 0.1.0)
open3 (default: 0.1.0)
openssl (default: 2.1.2)
ostruct (default: 0.2.0)
power_assert (1.1.7)
prime (default: 0.1.1)
pstore (default: 0.1.0)
psych (default: 3.1.0)
public_suffix (4.0.6)
racc (default: 1.4.16)
rack (2.2.3)
rack-openid (1.4.2)
rack-test (1.1.0)
rails (6.1.3, 5.2.4.2)
rails-dom-testing (2.0.3)
rails-html-sanitizer (1.3.0)
railties (6.1.3, 5.2.4.2)
rake (13.0.3, 13.0.1)
rbpdf (1.20.1)
rbpdf-font (1.19.1)
rdoc (default: 6.2.1)
readline (default: 0.0.2)
redcarpet (3.5.1)
reline (default: 0.1.5)
request_store (1.4.1)
rexml (default: 3.2.3)
roadie (4.0.0)
roadie-rails (2.1.1)
rouge (3.12.0)
rss (default: 0.2.8)
ruby-openid (2.9.2)
sdbm (default: 1.0.0)
singleton (default: 0.1.0)
sprockets (4.0.2)
sprockets-rails (3.2.2)
stringio (default: 0.1.0)
strscan (default: 1.0.3)
test-unit (3.3.4)
thin (1.8.0)
thor (1.1.0)
thread_safe (0.3.6)
timeout (default: 0.1.0)
tracer (default: 0.1.0)
tzinfo (2.0.4, 1.2.9)
uri (default: 0.10.0)
webrick (default: 1.6.0)
websocket-driver (0.7.3)
websocket-extensions (0.1.5)
xmlrpc (0.3.0)
yaml (default: 0.1.0)
zeitwerk (2.4.2)
zlib (default: 1.1.0)
# samxiao @ rm411 in ~/redmine-4.1.1 [12:48:46]
资源占用情况
# samxiao @ rm411 in ~/redmine-4.1.1 [12:53:57]
$ free -h
total used free shared buff/cache available
Mem: 1.9Gi 797Mi 163Mi 3.0Mi 998Mi 986Mi
Swap: 2.0Gi 0.0Ki 2.0Gi
# samxiao @ rm411 in ~/redmine-4.1.1 [13:39:57]
$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 937M 0 937M 0% /dev
tmpfs 196M 1.3M 195M 1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv 20G 6.5G 13G 35% /
tmpfs 980M 80K 980M 1% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 980M 0 980M 0% /sys/fs/cgroup
/dev/sda2 976M 104M 806M 12% /boot
/dev/loop1 56M 56M 0 100% /snap/core18/1988
/dev/loop0 56M 56M 0 100% /snap/core18/1944
/dev/loop2 70M 70M 0 100% /snap/lxd/19188
/dev/loop3 32M 32M 0 100% /snap/snapd/10707
/dev/loop4 32M 32M 0 100% /snap/snapd/11036
tmpfs 196M 0 196M 0% /run/user/1000
# samxiao @ rm411 in ~/redmine-4.1.1 [13:41:40]
$ ps aux --sort -rss | more
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
mysql 1012 0.2 19.5 1284856 393084 ? Ssl 11:24 0:18 /usr/sbin/mysqld
samxiao 68108 0.0 8.7 356076 175912 ? Sl 12:25 0:02 /usr/local/bin/ruby bin/rails server thin -e production -d
root 863 0.0 2.0 722832 41824 ? Ssl 11:24 0:01 /usr/lib/snapd/snapd
root 906 0.0 1.4 224572 29352 ? Ss 11:24 0:00 /usr/sbin/apache2 -k start
root 482 0.0 1.0 61920 21632 ? S<s 11:24 0:02 /lib/systemd/systemd-journald
root 921 0.0 1.0 107880 20548 ? Ssl 11:24 0:00 /usr/bin/python3 /usr/share/unattended-upgrades/unattended-upgrade-
shutdown --wait-for-signal
root 689 0.0 0.8 345772 17992 ? SLsl 11:24 0:05 /sbin/multipathd -d -s
root 854 0.0 0.8 29068 17896 ? Ss 11:24 0:00 /usr/bin/python3 /usr/bin/networkd-dispatcher --run-startup-trigger
s
root 1 0.0 0.6 105352 12772 ? Ss 11:24 0:03 /sbin/init auto automatic-ubiquity noprompt
www-data 937 0.0 0.6 225052 12256 ? S 11:24 0:00 /usr/sbin/apache2 -k start
www-data 938 0.0 0.6 225052 12256 ? S 11:24 0:00 /usr/sbin/apache2 -k start
www-data 939 0.0 0.6 225052 12256 ? S 11:24 0:00 /usr/sbin/apache2 -k start
www-data 940 0.0 0.6 225052 12256 ? S 11:24 0:00 /usr/sbin/apache2 -k start
www-data 952 0.0 0.6 225052 12256 ? S 11:24 0:00 /usr/sbin/apache2 -k start
systemd+ 812 0.0 0.6 24092 12252 ? Ss 11:24 0:00 /lib/systemd/systemd-resolved
root 737 0.0 0.5 47524 10424 ? Ss 11:24 0:00 /usr/bin/VGAuthService
samxiao 1199 0.0 0.4 18604 9908 ? Ss 11:26 0:00 /lib/systemd/systemd --user
samxiao 1380 1.2 0.4 13428 9812 ? Ss 11:26 1:40 tmux -u -2 -f /usr/share/byobu/profiles/tmuxrc new-session -n - /us
r/bin/byobu-shell
root 824 0.0 0.4 239276 8944 ? Ssl 11:24 0:00 /usr/lib/accountsservice/accounts-daemon
root 933 0.0 0.4 236420 8896 ? Ssl 11:24 0:00 /usr/lib/policykit-1/polkitd --no-debug
root 1173 0.0 0.4 13952 8852 ? Ss 11:26 0:00 sshd: samxiao [priv]
systemd+ 810 0.0 0.3 26792 7956 ? Ss 11:24 0:00 /lib/systemd/systemd-networkd
samxiao 6109 0.0 0.3 14124 7892 pts/1 Ss+ 11:31 0:03 /bin/zsh
samxiao 92712 0.0 0.3 14252 7824 pts/4 Ss 12:49 0:02 /bin/zsh
samxiao 2253 0.0 0.3 14316 7784 pts/2 S+ 11:27 0:05 zsh -v
samxiao 6200 0.0 0.3 14028 7700 pts/3 Ss+ 11:31 0:00 /bin/zsh
root 874 0.0 0.3 16848 7672 ? Ss 11:24 0:00 /lib/systemd/systemd-logind
samxiao 1383 0.0 0.3 14060 7564 pts/2 Ss 11:26 0:00 /bin/zsh
samxiao 1315 0.0 0.3 14052 7472 pts/0 Ss 11:26 0:00 -zsh
root 738 0.1 0.3 162532 7056 ? Ssl 11:24 0:10 /usr/bin/vmtoolsd
root 887 0.0 0.3 12176 6852 ? Ss 11:24 0:00 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
systemd+ 723 0.0 0.3 90424 6388 ? Ssl 11:24 0:00 /lib/systemd/systemd-timesyncd
samxiao 1314 0.0 0.2 13952 5688 ? S 11:26 0:03 sshd: samxiao@pts/0
root 510 0.0 0.2 21508 5616 ? Ss 11:24 0:00 /lib/systemd/systemd-udevd
syslog 856 0.0 0.2 224348 4568 ? Ssl 11:24 0:00 /usr/sbin/rsyslogd -n -iNONE
message+ 839 0.0 0.2 7484 4320 ? Ss 11:24 0:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfi
le --systemd-activation --syslog-only
samxiao 144804 0.0 0.1 9224 3720 pts/4 R+ 13:41 0:00 ps aux --sort -rss
samxiao 1345 0.0 0.1 7132 3580 pts/0 S+ 11:26 0:00 tmux -u -2 -f /usr/share/byobu/profiles/tmuxrc new-session -n - /us
r/bin/byobu-shell
samxiao 1201 0.0 0.1 103524 3536 ? S 11:26 0:00 (sd-pam)
root 837 0.0 0.1 6812 3008 ? Ss 11:24 0:00 /usr/sbin/cron -f
daemon 879 0.0 0.1 3792 2272 ? Ss 11:24 0:00 /usr/sbin/atd -f
root 916 0.0 0.0 5828 1756 tty1 Ss+ 11:24 0:00 /sbin/agetty -o -p -- \u --noclear tty1 linux
samxiao 144805 0.0 0.0 5688 868 pts/4 S+ 13:41 0:00 more
root 2 0.0 0.0 0 0 ? S 11:24 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? I< 11:24 0:00 [rcu_gp]
root 4 0.0 0.0 0 0 ? I< 11:24 0:00 [rcu_par_gp]
root 6 0.0 0.0 0 0 ? I< 11:24 0:00 [kworker/0:0H-kblockd]
root 9 0.0 0.0 0 0 ? I< 11:24 0:00 [mm_percpu_wq]
root 10 0.0 0.0 0 0 ? S 11:24 0:01 [ksoftirqd/0]
root 11 0.0 0.0 0 0 ? I 11:24 0:03 [rcu_sched]
root 12 0.0 0.0 0 0 ? S 11:24 0:00 [migration/0]
root 13 0.0 0.0 0 0 ? S 11:24 0:00 [idle_inject/0]
root 14 0.0 0.0 0 0 ? S 11:24 0:00 [cpuhp/0]
root 15 0.0 0.0 0 0 ? S 11:24 0:00 [kdevtmpfs]
root 16 0.0 0.0 0 0 ? I< 11:24 0:00 [netns]
root 17 0.0 0.0 0 0 ? S 11:24 0:00 [rcu_tasks_kthre]
root 18 0.0 0.0 0 0 ? S 11:24 0:00 [kauditd]
root 19 0.0 0.0 0 0 ? S 11:24 0:00 [khungtaskd]
root 20 0.0 0.0 0 0 ? S 11:24 0:00 [oom_reaper]
root 21 0.0 0.0 0 0 ? I< 11:24 0:00 [writeback]
root 22 0.0 0.0 0 0 ? S 11:24 0:00 [kcompactd0]
root 23 0.0 0.0 0 0 ? SN 11:24 0:00 [ksmd]
root 24 0.0 0.0 0 0 ? SN 11:24 0:00 [khugepaged]
以上是 Redmine4.1.1使用Thin作为Web服务器(Ubuntu20.04.2) 的全部内容, 来源链接: utcz.com/z/509852.html