Skip to content

Commit

Permalink
moved to /uisptools pathing updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrewiski committed Jan 19, 2023
1 parent d0eecb5 commit ada9a80
Show file tree
Hide file tree
Showing 24 changed files with 4,453 additions and 2,020 deletions.
93 changes: 59 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,74 @@ This Node.js application runs in a seperate docker instance will interface to yo
UISP-Tools is compatible with UCRM 2.10.0+

## How does it work?
* install uisptools using docker-compose
* using a web browser connect to UISPTools docker container [http://127.0.0.0](http://127.0.0.0)
* using a web browser login to the admin page using default username and password "admin" and "UISPToolsPassword" [http://127.0.0.0/admin](http://127.0.0.0/admin)
* That's it, .
* uisptools docker services are added to the UISP docker-compose.yaml file that is created during the UISP install process located at /home/unms/app/docker-compose.yml
* next the /uisptools path is added to the unms-nginx conf.d so that it can accessed using the UNMS url /uisp
* plugins can be added by copying them to the config/plugin folder and adding them to the plugins section of config.json file
* all of the uisptools reside in a completly seperate paths as well as seperate containers so easy to remove and upgrade


## How to install (Could use some help creating an install.sh script to make this easier)
```
# sudo groupadd docker
# sudo usermod -aG docker $USER
# newgrp docker or reboot/logout-login
sudo mkdir -p /usr/src/uisptools
sudo chown "$USER":"docker" /usr/src/uisptools
mkdir -p /usr/src/uisptools/config
sudo chown "$USER":"docker" /usr/src/uisptools/config
mkdir -p /usr/src/uisptools/logs
sudo chown "$USER":"docker" /usr/src/uisptools/logs
mkdir -p /usr/src/uisptools/data/mongodb
sudo chown "$USER":"docker" /usr/src/uisptools/data
sudo chown "$USER":"docker" /usr/src/uisptools/data/mongodb
mkdir ~/uisptools
mkdir ~/uisptools/dockerCompose
mkdir ~/uisptools/mongodb
mkdir ~/uisptools/mongodb/docker-entrypoint-initdb.d
#Link the exsiting certs in the server
sudo ln -s /home/unms/data/cert/live/billing.example.com/fullchain.pem /usr/src/uisptools/config/server.cert
sudo ln -s /home/unms/data/cert/live/billing.example.com/privkey.pem /usr/src/uisptools/config/server.key
wget -c https://raw.githubusercontent.com/Andrewiski/UISP-Tools/main/mongodb/docker-entrypoint-initdb.d/createDatabase.js -O ~/uisptools/mongodb/docker-entrypoint-initdb.d/createDatabase.js
wget -c https://raw.githubusercontent.com/Andrewiski/UISP-Tools/main/mongodb/docker-entrypoint-initdb.d/initWebServerPages.js -O ~/uisptools/mongodb/docker-entrypoint-initdb.d/initWebServerPages.js
wget -c https://raw.githubusercontent.com/Andrewiski/UISP-Tools/main/dockerCompose/docker-compose.yml -O ~/uisptools/dockerCompose/docker-compose.yml
sudo docker-compose -f ~/uisptools/dockerCompose/docker-compose.yml up --force-recreate -d
# Create a password for the unms user
sudo passwd unms
#Login as unms as thats the user uisp runs under
#get the unms userid make sure it matches the user in the docker-compose.yml so the container runs as correct user
id -u
#Change the /home/unms/app folder where the docker-compose.yml file resides it too will have the user id set needs to be the same so updated if not 1001 from my example append file
cd ~/app
#Stop the uisp docker containers
docker-compose down
# create the uisptools folder using unms user so they have correct permissions
mkdir ~/data/uisptools
mkdir ~/data/uisptools/config
mkdir ~/data/uisptools/config/public
mkdir ~/data/uisptools/config/plugins
mkdir ~/data/uisptools/logs
mkdir ~/data/uisptools/mongodb
mkdir ~/data/uisptools/mongodb/data
mkdir ~/data/uisptools/mongodb/docker-entrypoint-initdb.d
#copy the mongo db init scripts from github (note this are only ran once and only if there is an empty database I use Studio 3T as windows mongo Client see below)
wget -o ~/data/uisptools/mongodb/docker-entrypoint-initdb.d/01_createDatabase.js https://raw.githubusercontent.com/Andrewiski/UISP-Tools/main/mongodb/docker-entrypoint-initdb.d/01_createDatabase.js
wget -o ~/data/uisptools/mongodb/docker-entrypoint-initdb.d/02_initWebServerPages.js https://raw.githubusercontent.com/Andrewiski/UISP-Tools/main/mongodb/docker-entrypoint-initdb.d/02_initWebServerPages.js
# append the contents of https://github.com/Andrewiski/UISP-Tools/blob/main/dockerCompose/uisp/docker-compose-append.yml to the end of /home/unms/app/docker-compose.yml
vi docker-compose.yml
#Note that by changing the version of of uisptools in the docker-compose.yml will allow it to be upgraded with a "docker-compose down" followed by a "docker-compose up -d"
#restart uisp including the uisptools services
docker-compose up -d
# shell into the uisp-nginx container and update the nginx config
docker exec -it unms-nginx sh
# determine which template your setup is using by listing what is in the conf.d folder
ls /usr/local/openresty/nginx/conf/conf.d
# in my case ls returned "nginx-api.conf" and "unms-https+wss.conf" these files are recreated at restart so we need to edit the template they are created from so it survives a reboot.
vi /usr/local/openresty/nginx/templates/conf.d/unms-https+wss.conf.template
# Append the following to the template so uisptools is accessable on the /uisptools/ path
location /uisptools/ {
allow all;
proxy_pass http://uisptools:49080;
}
# vi commands require pressing i to insert then "esc : w" to write the file then "esc : q" to quit vi
#need to exit the container shell with a exit
exit
#now restart the unms-nginx container so it uses the template to update the conf.d file and to make sure are changes survive a reboot
docker restart unms-nginx
```

Should be ablle to get the default website to open by visiting https://uispserver/uisptools


sudo docker pull docker.pkg.github.com/jon-gr/webstream/appliance_sqm_sip:latest
## How to edit the Mongo Database
I use the free Windows app Studio 3T and connect to the mongo instance using ssh and then authentication using the uisptools and password set in docker-compose.yaml.
Note that username password combo if changed needs to be updated in the /home/unms/uisptools/config/config.json as well in the mongodb url


## Plugins General Usage and Warnings
* Installing uisptools can allow any NMS superadmin to make any nms api call exposed this includes Posts and Deletes via urls using the generic passthrough this can be disabled with a config option. The user does need to using the uisptools login and have an active short lived access token
* Any plugin can be copied and extended by coping to the config/plugins folder, config/plugins is served before /plugins this way any and all plugins can be extended

## How can I contribute?
* This application are under GNU General Public License v3.0 enabling anyone to contribute any upgrades or create whole new ones
Expand Down
2 changes: 1 addition & 1 deletion dockerCompose/docker-compose-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
dockerfile: Dockerfile
args:
# [Choice] Node.js version: 16, 14, 12
VARIANT: 14
VARIANT: 16
# On Linux, you may need to update USER_UID and USER_GID below if not your local UID is not 1000.
USER_UID: 1000
USER_GID: 1000
Expand Down
40 changes: 0 additions & 40 deletions dockerCompose/docker-compose.yml

This file was deleted.

3 changes: 2 additions & 1 deletion dockerCompose/uisp/docker-compose-append.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
uisptools:
image: "andrewiski/uisptools:0.0.8"
image: "andrewiski/uisptools:0.0.10"
user: "1001"
ports:
- "49443:49443"
- "49080:49080"
volumes:
- /home/unms/data/uisptools/config:/usr/src/uisptools/config
- /home/unms/data/uisptools/logs:/usr/src/uisptools/logs
- /home/unms/data/cert:/usr/src/uisptools/config/uisp_certs
container_name: uisptools
environment:
- UNMS_USER_ID=1001
Expand Down
16 changes: 16 additions & 0 deletions installScripts/devNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,22 @@ hostname -I | cut -f 1 -d ' '
```

```
docker exec -it uisptools sh
```

```
docker exec -it unms-nginx sh
vi /usr/local/openresty/nginx/templates/conf.d/unms+ucrm-https+wss.conf.template
location /uisptools/ {
allow all;
proxy_pass http://uisptools:49080;
}
```

```
docker-compose -p "unms" -f "docker-compose.yml" down
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ db.ut_PageContent.createIndex( { "pageContentGuid": 1 } )

db.createCollection("ut_DeviceDetails")

db.createCollection("ut_PluginData")

db.ut_PluginData.createIndex( { "pluginId": 1 }, { unique: true } )
db.ut_PluginData.createIndex( { "pluginName": 1 }, { unique: true } )

db.createCollection("ut_PluginUserData")

db.ut_PluginData.createIndex( { "pluginId": 1, "userId": 1 } , { unique: true } )
db.ut_PluginData.createIndex( { "pluginName": 1, "userId": 1 } , { unique: true } )






Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ db.ut_PageContent.insert(
"linkStatus" : 1,
"linkTarget" : "_self",
"linkText" : "Home",
"linkUrl" : "/",
"linkUrl" : "/uisptools",
"pageContentGuid" : "00000000-0000-0000-0000-000000000001",
"pageDescription" : " Website Home Page",
"pageKeywords" : "",
Expand Down Expand Up @@ -81,7 +81,7 @@ db.ut_PageContent.insert(
"linkStatus" : 1,
"linkTarget" : "_self",
"linkText" : "Admin",
"linkUrl" : "/admin/admin.htm",
"linkUrl" : "/uisptools/admin/admin.htm",
"pageContentGuid" : "dc5370c8-8eee-4557-a146-f4e07423ddad",
"pageDescription" : "Admin Page",
"pageKeywords" : "",
Expand All @@ -105,7 +105,7 @@ db.ut_PageContent.insert(
"linkStatus" : 1,
"linkTarget" : "_self",
"linkText" : "Detect DFS",
"linkUrl" : "/uisptools/detectdfs",
"linkUrl" : "/uisptools/uisptools/detectdfs",
"pageContentGuid" : "ac5370c8-8eae-4557-f146-f4e07423ddcd",
"pageDescription" : "Detect DFS",
"pageKeywords" : "",
Expand All @@ -129,7 +129,7 @@ db.ut_PageContent.insert(
"linkStatus" : 1,
"linkTarget" : "_self",
"linkText" : "Test API",
"linkUrl" : "/uisptools/testing/testapicalls",
"linkUrl" : "/uisptools/uisptools/testing/testapicalls",
"pageContentGuid" : "ac5370c8-8e5e-4557-f146-f4e07423afcd",
"pageDescription" : "Test API Calls",
"pageKeywords" : "",
Expand All @@ -153,7 +153,7 @@ db.ut_PageContent.insert(
"linkStatus" : 1,
"linkTarget" : "_self",
"linkText" : "Tower Clients",
"linkUrl" : "/wilcowireless/towerclients",
"linkUrl" : "/uisptools/wilcowireless/towerclients",
"pageContentGuid" : "ad5570c8-8f5e-4557-f146-f4a07423afcd",
"pageDescription" : "Tower Clients",
"pageKeywords" : "",
Expand All @@ -177,7 +177,7 @@ db.ut_PageContent.insert(
"linkStatus" : 1,
"linkTarget" : "_self",
"linkText" : "Frequency Mapper",
"linkUrl" : "/wilcowireless/freqmapper",
"linkUrl" : "/uisptools/wilcowireless/freqmapper",
"pageContentGuid" : "ad5575c8-8f5a-4557-f145-f5c07423afcd",
"pageDescription" : "Frequency Mapper",
"pageKeywords" : "",
Expand All @@ -201,7 +201,7 @@ db.ut_PageContent.insert(
"linkStatus" : 1,
"linkTarget" : "_self",
"linkText" : "AP Map",
"linkUrl" : "/digitalexample/apmap",
"linkUrl" : "/uisptools/digitalexample/apmap",
"pageContentGuid" : "cb5570e8-8f5d-3557-f146-f4a07423afcd",
"pageDescription" : "AP Map",
"pageKeywords" : "",
Expand Down
Loading

0 comments on commit ada9a80

Please sign in to comment.