ads

วันศุกร์ที่ 10 กรกฎาคม พ.ศ. 2558

MailCatcher สำหรับทดสอบ internal SMTP

MailCatcher สำหรับทดสอบ SMTP internal 

ต้องลง lib สำหรับใช้คำสั่ง gem ให้ได้เสียก่อน
#yum install rubygems
#yum groupinstall -y development
# gem install mailcatcher
** จะฟ้อง error ต้องการ i18n ให้ทำตาม link นี้
https://cleanclouds.wordpress.com/2014/12/20/error-error-installing-rails-i18n-requires-ruby-version-1-9-3/
# yum groupinstall -y development
# curl -L get.rvm.io | bash -s stable
จะฟ้อง
GPG signature verification failed for '/usr/local/rvm/archives/rvm-1.26.5.tgz' - 'https://github.com/wayneeseguin/rvm/releases/download/1.26.5/1.26.5.tar.gz.asc'!
try downloading the signatures:
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
or if it fails:
command curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
สั่ง
# curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
# curl -L get.rvm.io | bash -s stable
# source /etc/profile.d/rvm.sh
รอจนเสร็จตามด้วย เพื่อลง ruby
# rvm install 1.9.3
เมื่อเสร็จจะมีข้อความบอก ทดสอบดูเวอร์ชั่น ruby ว่าถูกต้องไหม
# ruby --version
ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]
ระบบ mailcatcher จะทำงานเป็น deamon ตาม lib ของ ruby

เมื่อพร้อมกลับมา install mailcatcher ได้แล้ว
# gem install mailcatcher
แล้วก็รอไป (นานมากกก)
หากเราจะทำการทดสอบด้วยการส่งเมล์ผ่านะโค๊ด PHP ให้เราเข้าไปแก้ configure ของ php.ini ในส่วนของ mail option เสียก่อน ดังนี้
# vi /etc/php.ini

smtp_port = 1025
sendmail_from = me@example.com
sendmail_path = /usr/local/rvm/gems/ruby-1.9.3-p551/bin/catchmail --smtp-ip 0.0.0.0 --smtp-port 1025 -f me@example.com

แล้วทำากร restart httpd หนึ่งรอบ
# /etc/init.d/httpd restart
เมื่อเรียบร้อยแล้วทำการ start การทำงาน ของ MailCatcher
# mailcatcher --http-ip 0.0.0.0 --smtp-port 1025
จะมีข้อความบอกว่า mailcatcher สตาร์ทและทำงานแล้ว
webbrowser ของ server ip นั้นและตามด้วยพอร์? 1080
ส่วน smtp ตั้งเป็น port 1025
เมือเข้าไป http://ipaddress:1080/ จะพบ browser แสดงเมล์ที่ส่งผ่าน smtp ที่เราทดสอบ
ต่อไปสร้างโค๊ด php ทดสอบในการส่งว่าจะเข้าหรือไม่ดังนี้
# vi mail.php
<?php $headers = 'From: webmaster@example.com'; mail('nobody@example.com', 'Test email using PHP', 'This is a test email message', $headers, '-fwebmaster@example.com'); ?>

แล้วทำการสั่งเพื่อทดสอบดู
# php mail.php
และกด refresh ดูหน้า http://ipaddress:1080/ จะเห็นว่า MailCatcher เก็บเมล์นั้นได้แล้ว


วันศุกร์ที่ 3 กรกฎาคม พ.ศ. 2558

ติดตั้ง jira & confluence ให้รองรับ SSL ผ่าน port 433 ทั้งคู่

ติดตั้ง jira & confluence ให้รองรับ SSL ผ่าน  port 433 ทั้งคู่

- ติดตั้ง mod_ssl ให้ apache รองรับการทำงานของ ssl
#  yum install mod_ssl

สร้าง dir เพื่อเก็บ key ที่เราได้มาใช้งาน
# mkdir -p /etc/httpd/ssl/
นำ key และ cert มาเก็บไว้ทีนี่
-rw-r--r-- 1 root root 1674 Jun 23 13:55 DigiCertCA.crt
-rw-r--r-- 1 root root 1900 Jun 23 13:55 star_YourDomain_co_th.crt
-rw-r--r-- 1 root root 1704 Jun 23 13:55 star_YourDomain_co_th.key

