--- tags: mPOS --- # 交接-黃至璿 (mPOS) [TOC] ## Setup and Deployment ### Previous Setup and installation documents - [RPi API server 快速安裝 [mpos_api_server_quick_install.md]](http://172.16.9.53/IT_MPOS/mPOS/src/branch/master/BackEnd/scops/notes/mpos_api_server_quick_install.md) - [RPi API server 詳細安裝 [mpos_server_install_from_scratch.md]](http://172.16.9.53/IT_MPOS/mPOS/src/branch/master/BackEnd/scops/notes/mpos_server_install_from_scratch.md) - [從無到有安裝Tomee [tomee_setup.md]](http://172.16.9.53/IT_MPOS/mPOS/src/branch/master/BackEnd/scops/notes/tomee_setup.md) - [mPOS 收據/發票列印服務 [mpos_printing_service.md]](http://172.16.9.53/IT_MPOS/mPOS/src/branch/master/BackEnd/scops/notes/mpos_printing_service.md) ### `/opt/tk3c/bin/store_env` - 參 [mpos_oss/README](http://172.16.9.53/IT_MPOS/mPOS/src/branch/master/BackEnd/scops/mpos_oss#store_env) - 主要環境變數 ```bash export tk3c_store_no=705 #export tk3c_scope_id=lab export tk3c_home=/opt/tk3c export TK3C_HOME=/opt/tk3c # modify following for TomEE's environment export TK3CLIB="/opt/tomcat/tk3c-lib" export sc_storeno="$tk3c_store_no" export sc_mqtt_broker="tcp://localhost:1883" export tk_api_header_key="X-Powered-TK" export tk_api_header_value="DeMGJVGtPKu/o7tlHXllpw+ekkdOOUxdTjJ0o/dyXWE=" export tk_api_url="http://10.254.249.12:18718" export wish_api_url="http://10.254.248.21:8765" export pr_api_url="http://172:16.9.188" export pr_api_clientid="mpos_tk" export pr_api_pwd="Tmjd5KXeyX8IWuiT" ``` ### Tomcat / Tomee > 詳細從無到有安裝 參: [tomee_setup.md](http://172.16.9.53/IT_MPOS/mPOS/src/branch/master/BackEnd/scops/notes/tomee_setup.md) - Java version - Java 11 (LTS) - https://adoptopenjdk.net/ - Tomee version - tomee-8.0.1-plus - https://archive.apache.org/dist/tomee/tomee-8.0.1/apache-tomee-8.0.1-plus.tar.gz - Database connection setting - `<tomcat home>/conf/context.xml` ```xml <Context> <!-- Default set of monitored resources. If one of these changes, the --> <!-- web application will be reloaded. --> <WatchedResource>WEB-INF/web.xml</WatchedResource> <WatchedResource>WEB-INF/tomcat-web.xml</WatchedResource> <WatchedResource>${catalina.base}/conf/web.xml</WatchedResource> <!-- Uncomment this to disable session persistence across Tomcat restarts --> <!-- <Manager pathname="" /> --> <Resource name="jdbc/SCDB" type="javax.sql.DataSource" url="jdbc:oracle:thin:@scdb.mpos.local:1521:XE" driverClassName="oracle.jdbc.OracleDriver" username="admuser" password="g02he11hack2" auth="Container" testWhileIdle="true" validationQuery="select 1 from dual" testOnBorrow="true" validationQueryTimeout="30" timeBetweenEvictionRunsMillis="60000" minEvictableIdleTimeMillis="1800000" /> </Context> ``` :::warning `scdb.mpos.local` path sets in `/etc/hosts` ::: - `/opt/tomcat/<version>/bin/setenv.sh` - source `store_env` 裡的變數, 設定CLASSPATH 指向 external library ```bash . /opt/tk3c/bin/store_env CLASSPATH=$TK3CLIB/ojdbc6-11.2.0.4.jar:$TK3CLIB/org.eclipse.paho.client.mqttv3-1.2.4.jar echo "store=$sc_storeno" echo "broker=$sc_mqtt_broker" echo "tk_api=$tk_api_url $tk_api_header_key:$tk_api_header_value" echo "wish_api=$wish_api_url" echo "pr_api=$pr_api_url" ``` - `/opt/tomcat/tomcat.service` - Edit ```ini [Unit] Description=TomEE Plus After=network.target systemd-timesyncd.service [Service] Type=forking User=tomcat Group=tomcat Environment="JAVA_HOME=/usr/lib/jvm/java-11-openjdk-armhf" Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom -Djava.awt.headless=true -Duser.language=en" Environment="CATALINA_BASE=/opt/tomcat/latest" Environment="CATALINA_HOME=/opt/tomcat/latest" Environment="CATALINA_PID=/opt/tomcat/latest/temp/tomcat.pid" Environment="CATALINA_OPTS=-Xms512M -Xmx2048M -server -XX:+UseParallelGC" Environment="UMASK=0022" ExecStart=/opt/tomcat/latest/bin/startup.sh ExecStop=/opt/tomcat/latest/bin/shutdown.sh [Install] WantedBy=multi-user.target ``` > 若 `sudo systemctl status tomcat.service` 不存在, 則需把 tomcat.service 加入 systemd: > `sudo ln -s /opt/tomcat/tomcat.service /etc/systemd/system/tomcat.service` <hr/> ### Nginx - 安裝 - `sudo apt update -y && sudo apt install nginx` - 設定 - **`/etc/nginx/conf.d/tk3c.conf`** ``` upstream tomcat { server 127.0.0.1:8080 weight=100 max_fails=5 fail_timeout=5; } server { listen 80; listen [::]:80; listen 443 default_server ssl; listen [::]:443 default_server ssl; include snippets/ssl-params.conf; ssl_certificate /opt/tk3c/ssl/mpos_server.crt; ssl_certificate_key /opt/tk3c/ssl/mpos_server.key; server_name _; charset UTF-8; root /var/www/html; index index.html index.nginx-debian.html; location / { try_files $uri $uri/ =404; } location /mPOS/ { proxy_pass http://tomcat/mPOS/; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_hide_header 'X-Frame-Options'; add_header X-Frame-Options ALLOWALL; } location /logs/ { if ($scheme = 'http') { rewrite ^ https://$http_host$request_uri? permanent; } sendfile on; sendfile_max_chunk 1m; alias /opt/tk3c/logs/; autoindex on; autoindex_localtime on; add_header Access-Control-Allow-Origin *; default_type text/plain; } } ``` > 確認 `/etc/nginx/sites-enabled` 為空 <hr/> ### mosquitto - 安裝 - `sudo apt update -y && sudo apt install mosquitto` - 設定 - **/etc/mosquitto/conf.d/tk3c.conf** ```python # tk3c setting port 1883 # extra listener setting for websockets listener 9003 protocol websockets # extra listener setting for secured websockets listener 9443 protocol websockets cafile /opt/tk3c/ssl/mpos_ca keyfile /opt/tk3c/ssl/mpos_server.key certfile /opt/tk3c/ssl/mpos_server.crt require_certificate false # logging log_type all log_dest syslog # bridge settings connection bg705 address 10.254.248.41:1883 topic tk3c/log/+/705 out 0 topic tk3c/mpos/+ in 0 # for development env in A4F #address 10.1.62.97:1883 #topic tk3c/# both 0 ``` - Modify during production - if at any occation, need to modify bridge: after modifying needs to restart related services - `sudo systemctl restart mosquitto` - `sudo systemctl restart pos-keeper pos-print` #### **TROUBLESHOOT** - if after modification of topic subscription, and it didn't take effect, it's because the session is retained at default. Need `cleansession` to take effect on the changes - Ref: http://www.steves-internet-guide.com/mosquitto-bridge-configuration/ - (Weird) Solution 1. add `cleansession true` 2. `sudo systemctl restart mosquitto` 3. remove `cleansession true` 4. `sudo systemctl restart mosquitto` <hr> ### SSL - [參 MPOS安裝文件-更新SSL憑證](https://hackmd.io/@tk3c-mpos/HJkBwYZHd#3-%E6%9B%B4%E6%96%B0SSL%E6%86%91%E8%AD%89) <hr> ### API WAR Staging builds #### gradle: 自行執行 gradle 建置 WAR - `<mPOS repo>/BackEnd/mPOS/build.gradle` - built script :::spoiler show script ```gradle plugins { // Apply the java-library plugin to add support for Java Library //id 'java-library' id 'war' } sourceCompatibility = 11 compileJava.options.encoding = 'UTF-8' def tomeeLibDir = "$System.env.TOMCATLIB" def libDir = "$System.env.TK3CLIB" repositories { mavenCentral() } dependencies { if (project.hasProperty("remoterepo")){ println "Remote lib, mavenCentral" compileOnly 'org.apache.tomee:tomee-plus-webapp:8.0.1' compileOnly 'com.oracle.database.jdbc:ojdbc6:11.2.0.4' compileOnly 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.4' } else { println "local lib" if (project.hasProperty("tomcatlib") && project.hasProperty("tk3clib")) { tomeeLibDir = project.getProperty("tomcatlib") libDir = project.getProperty("tk3clib") } if ( !(tomeeLibDir && libDir) || tomeeLibDir == "null" && libDir == "null") { tomeeLibDir = "/opt/tomcat/latest/lib" libDir = "/opt/tk3c/lib/jars" } compileOnly fileTree(dir: tomeeLibDir,include:['*.jar']) compileOnly files(libDir+'/ojdbc6-11.2.0.4.jar',libDir+'/org.eclipse.paho.client.mqttv3-1.2.4.jar') } } sourceSets { main.java.srcDirs = ["./src"] main.java.exclude ("**/SCSandbox.java","**/JDBCHelper.java") main.resources.srcDirs = [] // test.java.srcDirs = [] // test.resources.srcDirs = [] } task webinf() { copy{ from('./WebContent/WEB-INF/'){ exclude 'lib/org.eclipse.paho.client.mqttv3-1.2.4.jar' } into 'build/webinf' //include '*' //include 'lib/**' } } war { def rel = new Date().format('YYMMdd-HHmm') def gitHashCmd = "git rev-parse --short=7 HEAD".execute([], project.rootDir); gitHashCmd.waitFor() def gitHash = gitHashCmd.text.trim() if (project.hasProperty("githash")){ gitHash = project.getProperty("githash"); } def propertyFile = file "build/webinf/mpos.properties" def props = new Properties() propertyFile.withReader { props.load(it) } def v = props.getProperty("version") println "mPOS version: "+v+" "+rel+"_"+gitHash props.setProperty("version",v+" "+rel+"_"+gitHash) propertyFile.withWriter { props.store(it,null) } archiveFileName = 'mPOS_'+rel+'_'+gitHash+'.war' webInf {from 'build/webinf'} } war.dependsOn webinf ``` ::: - `<mPOS repo>/BackEnd/mPOS/gradlew` - 在Windows執行 ```bash <mPOS repo>/BackEnd/mPOS/gradlew.bat --debug -x test -S --info build -Premoterepo ``` - 在Linux執行 ```bash <mPOS repo>/BackEnd/mPOS/gradlew --debug -x test -S --info build [--Premoterepo] ``` > Note: > remoterepo 參數需外網連線 > 若沒外網需手動指定所需 dependency > - `gradlew --debug -x test -S --info build --Ptomcatlib=<path_to_tomcat_lib> --Ptk3clib=<path_to_tk3c_lib>` > - 或 把 tomcat 放在 `/opt/tomcat/` & jars 在 `/opt/tk3c/lib/jars` > - 建置角本會自動尋找 `/opt/tomcat/latest/libs` 和 `/opt/tk3c/lib/jars` - 建置好 WAR檔在 `build/libs/mPOS_***.war`; ready to deploy #### Automatic build and staging location - From 10.1.62.97 (RPi) > the following can be done on any RPi - requirements - `/opt/tomcat/latest` - tomcat location - `/opt/tk3c/lib/jars` - external jars location (jdbc, mqtt) - `/opt/tk3c/staging/war` - folder for war files - `/opt/tk3c/repos/mPOS` - project repo location - `/opt/tk3c/bin/pos-deployapi.sh` - script for deploy to local tomcat (Optional) - execute build script: `/home/tk3c/build_mpos` :::success `build_mpos` script detail at http://172.16.9.53/IT_MPOS/mPOS_deployment/src/branch/master/README.md ::: - the script in RPi does the following 1. go to `/opt/tk3c/repos/mPOS`, checkout `backend` branch and pull 2. run gradle build (`/opt/tk3c/repos/mPOS/BackEnd/mPOS/gradlew`) - need `/opt/tk3c/lib/jars` and `/opt/tomcat/latest/libs` for compile 3. move built WAR to `/opt/tk3c/staging/war` 4. Optionally deploy WAR file to local tomcat - cron job - execute the above everyday at 22:00 ``` tk3c@rpi4tksc:~ $ crontab -l 0 22 * * * /home/tk3c/build_mpos -a -b backend -d > /opt/tk3c/logs/buildlog.log 2>&1 ``` - Staging WAR files - IDC: [10.254.241.41/builds/backend/api/](https://10.254.248.41/builds/backend/api/) - location: `/opt/tk3c/staging/war` - 97: [10.1.62.97/builds/backend/nightly/](https://10.1.62.97/builds/backend/nightly/) - location: `/opt/tk3c/staging/war` <hr> ### 部屬SOP - choose base rpi to copy - previous deployed rpi - designated base rpi (10.1.62.136) - SD Card clone methods 1. clone to another SD card [**CURRENT**] - [參 MPOS安裝文件-SD Card Clone](https://hackmd.io/@tk3c-mpos/HJkBwYZHd#SD-Card-Clone) 2. backup image remote (linux) > REF: [REMOTE BACKUP YOUR RASPBERRY PI WITH SSH VIA TERMINAL](https://pixelfriedhof.com/en/remote-backup-your-raspberry-pi-with-ssh-via-terminal/) ```bash ssh tk3c@10.1.62.136 "sudo dd if=/dev/mmcblk0 bs=1M | gzip -" | dd of=<path>/rpi_mpos_20211006.gz ``` - flash img to sd card - use [balenaEtcher](https://www.balena.io/etcher/) or `dd` command 3. backup image remote (windows) > REF: [Remote backup of Raspberry Pi sd card from Windows](https://stackoverflow.com/questions/66279359/remote-backup-of-raspberry-pi-sd-card-from-windows#comment117546553_66279359) ```bash ssh tk3c@10.1.62.136 "sudo dd if=/dev/mmcblk0 bs=1M | gzip -" > C:\<path>\rpi_mpos_20211006.gz ``` - flash img to sd card - use [balenaEtcher](https://www.balena.io/etcher/) and/or [Win32 Disk Imager](https://sourceforge.net/projects/win32diskimager/) - preparation (before flash sd card / backup) - [參 MPOS安裝文件-Prerequisite](https://hackmd.io/@tk3c-mpos/HJkBwYZHd#RPI) - configurations (after flash sd card) - [參 MPOS安裝文件-設定檔](https://hackmd.io/@tk3c-mpos/HJkBwYZHd#%E8%A8%AD%E5%AE%9A%E6%AA%94) <hr> - Update Raspberry Pi OS packages - [參 MPOS安裝文件-確認系統更新](https://hackmd.io/@tk3c-mpos/HJkBwYZHd#1-%E7%A2%BA%E8%AA%8D%E7%B3%BB%E7%B5%B1%E6%9B%B4%E6%96%B0-%E8%8B%A5%E7%84%A1%E9%9C%80%E6%9B%B4%E6%96%B0%E8%B7%B3%E8%87%B3-2) - Troubleshoot / Q&A - [參 Store RPi Maintenance](https://hackmd.io/@tk3c-mpos/H1fDbHJF_) - tools - [WinSCP](https://winscp.net/eng/index.php) - ssh - rsync - `mpos_tool.py` ([documentation](http://172.16.9.53/IT_MPOS/mPOS_deployment#mpos_toolpy)) <hr/> ## API ### Quick 97 Deployment after `backend` branch update - SSH to 97`ssh tk3c@10.1.62.97` - Run `./build_mpos -a -b backend -d` :::success **[`build_mpos` script documentation](http://172.16.9.53/IT_MPOS/mPOS_deployment#build_mpos--build_mpos_remoterepo)** - `-a`: auto build without prompt - `-b backend`: use backend branch - `-d`: auto deploy without prompt ::: ### Documents - [Eclipse/Java/Tomcat development environment setup](https://hackmd.io/@tk3c-mpos/SJrWyUoxF) - [Class diagram](https://hackmd.io/@tk3c-mpos/SJx50q3G_) - [API Reference](https://hackmd.io/@tk3c-mpos/SkZf9x2EK) - [Deployement Architecture Diagram](https://hackmd.io/@tk3c-mpos/By2q5VAXd) - [Receipt printing flow](https://hackmd.io/@tk3c-mpos/rk-NU6cV_) - [PR Interaction Flow](https://hackmd.io/@tk3c-mpos/Hyiz7mjfd) - [MM → THD/TDL mapping](https://hackmd.io/@tk3c-mpos/H1x09e3Vt) - [TDL_PAY (Payment Logging)](https://hackmd.io/@tk3c-mpos/SySGFhNQu) - [Data Entity / Model](https://hackmd.io/@tk3c-mpos/ByCIM-hEt) - [Access Token / JWT](https://hackmd.io/@tk3c-mpos/rJCLM2LOv) - Token generation (JWT) - uses `org.jose4j.*` package - [TokenUtil.java source](http://172.16.9.53/IT_MPOS/mPOS/src/branch/master/BackEnd/mPOS/src/tk3c/mpos/packer/TokenUtil.java) ### MQTT - [MQTTHelper.java source](http://172.16.9.53/IT_MPOS/mPOS/src/branch/master/BackEnd/mPOS/src/tk3c/mpos/packer/MQTTHelper.java) - Receipt printer - [PrinterProxy.java source](http://172.16.9.53/IT_MPOS/mPOS/src/branch/master/BackEnd/mPOS/src/tk3c/mpos/packer/PrinterProxy.java) ## Store/API RPi services and scripts (Python, bash scripts) **[repo source and documentation](http://172.16.9.53/IT_MPOS/mPOS/src/branch/master/BackEnd/scops/mpos_oss)** - `adapter.sh` - `TK3CPOSPrint.py` - `poskeeper.py` - `collectactivites.py` - `pos-cleanup.py` - `store_env` ## Dock RPi ### Project Repo - [`mposkit` lib](http://172.16.9.53/IT_MPOS/mPOS/src/branch/master/BackEnd/scops/mpos_dock) ### current Dock RPi - 10.1.62.132 :::info has xrdp installed, can remote using windows remote desktop ::: - location: `/home/tk3c/mposkit` - venv: `/home/tk3c/venv_mposkit` - execution: ```bash # Activate virtual environment source ~/venv_mposkit/bin/activate # Run mposkit with tk3c scope python3 -m mposkit tk3c ``` - 10.1.62.99 (partial, only USB) :::info has xrdp installed, can remote using windows remote desktop ::: ### 如果要拿現有API RPi 加上 Dock 功能: - 參 [POS Dock Library#Requirements before running the program](http://172.16.9.53/IT_MPOS/mPOS/src/branch/master/BackEnd/scops/mpos_dock#requirements-before-running-the-program) - required apt packages - usbmuxd - libusbmuxd-tools - libimobiledevice6 - libimobiledevice-utils - libusbmuxd4 ```bash sudo apt install usbmuxd libusbmuxd-tools libimobiledevice6 libimobiledevice-utils libusbmuxd4 ``` ![](https://i.imgur.com/1sb1moT.png) - venv (virtual env) - packages - evdev - paho-mqtt - pyserial - python-escpos - pyudev - RPi.GPIO (version >= 0.7.1a4) ![](https://i.imgur.com/baPqKBP.png) - `tk3c` user groups ``` tk3c kmem dialout sudo www-data plugdev input lpadmin gpio ``` ![](https://i.imgur.com/CR1wkwh.png) > ref : [How to add user to group](https://www.howtogeek.com/50787/add-a-user-to-a-group-or-second-group-on-linux/) ### IO configurations - receipt printer (USB) - `/etc/udev/rules.d/99-escpos.rules` ``` SUBSYSTEM=="usb", ATTRS{idVendor}=="076c", ATTRS{idProduct}=="0302", MODE="0666", GROUP="dialout" ``` ### `dock_tool`: Testing / Monitoring / Control Panel - http://172.16.9.53/IT_MPOS/posctrlpanel - Hosted: - http://10.1.62.97/sandbox/dock_tool/ - `/opt/tk3c/sandbox/dock_tool` - http://10.1.62.132/sandbox/dock_tool/ - `/opt/tk3c/sandbox/dock_tool` ### todos and considerations - move hardware configuration to config files (`ini`) - similar fashion as `tk3c-posprint.ini` in mPOS server - move to designated location - e.g. `/opt/tk3c/...` - create systemd service - `posdock.service` - `adapter.sh` ?? - venv - add `poskeeper.py` for monitoring ? or include new monitoring service to service directory - if using dock_tool for production monitoring, need open port 9443 ### Reference - ESC/POS commands - https://www.epson-biz.com/modules/ref_escpos/index.php?content_id=72 - https://aures-support.com/DATA/drivers/Imprimantes/Commande%20ESCPOS.pdf ## Maintenance / Enviroment control ### Store mPOS status dashboard #### Project repository - http://172.16.9.53/IT_MPOS/mPOS/src/branch/master/BackEnd/scops/dashboard #### Currently hosted - 97 (https://10.1.62.97/sandbox/dashboard/) - hosted file location: `/opt/tk3c/sandbox/dashboard` - update `storelist.json` - `10.1.62.97:/opt/tk3c/sandbox/dashboard/static/storelist.json` - IDC (https://10.254.248.41/dashboard/) - hosted file location: `/opt/tk3c/dashboard` - update `storelist.json` - `/opt/tk3c/dashboard/static/storelist.json` #### MQTT commands - topic: `tk3c/console/reload`, msg: &lt;none&gt; - force refresh ### `mpos_tool.py` - http://172.16.9.53/IT_MPOS/mPOS_deployment - requirement - linux - python3.7+ - rsync - ssh - files - `mpos_tool.py` - `storelist.json` - `deployment_version.ini` ### POS control panel / dock tool - http://172.16.9.53/IT_MPOS/posctrlpanel ### IDC `/opt/tk3c/staging` - oss - war ## Others ### Occational request: Print sample invoice - Use nccc 發票紙捲 (台新紙會泛黃) - 1個一般銷售發票, 1個有統編發票 - 發票號碼/交易序號不能重複 ### SSH key pair: ssh without prompting enter password - http://172.16.9.53/IT_MPOS/mPOS/src/branch/backend/BackEnd/scops/notes/SSH_Key_Pair.md ### Linux commands - Useful tool: **[explainshell](https://explainshell.com/)** - e.g. `rsync -avzh --progress /home/tk3c/somefile tk3c@10.2.219.248:/home/tk3c` ![](https://i.imgur.com/Nhh788n.png) - `man` - an interface to the on-line reference manuals - `man ssh` - `man rsync` - `man man` - `ssh` - tunnel - `ssh -R 1080 tk3c@10.2.219.248` - reverse dynamic forwarding - socks5 proxy - forward remote's port 1080 to local - `ssh -L 9000:192.168.1.251:80 tk3c@10.2.219.248` - forward local's `localhost:9000` to remote's `192.168.1.251:80` - run remote command - `ssh tk3c@10.2.219.248 'ip addr'` - `rsync` - `systemctl` - `sudo systemctl status nginx` - `tail` - `sudo tail -f /var/log/mosquitto/mosquitto.log` - `tail -f /opt/tk3c/logs/TK3CPOSPrint.log` - `ip addr` - `apt` - `date` - `lsusb` - `cat` - `nano` - `curl` ![](https://i.imgur.com/o5XUaK2.png) - `jq` (external) ![](https://i.imgur.com/aZTFx5s.png) ### **TODOs** - [ ] update store RPi API from version 0.2.21 to 0.2.24+ (at the time of this writing 20211013) - [ ] 18 new foodpanda stores need update lastest oss/bin - `TK3CPOSPrint.py` - changes: donate deliver receipt invono mask fix, - `collectactivities.py` - changes: cleanup old logs on collect, - `poskeeper.py` - changes: fix exception on closing program - wait for all stores to go online, then execute batch rsync ```bash ssh tk3c@10.1.62.97 '~/mpos.tool.py send [--dry-run] --exclude 705,999 /opt/tk3c/staging/oss/bin /opt/tk3c/bin' ``` - [ ] change first 11 stores' RPi and RP-700 ip | store | ip | | - | - | | 113 | 10.2.113.248 | | 126 | 10.2.126.248 | | 214 | 10.2.214.248 | | 219 | 10.2.219.248 | | 221 | 10.2.221.248 | | 228 | 10.2.228.248 | | 245 | 10.2.245.248 | | 285 | 10.102.31.248 | | 355 | 10.102.101.248 | | 562 | 10.112.54.248 | | 598 | 10.10.18.248 | - e.g. 219 1. Powershell: `ssh -L 9000:192.168.1.251:80 tk3c@10.2.219.248` 2. local browser `localhost:9000` ![](https://i.imgur.com/OlMycAV.png) - configure interface - change static IP - 192.168.1.251 → 10.2.219.241 - gateway 10.2.219.254 - click reboot :::warning Need to manually turn back on physically on user end ::: 3. modify `/opt/tk3c/bin/tk3c-posprint.ini` 4. restart pos-print `sudo systemctl restart pos-print.service` - [ ] Update tomcat local_access_log rotation period, currently no rotation - `/opt/tomcat/latest/conf/server.xml` - add `maxDays` to AccessLogValve (set 60 days) ```xml <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" maxDays="60"/> ``` :::info - Can update using `mpos_tool.py send` and `mpos_tool.py run-command` 1. send to /tmp folder because permission reason ```bash ./mpos_tool.py send --exclude 705,999 /opt/tomcat/latest/conf/server.xml /tmp ``` 2. sudo move the file to target destination ```bash ./mpos_tool.py run-command --exclude 705,999 'sudo mv /tmp/server.xml /opt/tomcat/latest/conf/server.xml' ``` ::: - [ ] Update SSL certificate to all stores (last update: 2021/09/29, expires 2022/10/31) ## Other Documentations - http://172.16.9.53/IT_MPOS/mPOS/src/branch/master/BackEnd/scops/notes - previously (partially) hosted at https://10.1.62.97/sandbox/md.html?note=readme