@lilaquadrat/hosting
TypeScript icon, indicating that this package has built-in type declarations

2.3.0 • Public • Published

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

variablename example value description
VAULT https://YOUR_VAULT.vault.azure.net/ url of the vault with the secret
API_ENDPOINT http://localhost:9090 endpoint from which the commands are provided
APPINSIGHTS_NAME hostingServer for filtering in applicationinsights
APPINSIGHTS_KEY XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX for authentication with applicationinsights
INTERVAL 60000 interval for fetching new commands from the api
DOCKERFILE /base/data/docker-compose.json dockerfile 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

Readme

Keywords

none

Package Sidebar

Install

npm i @lilaquadrat/hosting

Weekly Downloads

1

Version

2.3.0

License

MIT

Unpacked Size

29 kB

Total Files

35

Last publish

Collaborators

  • mschuebel