stop service ทุกอย่างก่อน
# /etc/init.d/jira stop
# /etc/init.d/confluence stop
# /etc/init.d/httpd stop

แก้ไฟล์คอนฟิกของ jira  ที่ /usr/atlassian/jira/conf/server.xml   ดังนี้

<?xml version="1.0" encoding="utf-8"?>
<Server port="8005" shutdown="SHUTDOWN">
    <!--APR library loader. Documentation at /docs/apr.html -->
    <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on"/>
    <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
    <Listener className="org.apache.catalina.core.JasperListener"/>
    <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
    <Service name="Catalina">
        <Connector port="8080"
                   maxThreads="150"
                   minSpareThreads="25"
                   connectionTimeout="20000"
                   enableLookups="false"
                   maxHttpHeaderSize="8192"
                   protocol="HTTP/1.1"
                   useBodyEncodingForURI="true"
                   redirectPort="8443"
                   acceptCount="100"
                        scheme="https"
                        proxyName="jira.YourDomain.co.th"
                        proxyPort="443"

                   disableUploadTimeout="true"/>
        <Engine name="Catalina" defaultHost="localhost">
            <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
                <Context path="" docBase="${catalina.home}/atlassian-jira" reloadable="false" useHttpOnly="true">


แก้ไขไฟล์คอนฟิก ของ confluence  ที่  /usr/atlassian/confluence/conf/server.xml  ดังนี้

<Server port="8000" shutdown="SHUTDOWN" debug="0">    <Service name="Tomcat-Standalone">        <Connector port="8090" connectionTimeout="20000" redirectPort="8443"                maxThreads="200" minSpareThreads="10"                enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8" proxyName="wiki.YourDomain.co.th" proxyPort="443" scheme="https" />
            <Engine name="Standalone" defaultHost="localhost" debug="0">            <Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="false">                <Context path="" docBase="../confluence" debug="0" reloadable="false" useHttpOnly="true">                    <!-- Logger is deprecated in Tomcat 5.5. Logging configuration for Confluence is specified in confluence/WEB-INF/classes/log4j.properties -->                    <Manager pathname="" />                </Context>            </Host>
        </Engine>
    </Service></Server>


แก้ไขไฟล์ httpd.conf  ที่   /etc/httpd/conf/httpd.conf   ดังนี้

Listen 80 443
NameVirtualHost *:443
NameVirtualHost *:80
<VirtualHost *:80>
        ServerAdmin itinfrasystem@YourDomain.co.th
        ServerName jira.YourDomain.co.th
        RewriteEngine On
        RewriteRule ^/(.*)      https://%{HTTP_HOST}/$1 [R]
</VirtualHost>
<VirtualHost *:443>
        ServerAdmin itinfrasystem@YourDomain.co.th
        ServerName jira.YourDomain.co.th
        SSLEngine On
        SSLCertificateKeyFile /etc/httpd/ssl/star_YourDomain_co_th.key
        SSLCertificateFile /etc/httpd/ssl/star_YourDomain_co_th.crt
 ####### JIRA is running on port 8080/443 local on localhost
        ProxyRequests Off
        ProxyPreserveHost On
        SSLProxyEngine on
        ProxyPass / http://localhost:8080/ connectiontimeout=5 timeout=300
        ProxyPassReverse / http://localhost:8080/
</VirtualHost>
<VirtualHost *:80>
        ServerAdmin itinfrasystem@YourDomain.co.th
        ServerName wiki.YourDomain.co.th
        RewriteEngine On
        RewriteRule ^/(.*)      https://%{HTTP_HOST}/$1 [R]
</VirtualHost>
<VirtualHost *:443>
        ServerAdmin itinfrasystem@YourDomain.co.th
        ServerName wiki.YourDomain.co.th
        SSLEngine On
        SSLCertificateKeyFile /etc/httpd/ssl/star_YourDomain_co_th.key
        SSLCertificateFile /etc/httpd/ssl/star_YourDomain_co_th.crt
 ####### WIKI is running on port 8090/443 local on localhost
        ProxyRequests Off
        ProxyPreserveHost On
        SSLProxyEngine on
        ProxyPass / http://localhost:8090/ connectiontimeout=5 timeout=300
        ProxyPassReverse / http://localhost:8090/
