Commit 0fe9b30d by Szeberényi Imre

Linux install fix

parent 3489f43e
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
version.txt version.txt
*,cover *,cover
.coverage .coverage
*~
*.log *.log
build build
dist dist
......
NOTES - aka, mivel lehet szivni... # Circle Agent #
Agent = python3 VM kontextualizálását végzi
__INSTALL__ ## Linux ##
* Feltételezzuk, hogy van python3 és virtualenv * virtualenv-ben fut szervizként
* Fájlok
- /root/agent/*
- /usr/bin/vm_renewal
- /etc/systemd/system/agent.service
### tesztelve ***
- ubuntu 18.04, 20.04, 22.04, 24.04
- vannak más és régebbi rednszerekhez is alkatrészek a repóban, de feledésbe merültek...
### Linux install ###
* Feltételezzuk, hogy van python3 és virtualenv, ha nincs:
- sudo apt install python3
- sudp apt install virtualenvwrapper
* sudo -i
* cd /root * cd /root
* chmod oug+x . * chmod oug+x .
* mkvirtualenv agent * mkvirtualenv agent
...@@ -10,30 +24,53 @@ __INSTALL__ ...@@ -10,30 +24,53 @@ __INSTALL__
* git clone https://git.ik.bme.hu/CIRCLE3/agent.git * git clone https://git.ik.bme.hu/CIRCLE3/agent.git
* chmod oug+rx agent * chmod oug+rx agent
* cd agent * cd agent
* python agent.py * python agent.py --install
- bemasolja az agent.service-t /etc/systemd -be, engedélyezi, de nem indítja el
- bemasolja a vm_renewal-t a /usr/bin/ -be
## Windows ##
__RC.D__ * Bundled python alkalmazások, melyekből az első kettő szervízként fut, a harmadik a clud user belépésekor indul
* nem tamogatott * Fájlok:
- c:\circle\agent-winservice.exe
- c:\circle\agemt-wdog-winservice.exe
- c:\circle\agent-notify.exe
__SYSTEMD__ ### tesztelve ***
* bemasolja az agent.service-t /etc/systemd-be - windows 10, 11
* bemasolja a vm_renewal-t a /usr/bin/-be es engedélyezi, de nem indítja el - Win7-re az ez a verzió nem megy fel. Régit kell hazsnálni.
### Windows install ###
* Adminisztrátori jogokkali:
* Létre kell hozni egy ```c:\circle``` katalógust
* Ebbe le kell tölteni a https://git.ik.bme.hu/CIRCLE3/agent/tree/master/win_exe/w10 vagy w11 katalógus fájljait. Célszerű az ```sdelete64```-et és a ```wget```-et is letölteni, de nem szükséges. Majd:
```
cd:\circle
.\agent-winservice.exe --startup auto install
.\agent-wdog-winservice --startup auto install
.\agent-winservice.exe start
.\agent-wdog-winservice start
```
* Ha a fentiek sikerültek, akkor be kell konfuigurálni, hogy a circle_notify.exe automatikusan elinduljon amikor a cloud user belép. Ez 11-ben kicsit trükkös:
- windows-R (run command): ```shell:starup```
- erre megnyilik egy foldernek látszó ablak, amibe be kell húzni (link kell!) a ˙˙`circle-notify.exe```-t
__SMBFS__ ## Egyebek ##
* mindenhol case insensitive, kiveve a /etc/nsmb.conf-ban es a ~/.nsmbrc-ben, itt a userneveket szigoruan upper-case kell irni
* az /etc/nsmb.conf-ban vagy a ~/.nsmbrc-ben meg kell ismetelni a [SERVER] es a [SERVER:USER] reszeknel az add-t es a password-ot
__IPV6__ ### USER ###
* semmi extra, prefixlen kell prefix helyett * cloud
__ROUTING__ ### hálózat ###
* {ipv6_,}defaultrouter-eket kell beallitani * ubuntu alatt a ```/etc/network/interfaces``` fájlt piszkálja
__USER__ ### DNS ###
* cloud * Linux alatt még a ```resolv.conf```-ot piszkálja **TODO**
#### SMBFS ####
* mindenhol case insensitive, kiveve a /etc/nsmb.conf-ban es a ~/.nsmbrc-ben, itt a userneveket szigoruan upper-case kell irni
* az /etc/nsmb.conf-ban vagy a ~/.nsmbrc-ben meg kell ismetelni a [SERVER] es a [SERVER:USER] reszeknel az add-t es a password-ot
__SERIAL__ #### SERIAL ####
* virtios soros port elsodlegesen, utana hw soros * virtios soros port elsodlegesen, utana hw soros
* \r sorveg eseten hibas csomagok, FreeBSD-n \n az elvart - windows alatt csak virtio-val tesztelve
* \r sorveg eseten hibas csomagok, FreeBSD-n \n az elvart
...@@ -18,8 +18,9 @@ logger.setLevel(level) ...@@ -18,8 +18,9 @@ logger.setLevel(level)
system = platform.system() # noqa system = platform.system() # noqa
logger.debug("system:%s", system) logger.debug("system:%s", system)
if system == "Linux" or system == "FreeBSD": # noqa
logger.debug("system:%s", system) def linux_install:
logger.info("Installing agent on %s system", system)
try: # noqa try: # noqa
chdir(sys.path[0]) # noqa chdir(sys.path[0]) # noqa
subprocess.call(('pip', 'install', '-r', 'requirements/linux.txt')) # noqa subprocess.call(('pip', 'install', '-r', 'requirements/linux.txt')) # noqa
...@@ -27,6 +28,7 @@ if system == "Linux" or system == "FreeBSD": # noqa ...@@ -27,6 +28,7 @@ if system == "Linux" or system == "FreeBSD": # noqa
copy_file("misc/vm_renewal", "/usr/bin/vm_renewal", mode=0o755) copy_file("misc/vm_renewal", "/usr/bin/vm_renewal", mode=0o755)
if copy_file("misc/agent.service", "/etc/systemd/system/agent.service"): if copy_file("misc/agent.service", "/etc/systemd/system/agent.service"):
subprocess.call(('systemctl', 'enable', 'agent')) subprocess.call(('systemctl', 'enable', 'agent'))
shutil.rmtree('win_exe')
except Exception as e: # noqa except Exception as e: # noqa
logger.exception("Unhandled exeption: %s", e) logger.exception("Unhandled exeption: %s", e)
pass # hope it works # noqa pass # hope it works # noqa
...@@ -205,6 +207,9 @@ class SerialLineReceiver(SerialLineReceiverBase): ...@@ -205,6 +207,9 @@ class SerialLineReceiver(SerialLineReceiverBase):
pass pass
def main(): def main():
if system == "Linux" or system == "FreeBSD": # noqa
if len(sys.argv) != 1 and (if (sys.argv[1] == "-i" or sys.argv[1] "--install"):
linux_install()
# Get proper serial class and port name # Get proper serial class and port name
(serial, port) = get_serial() (serial, port) = get_serial()
logger.info("Opening port %s", port) logger.info("Opening port %s", port)
......
pyinstaller
Twisted Twisted
pyserial pyserial
psutil psutil
......
pyinstaller --clean --hidden-import pkg_resources --hidden-import infi --hidden-import win32timezone --hidden-import win32traceutil -F watchdog-winservice.py
pyinstaller --clean --hidden-import pkg_resources --hidden-import infi --hidden-import win32timezone --hidden-import win32traceutil -F agent-winservice.py
pyinstaller --clean --hidden-import pkg_resources --hidden-import infi --hidden-import win32timezone --hidden-import win32traceutil -F circle-notify.pyw
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment