Mariadb Tomcat Docker環境

這是一個docker-compose,整合Mariadb、phpMyAdmin、tomcat的Docker環境

如何執行

  • 安裝docker-ce及docker-compose
  • 進入專案目錄編譯及啟動docker
    sudo docker-compose up -d –build
  • 利用phpMyAdmin回復資料庫(選擇)
  • 建置及編譯成war檔放置tomcat-webapps目錄
  • 瀏覽http://yourip:8080/warFileName

docker的相關資訊

  • mariadb:latest
  • phpmyadmin/phpmyadmin:latest
  • tomcat:8.5.49-jkd8-openjdk

預設資訊

  • tomcat manager 帳號及密碼 admin / mypassword112233
  • mariadb root 預設密碼 myadmin123
  • phpMyAdmin 預設連接埠 8088
  • tomcat 預設連接埠 8080 ;AJP 連接埠 8009
  • tomcat工作目錄是專案 tomcat-webapps
Read More

Jenkins使用docker agent with maven 編譯環境

github : https://github.com/catyku/JenkinsAgentMaven

docker hub :

docker pull catyku/jenkins-slave-maven3.5

Dockerfile 包含

  • openjdk 1.8
  • maven 3.5
  • jenkins/jnlp-slave

Dockfile

FROM jenkins/jnlp-slave:latest
USER root
ARG USER_HOME_DIR="/jenkins"

RUN apt-get update  -y
RUN apt-get install -y --no-install-recommends tzdata 
ENV TZ Asia/Taipei
#RUN apt-get upgrade  -y
#RUN apt-get install -y software-properties-common
#RUN add-apt-repository ppa:openjdk-r/ppa -y

RUN apt-get install -y maven

USER jenkins 

ENV MAVEN_HOME /usr/share/maven
ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"

COPY settings-docker.xml /usr/share/maven/ref/

USER jenkins 

ENTRYPOINT ["jenkins-slave"]
Read More

GitHub Maven專案自動編譯成war檔

https://github.com/catyku/AutoMavenBuild

Github的maven專案(私有)可以直接下載然後編譯成war deploy檔

需要安裝docker-ce

  • 取得及設定github ssh key可以參考以下這篇

https://help.github.com/en/enterprise/2.17/user/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

  • 修改及設定使用者名稱及專案名稱 -> run.sh (記得mvn -P 的build config也要改成相對應的)
  • 產生docker image tag名稱為maven:project ,可自行修改
  sudo docker build -t maven:project .
  • github下載及編譯打包專案
Read More

自行complie mod_jk

apache mod_jk本身並沒有提供binary版本,所以需要自行make及install,最近版本是JK 1.2.46

首先先下載source,選擇linux可用的版本tar.gz

cd /tmp
wget http://ftp.tc.edu.tw/pub/Apache/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.46-src.tar.gz
tar -zxvf tomcat-connectors-1.2.46-src.tar.gz

安裝編譯必需lib

sudo yum -y install gcc automake autoconf libtool make
sudo yum -y install httpd-devel

編譯及安裝

cd /tmp/tomcat-connectors-1.2.46-src/native
./configure --with-apxs=/usr/bin/apxs
sudo make
sudo make install

可以在/etc/httpd/modules看到剛才編譯好的mod_jk.so

利用raspberrypi安裝EINVTurnkey會遇到的問題排除

在Raspberry pi 安裝Linux版的 EINVTurnkey電子發票整合服務平台時會遇幾個問題

*不支援64bit SWT library

Exception in thread "main" java.lang.UnsatisfiedLinkError: Cannot load 64-bit SWT libraries on 32-bit JVM
	at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
	at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
	at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
	at org.eclipse.swt.internal.Converter.wcsToMbcs(Unknown Source)
	at org.eclipse.swt.internal.Converter.wcsToMbcs(Unknown Source)
	at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
	at com.tradevan.gateway.client.view.EnvironmentSetting.main(EnvironmentSetting.java:125)

這部份基本上沒解決,所以改跑 32元位版本來解決這個問題

*在32bit時找不到SWT library位置

Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: 
	no swt-gtk-3738 in java.library.path
	no swt-gtk in java.library.path
	/home/pi/.swt/lib/linux/arm/libswt-gtk-3738.so: /home/pi/.swt/lib/linux/arm/libswt-gtk-3738.so: 無法開啟共用目的檔: 沒有此一檔案或目錄 (Possible cause: can't load IA 32-bit .so on a ARM-bit platform)
	Can't load library: /home/pi/.swt/lib/linux/arm/libswt-gtk.so

	at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
	at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
	at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
	at org.eclipse.swt.internal.Converter.wcsToMbcs(Unknown Source)
	at org.eclipse.swt.internal.Converter.wcsToMbcs(Unknown Source)
	at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
	at com.tradevan.gateway.client.view.EnvironmentSetting.main(EnvironmentSetting.java:125)
Read More