</VirtualHost>

ทดสอบค่า configure ดู
# /etc/init.d/httpd configtest

ทำการ start service ทังหมดแล้วทดสอบใช้งานดู
# /etc/init.d/jira start
# /etc/init.d/confluence start
#  /etc/init.d/httpd start

เมือ service สตาร์ทผ่านหมด  รันผ่าน ssl port 443 ได้ครบ   เข้าไปเปลี่ยน system url ด้วย
jira = login > ฟันเฟือง system > Edit settings
ที่ Server Base URL http://jira.YourDomain.co.th  เป็น https://jira.YourDomain.co.th

confluence = login > ฟันเฟือง Gerneral configure > Edit
ที่ Server Base URL http://wiki.YourDomain.co.th   ไปเป็น  https://wiki.YourDomain.co.th


วันอังคารที่ 16 มิถุนายน พ.ศ. 2558

Adobe Stock

Adobe Stock

16/06/2015

The industry's first stock content service to be integrated directly into Photoshop CC, Illustrator CC, InDesign CC and other Adobe desktop apps creative professionals use every day. As a Fotolia contributor, your content is now being sold on Adobe Stock - something we hope you will be as excited about as we are.

The integration of Adobe Stock with Creative Cloud allows Creative Cloud customers – all 4 million of them - to launch Adobe Stock directly within CC desktop software, making your images far more accessible and easy to purchase than ever before. 

Additionally, we have good news about Adobe Stock payouts as well as changes to Fotolia payouts:

Adobe Stock payouts will be 33% on all products. We are maintaining guaranteed payout floors to protect your commissions on large subscriptions.
Fotolia subscription payouts have been raised, from 20-25% to 33% for all contributors!

วันนี้ Adobe ได้ปล่อยอัพเดท Adobe CC, Illustrator CC หลากหลายฟีเจอร์ให้อัพเดทกันทั่วไป
พร้อมกันนี้ทาง Adobe ได้เปิดตัว บริการใหม่นั่นคือ AdobeStock  เวปซื้อ ขายภาพที่ก่อนหน้านี้ Adobe ได้เข้าไปซื้อหุ้นส่วนบริการด้านนี้อยู่แล้วกับเวป fotolia.com  เพื่อให้ครอบคลุมตลาดมากขึ้น Adobe จึงเปิดบริการส่วนนี้เพิ่มขึ้นมา

โดย contribute ที่ส่งภาพขายที่ fotolia.com อยู่แล้วภาพก็จะโผล่ขายที่เวป AdobeStock.com ด้วยเช่นกัน   โดย % ค่าคอมมิสชั่น จะสูงถึง 33% ในการขายแต่ละภาพ   ส่วนดาวโหลดแบบ subscription ก็จะอยู่ในช่วง 20%-33% ( จริงๆ มันก็เรทอะนะ)
เพียงแต่เราได้ช่องทางการขายที่กว้างขึ้น   โอกาสดาวโหลดได้มากขึ้นเช่นกัน


วันศุกร์ที่ 29 พฤษภาคม พ.ศ. 2558

Jira Error - NullPointerException หลังจากลบ issue type ต่างๆ

Jira Error - NullPointerException หลังจากลบ issue type ต่างๆ

ส่งผลให้ create อะไรไม่ได้เลย  

วิธีแก้ 
เข้า mysql เพื่อหา id ที่มีปัญหา
> select cf.optionid from optionconfiguration cf where cf.optionid not in (select it.id from issuetype it);
จะได้ค่า id ที่มีปัญหาว่ามีกี่ตัว
 stop service jira
> delete from optionconfiguration where optionid not in (select it.id from issuetype it);
เพื่อลบ id ที่มีปัญหาเหล่านั้น
start service JIRA


Confluence : Error 500 - Java.lang.NullPointerException

ข้อมูลสรุปนี้ไม่พร้อมใช้งาน โปรด คลิกที่นี่เพื่อดูโพสต์

install cphalcon

install cphalcon

install library ที่ต้องใช้เสียก่อน
# yum install php-devel pcre-devel gcc make
# git clone --depth=1 git://github.com/phalcon/cphalcon.git
# cd cphalcon/build
# sudo ./install

