2.3.0 • Published 6 months ago

@lilaquadrat/hosting v2.3.0

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

STUDIO-HOSTING

handles external commands for nginx and docker

HOW

checks every INTERVAL seconds the connected database for new commands

REQUIREMENTS

  • nodejs >= 12
  • git
  • nginx
  • docker
  • docker-compose

SETUP

MOUNT FILE SHARE

  • vim /etc/fstab
  • add the following code and replace YOURSHARE, YOURUSERNAME and YOURPASSWORD

//liveeditor.file.core.windows.net/YOURSHARE /mnt/storage cifs nofail,vers=3.0,username=YOURUSERNAME,password=YOURPASSWORD,dir_mode=0777,file_mode=0777

SERVICES

command service

To create all needed systemd service files, start the main.js with argument createServices. The newly generated files will be in the new folder services

/base/studio-hosting/node_modules/@lilaquadrat/hosting/lib/main.js --createServices
  • systemctl enable studio-hosting.service for enabling autostart

  • systemctl start studio-hosting.service

  • systemctl stop studio-hosting.service

  • journalctl -e -u studio-hosting.service to show the logs

ENV FILE

the linked .env file needs the following variables

variablenameexample valuedescription
VAULThttps://YOUR_VAULT.vault.azure.net/url of the vault with the secret
API_ENDPOINThttp://localhost:9090endpoint from which the commands are provided
APPINSIGHTS_NAMEhostingServerfor filtering in applicationinsights
APPINSIGHTS_KEYXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXfor authentication with applicationinsights
INTERVAL60000interval for fetching new commands from the api
DOCKERFILE/base/data/docker-compose.jsondockerfile that will be used for all docker-compose commands

docker-compose service

  • vim /etc/systemd/system/docker-compose.service
    • copy the content of systemd/docker-compose.service in this repo in the new created file.
    • LINE #10 / #11 needs to be changed to your docker-compose.json
  • systemctl enable docker-compose

nginx service

  • systemctl enable nginx
  • vim /etc/systemd/system/multi-user.target.wants/nginx.service
    • add "mnt-storage.mount" to LINE #3

the stream and proxy conf have to be added to the main nginx.conf.

  • vim /etc/nginx/nginx.conf

see the nginx.conf in this repository