Skip to content

Commit

Permalink
Merge pull request #2712 from FroggyFlox/2679-Implement-Tailscale
Browse files Browse the repository at this point in the history
Implement Tailscale service #2679
  • Loading branch information
phillxnet authored Oct 19, 2023
2 parents acb657c + 389b180 commit d6ecf16
Show file tree
Hide file tree
Showing 23 changed files with 1,939 additions and 179 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jslibs/
poetry-install.txt
rockstor-jslibs.tar.gz*
rockstor-tasks-huey.db*
static/
/static/

# Rockstor error tgz
/src/rockstor/logs/error.tgz
Expand Down
3 changes: 2 additions & 1 deletion src/rockstor/scripts/prep_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from storageadmin.models import Setup


def register_services():
def register_services() -> None:
services = {
"NFS": "nfs",
"Samba": "smb",
Expand All @@ -39,6 +39,7 @@ def register_services():
"Bootstrap": "rockstor-bootstrap",
"Shell In A Box": "shellinaboxd",
"Rockstor": "rockstor",
"Tailscale": "tailscaled",
}

# N.B. all other services have null as their default config with service.
Expand Down
5 changes: 0 additions & 5 deletions src/rockstor/smart_manager/data_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -886,18 +886,15 @@ class ServicesNamespace(RockstorIO):
start = False

def on_connect(self, sid, environ):

self.emit("connected", {"key": "services:connected", "data": "connected"})
self.start = True
self.spawn(self.send_service_statuses, sid)

def on_disconnect(self, sid):

self.cleanup(sid)
self.start = False

def send_service_statuses(self):

while self.start:

data = {}
Expand All @@ -914,7 +911,6 @@ def send_service_statuses(self):
data[service.name] = {}
output, error, return_code = service_status(service.name, config=config)
data[service.name]["running"] = return_code

self.emit("get_services", {"data": data, "key": "services:get_services"})
gevent.sleep(15)

Expand Down Expand Up @@ -1122,7 +1118,6 @@ def pool_dev_stats(self):
data["status"] = "errors"
data["message"] = "Pools found with device errors: "
data["message"] += "({})".format(", ".join(labels))

self.emit("pool_dev_stats", {"key": "sysinfo:pool_dev_stats", "data": data})

gevent.sleep(30)
Expand Down
275 changes: 151 additions & 124 deletions src/rockstor/smart_manager/fixtures/services.json
Original file line number Diff line number Diff line change
@@ -1,128 +1,155 @@
[
{
"pk": 1,
"model": "smart_manager.service",
"fields": {
"config": null,
"display_name": "Replication",
"name": "replication"
}
},
{
"pk": 2,
"model": "smart_manager.service",
"fields": {
"config": null,
"display_name": "Samba",
"name": "smb"
}
},
{
"pk": 3,
"model": "smart_manager.service",
"fields": {
"config": null,
"display_name": "NFS",
"name": "nfs"
}
},
{
"pk": 4,
"model": "smart_manager.service",
"fields": {
"config": null,
"display_name": "AD",
"name": "winbind"
}
},
{
"pk": 5,
"model": "smart_manager.service",
"fields": {
"config": null,
"display_name": "NTP",
"name": "ntpd"
}
},
{
"pk": 6,
"model": "smart_manager.service",
"fields": {
"config": null,
"display_name": "NIS",
"name": "nis"
}
},
{
"pk": 7,
"model": "smart_manager.service",
"fields": {
"config": null,
"display_name": "LDAP",
"name": "ldap"
}
},
{
"pk": 8,
"model": "smart_manager.service",
"fields": {
"config": null,
"display_name": "SFTP",
"name": "sftp"
}
},
{
"pk": 9,
"model": "smart_manager.service",
"fields": {
"config": null,
"display_name": "Data Collector",
"name": "data-collector"
}
},
{
"pk": 10,
"model": "smart_manager.service",
"fields": {
"config": null,
"display_name": "Service Monitor",
"name": "service-monitor"
}
},
{
"pk": 11,
"model": "smart_manager.service",
"fields": {
"config": null,
"display_name": "AFP",
"name": "netatalk"
}
},
{
"pk": 12,
"model": "smart_manager.service",
"fields": {
"config": null,
"display_name": "Task Scheduler",
"name": "task-scheduler"
}
},
{
"pk": 13,
"model": "smart_manager.service",
"fields": {
"config": null,
"display_name": "SNMP",
"name": "snmpd"
}
},
{
"pk": 14,
"model": "smart_manager.service",
"fields": {
"config": null,
"display_name": "NUT-UPS",
"name": "nut"
}
"model": "smart_manager.service",
"pk": 1,
"fields": {
"name": "replication",
"display_name": "Replication",
"config": null
}
},
{
"model": "smart_manager.service",
"pk": 2,
"fields": {
"name": "smb",
"display_name": "Samba",
"config": "{\"workgroup\": \"WORKGROUP\"}"
}
},
{
"model": "smart_manager.service",
"pk": 3,
"fields": {
"name": "nfs",
"display_name": "NFS",
"config": null
}
},
{
"model": "smart_manager.service",
"pk": 5,
"fields": {
"name": "ntpd",
"display_name": "NTP",
"config": null
}
},
{
"model": "smart_manager.service",
"pk": 6,
"fields": {
"name": "nis",
"display_name": "NIS",
"config": null
}
},
{
"model": "smart_manager.service",
"pk": 7,
"fields": {
"name": "ldap",
"display_name": "LDAP",
"config": null
}
},
{
"model": "smart_manager.service",
"pk": 8,
"fields": {
"name": "sftp",
"display_name": "SFTP",
"config": null
}
},
{
"model": "smart_manager.service",
"pk": 9,
"fields": {
"name": "rockstor",
"display_name": "Rockstor",
"config": null
}
},
{
"model": "smart_manager.service",
"pk": 10,
"fields": {
"name": "smartd",
"display_name": "S.M.A.R.T",
"config": null
}
},
{
"model": "smart_manager.service",
"pk": 11,
"fields": {
"name": "active-directory",
"display_name": "Active Directory",
"config": null
}
},
{
"model": "smart_manager.service",
"pk": 12,
"fields": {
"name": "nut",
"display_name": "NUT-UPS",
"config": null
}
},
{
"model": "smart_manager.service",
"pk": 13,
"fields": {
"name": "snmpd",
"display_name": "SNMP",
"config": null
}
},
{
"model": "smart_manager.service",
"pk": 14,
"fields": {
"name": "docker",
"display_name": "Rock-on",
"config": null
}
},
{
"model": "smart_manager.service",
"pk": 15,
"fields": {
"name": "shellinaboxd",
"display_name": "Shell In A Box",
"config": "{\"detach\": false, \"css\": \"white-on-black\", \"shelltype\": \"LOGIN\"}"
}
},
{
"model": "smart_manager.service",
"pk": 17,
"fields": {
"name": "ztask-daemon",
"display_name": "ZTaskd",
"config": null
}
},
{
"model": "smart_manager.service",
"pk": 18,
"fields": {
"name": "rockstor-bootstrap",
"display_name": "Bootstrap",
"config": null
}
},
{
"model": "smart_manager.service",
"pk": 21,
"fields": {
"name": "tailscaled",
"display_name": "Tailscale",
"config": null
}
}
]
Loading

0 comments on commit d6ecf16

Please sign in to comment.