*** โดยปกติสคริป phalcon จะ build เลือก architechter ให้โดยออโต้ แต่ถ้าเกิดมีปัญหาตัด เราสามารถเลือกแบบ manual ได้ดังนี้
# cd cphalcon/build/64bits
# export CFLAGS="-O2 --fvisibility=hidden"
# ./configure --enable-phalcon
# make 
# sudo make install

ในบางกรณี ถ้าเครืองนั้นมีการ upgrade / downgrade php หลายครั้งอาจจะเจอปัญหาระหว่างการคอมไพล์ เป็น error ประมาณ.....
....
...
‘zend_std_get_static_property’ discards qualifiers from pointer target type
/usr/include/php/Zend/zend_object_handlers.h:147: note: expected ‘char *’ but argument is of type ‘const char *’
/root/cphalcon/build/64bits/phalcon.zep.c: At top level:
/root/cphalcon/build/64bits/phalcon.zep.c:126687: error: ‘ZEND_FE_END’ undeclared here (not in a function) "
ตรวจสอบ php-config ว่า php ที่ลงกับตัวคอมไพล์ phpize และ php-config ต้อง version เดียวกันเท่านั้น
หรือใช้วิธีหลอกด้วยการ lymbolic link แทน
( ตัวอย่างหลอกว่าเป็น version 5.3.3 )
# ln -s /usr/bin/php-config /usr/bin/php-config533

แล้วคอมไพล์ใหม่อีกครั้ง แล้วตรวจสอบ phalcon.so ว่ามีแล้วหรือยังในพาร์ท ( ปกติสคริปจะก๊อปให้เอง) ที่ /usr/lib64/php/modules/
และที่ /etc/php.d/ จะมีไฟล์ phalcon.ini ที่ระบุเปิด extension ของ phalcon.so ให้อยู่แล้ว
restart service อีกที

# /etc/init.d/nginx 
# /etc/init.d/php-fpm
ตรวจสอบ module อีกที 
# php -m
*** จากเปิด issue ไปทางทีมพัฒนา phalcon แนะนำสำหรับ phalcon version 2.1 ควรใช้ php 5.3.21 อย่างต่ำ

- refer: 
https://github.com/phalcon/cphalcon/issues/10101
https://github.com/phalcon/cphalcon/issues/10387
http://docs.phalconphp.com/en/latest/reference/install.html 

Password less command line scripts ใน MySQL client v.5.6 ขึ้นไป

Password less command line scripts ใน MySQL client 5.6 ขึ้นไป 


เจอปัญหาเมื่อก่อนใช้จะฝัง  คำสั่ง command และพาสเวิร์ดในคำสั่ง script mysql ต่างๆ เลยแต่พออัพมาใช้ version 5.6 แล้วมันฟ้องว่าไม่ได้  ฟ้องว่าต้องการ password ซะงั้น
เนื่องจาก client version 5.6 มีการอัพเดทเรือง security ดังกล่าว  เราจึงต้องเปลี่ยนแปลงดังนี้
ใช้คำสั่ง  mysql_config_editor ใส่ค่าตามที่เราจะ set user นั้นๆ ไป

# mysql_config_editor set --login-path=client --host=localhost --user=root --password
ใส่ password

--login-path=ชื่อเรียกในการ login ตั้งชื่ออื่นก็ได้
--host= จะให้เซ็ตการ login นี้กับเครืองไหนก็ใส่ไป

ทดสอบ print ค่าที่เซ็ตไว้ออกมาดู  มันจะตั้งชื่อตาม --login-path=xxxxx เรานั่นเอง  ตั้งซ้ำก็ได้มันจะเด้งถามให้ทับไหม
# mysql_config_editor print --all

[client]
user = root
password = *****
host = localhost


# mysql --login-path=client  
เข้าเลย

หรือนำไปประยุกต์กับ backup ก็ได้ ตามนี้
# mysqldump --login-path=client --max_allowed_packet=512M Database_Name > /backup/Database_Name_`date "+%Y-%m-%d"`


* refer: http://dev.mysql.com/doc/refman/5.6/en/mysql-config-editor.html
* http://akrabat.com/password-less-command-line-scripts-with-mysql-5-6/