[技術分享] OpenProject 7.x 用 CentOS 的 YUM 進行安裝

No Comments

UPDATE: 透過 YUM 升級, 目前OpenProject已到8.3.1

REF: https://www.openproject.org/download-and-installation/

先安裝 openproject
install openproject by yum

設定MaridDB/mysql
openproject 的 user擁有存取權

設定 Openproject (第一次)
# openproject reconfigure

要預備好 apache2/mysql2/MaridDB/Git 等環境資訊

[FAQ]

Q1. 如果伺服器在後端內網

A: 可在前端 apache 的 httpd.conf 或 ssl.conf 增加以下 vhost 設定

ProxyPreserveHost On     # (這個若沒設定, 有些連線會出現內網IP)
ProxyPass / http://192.168.7.76:81/
ProxyPassReverse / http://192.168.7.76:81/

Q2.如果不小心DB一開始沒設成utf8 / utf8_general_ci;
A: 經常會出現 internal error, 起因就是因為字元集的問題

需要進DB去做設定
USE ‘openproject’;
ALTER TABLE ‘資料表名稱’ CONVERT TO CHARACTER SET ‘utf8’ COLLATE ‘utf8_general_ci’;

Q3如果有使用 gravatar 大頭像服務, 而出現連線不安全(SSL議題),

A: 可以到系統管理的系統設置, 找到 protocol改成HTTPS即可

Q4 如果登入時出現 422錯誤

A: 通訊協定採用SSL的情況下, 透過 apache 的 reverse proxy, 需要另加一個設定在 vhost 的段落裡

RequestHeader set X-Forwarded-Proto “https”

[VMware][ESXi][crontab] 移除特定日期以前的目錄或映像檔資料

No Comments

#!/usr/bin/expect
spawn ssh "root@ip-or-hostname"
expect "*assword: "
send -- "your-password\n"
expect "\[root@ip-or-hostname:~\] "
#send -- "hostname\n"
#send -- "/bin/sh /vmfs/volumes/datastore1/ghettoVCB/bin/ghettoVCB.sh -g /vmfs/volumes/datastore1/ghettoVCB/backup.conf -m vmguest-name\n"

send -- "echo \"Processing vmguest-name archives\"\n"
send -- "cd /vmfs/volumes/vm-bak/vmguest-name\n"
send -- "ls -t | grep -v `date -D %s +\"%Y-%m-%d\" -d \$((\$( date +%s) - 0 ))`  | grep -v `date -D %s +\"%Y-%m-%d\" -d \$((\$( date +%s) -86400 ))` | grep -v `date -D %s +\"%Y-%m-%d\" -d \$((\$( date +%s) - 172800 ))` > list2del.txt\n"
send -- "cat list2del.txt\n"
send -- "rm -rf `cat list2del.txt`\n"
send -- "rm -f list2del.txt\n"

expect eof

[logstash] 利用JDBC存取 mysql

No Comments

REF: https://www.zghhome.cn/?p=350

Access data from mySQL and output to ES
test1
test2
test3
test4
test5
test6
test7

############# input ##############
input {
    jdbc {
        jdbc_driver_library => "/usr/share/java/mysql-connector-java.jar"
        jdbc_driver_class => "com.mysql.jdbc.Driver"
        jdbc_connection_string => "jdbc:mysql://192.168.7.79:3306/note"
        jdbc_user => "dbuser"
        jdbc_password => "password"
        #parameters => {""}
        schedule => "* * * * *"
        statement => "select ID,post_date,post_title,ping_status from note_posts where id > :sql_last_value order by id"
        #statement => "select ID,post_date,post_title,ping_status from note_posts"
        # setting for last run
        clean_run => false
        record_last_run => true
        use_column_value => true
        tracking_column => id
        last_run_metadata_path => "/usr/share/logstash/logstash_mydb-note_last_run"
        type => "mydb-note"
    }
}

###################################
############# filter ##############
###################################

############# output ##############
output {
#    stdout { codec => "rubydebug" }
if [type] == "mydb-note" {
      if !("_grokparsefailure" in [tags]) {
        elasticsearch {
        hosts => [ "127.0.0.1:9200" ]
        index => [ "logstash-mydb-note" ]
        }
      } else {
        elasticsearch {
        hosts => [ "127.0.0.1:9200" ]
        index => [ "logstash-failure-mydb-note" ]
        } # ELK
      } # else
    } # if
}