Embarcadero Akademija 2017: RAD Studio in Linux
Urnik 09.00 – 10.30 VirtualBox in Ubuntu: teorija in praksa 10.30 – 11.00 Odmor 11.00 – 12.30 DataSnap Windows/Linux: Od konzole do demona Cilj: v prvem delu vsakomur dati vsaj eno dobro idejo, v drugem delu vsakemu pokazati vsaj nekaj novega.
Embarcadero in Linux
Razvoj RAD Studio/Delphi Tokyo Enterprise Windows Ne: Professional Ne: C++Builder Windows Celotno prevajanje/povezovanje
Poganjanje / OS Red Hat Enterprise 7 Ubuntu Server 16.04 LTS 17.04 Server & Desktop ✓ Z nekaj sreče tudi drugje
Poganjanje / HW Poljuben računalnik Poljubno virtualno okolje VMWare VirtualBox … 64-bit!
Razhroščevanje Windows: RAD Studio / Delphi + Linux: PAServer Stabilnost in zmogljivost Bolj ne kot ja
VirtualBox
VirtualBox Prost odprtokodni virtualizator VirtualBox Extension Pack Oracle Corporation Windows, macOS … VirtualBox Extension Pack Prost za domačo in izobraževalno rabo Ni prost za poslovno rabo USB 2.0/3.0, RDP, NVMe/PXE, disk encryption https://www.virtualbox.org/wiki/Downloads
Ubuntu
Ubuntu Osnova: Debian Canonical Ltd Long Term Support [LTS] Desktop / Server
Namestitev Server Desktop Test/install CD Windows dual-boot 512 MB RAM 2,5 GB disk https://www.ubuntu.com/download/server Desktop 2 GB RAM 25 GB disk https://www.ubuntu.com/download/desktop Test/install CD Windows dual-boot
Ubuntu / VirtualBox Boot iz ISO Network Bridged Paravirtualized
Namestitev OpenSSH server DNS problem sudo apt install openssh-server Ugasniti DNSSEC /etc/nsswitch.conf hosts: files dns
Po-namestitveni koraki sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgrade sudo apt-get install joe wget p7zip-full curl build-essential zlib1g-dev libcurl4-gnutls-dev sudo apt-get autoremove sudo apt-get autoclean
Priprava na razvoj
PAServer WinSCP tar xzvf LinuxPAServer19.0.tar.gz cd PAServer-19.0 <Tab> cd PAServer-19.0 ./paserver
RAD Studio Tools, Manage Platforms Target Platforms Delphi Linux 64-bit Enterprise Target Platforms 64-bit Linux Tools, Options, SDK Manager Tools, Options, Connection Profile Manager
Windows Subsystem for Linux Ubuntu console Settings / Update & security / Developer mode Control panel / Programs and Features / Turn Windows features on or off / Windows Subsystem for Linux (Beta) Bash sudo apt update etc /mnt/c
Strežnik
Strežnik Console Application Windows & Linux DataSnap Server / DataSnap REST Application Stand-alone console application Server Module TDataModule Preimenujemo data modul v ServerMethodsUnit1
Server Functions WebModuleUnit1 AllowServerFunctionInvoker
Baza ServerContainerUnit1 TFDMemTable TFDStanStorageBinLink TFDStanStorageJSONLink FireDACJSONReflect
Test Brskalnik http://localhost:8080/datasnap/rest/TMileageAPI/ AddDataPoint/2017-09-17/234/345
"Unit not found" uses {$IFDEF Linux} Data.FireDACJSONConsts in 'c:\Program Files (x86)\Embarcadero\Studio\ 19.0\source\data\datasnap\Data.FireDACJSONConsts.pas', Data.FireDACJSONReflect in 'c:\Program Files (x86)\Embarcadero\Studio\ 19.0\source\data\datasnap\Data.FireDACJSONReflect.pas', {$ENDIF Linux}
Odjemalec
Odjemalec VCL ali FireMonkey DataSnap Server / DataSnap REST Client Module Pognan strežnik! Generate DataSnap client classes
Lokalna „baza“ TFDMemTable TFDStanStorageBinLink TFDStanStorageJSONLink FireDACJSONReflect
Linux demon
Linux procesi Interactive Batch Daemon Parent pid = 1 (init)
Kako postati demon? fork, pustimo da starš umre setsid, da preselimo proces v novo sejo ujamemo signale (HUP, INIT) fork, da nismo glavni proces v seji zapremo & preusmerimo stdin, stdout, stderr chdir, da ne blokiramo ‚mounta‘ umask, da bodo imele datoteke pravilne pravice
Primer Paolo Rossi „Building a (real) Linux daemon with Delphi“ http://blog.paolorossi.net/2017/09/04/building-a-real-linux-daemon-with-delphi-part-2/ https://github.com/paolo-rossi/linux-daemon
Vprašanja?