# 06. Troubleshooting

[![+Professional Support](https://www.totaljs.com/img/badge-support.svg)](https://www.totaljs.com/support/) [![+Chat with contributors](https://www.totaljs.com/img/badge-chat.svg)](https://messenger.totaljs.com)

## FAQ

- [SSL certificate is expired for SuperAdmin](#)
- [How can I restart SuperAdmin?](#)
- [How can I upgrade SuperAdmin to newest version?](#)
- [How can I uninstall SuperAdmin from my server?](#)
- [Can I use own nginx configs?](#)
- [Where are stored certificates, websites and configs?](#)
- [Can I provide SuperAdmin on another Linux distribution than Ubuntu?](#)
- [How does monitoring work?](#)
- [Can I use SuperAdmin in commercial projects?](#)
- [Which applications are needed for SuperAdmin?](#)
- [A problem with generating of SSL certificates](#)
- [How can I reconfigure SuperAdmin from/to HTTPS](#)
- [How do I run another apps than Total.js?](#)

---

### SSL certificate is expired for SuperAdmin

If your SSL has been expired just login to your server via SSH (you need be under root privileges) and write into the terminal:

```bash
# Open app directory
$ cd /www/superadmin/

# Renew SSL
$ bash ssl.sh superadmindomain.yourdomain.com --renew

# Test NGINX configuration
$ nginx -t

# Reload NGINX configuration
$ nginx -s reload
```

---

### How can I restart SuperAdmin?

You need to restart it manually on the server. Just login to your server via SSH (you need be under root privileges) and write into the terminal:

```bash
# Open app directory
$ cd /www/superadmin/

# Run SuperAdmin
$ bash run.sh
``` 

The command stops SuperAdmin (if ran) and start it again.

---

### How can I upgrade SuperAdmin to newest version?

- back up file `/databases/applications.json`
- back up your credentials in `/config` file (__only credentials, nothing more__)
- download source-code of SuperAdmin from [my.totaljs.com](https://my.totaljs.com)
- copy all directories and files from a new version of SuperAdmin to your server
- restore your backup file `/databases/applications.json`
- restore your __credentials__ in `/config`
- install `ftp` helper via `$ apt-get install -y ftp`
- you need to update `SSL generator` to the latest version via `bash /www/superadmin/ssl.sh --update`
- restart SuperAdmin `bash run.sh`
- __clear cache__ in your web browser

__IMPORTANT__:
If you have lower version than `v7.0.0` then replace `/etc/nginx/nginx.conf` for `/superadmin/nginx.conf`.

---

### How can I uninstall SuperAdmin from my server?

- you need to kill SuperAdmin and stop all Total.js applications:

```bash
$ kill -9 $(ps aux | grep "total" | awk {'print $2'}) > /dev/null
```
- then remove `/www/` directory
- restore old `nginx` configuration, it's stored as `/etc/nginx/nginx.conf.backup`
- remove a cron job according to this result `$ crontab -l`
- done

---

### Can I use own nginx configs?

Of course. SuperAdmin doesn't limit you with nginx and you can create own nginx configs out of SuperAdmin, just add your nginx config to the directory below:

- `/www/nginx/` directory
- and perform nginx reload `$ nginx -s`

---

### Where are stored certificates, websites and configs?

All data are stored in `/www/` directory:

- SSL certificates `/www/ssl/`
- Nginx configs `/www/nginx`
- Logs `/www/logs/`
- Websites `/www/www/`
- SuperAdmin `/www/superadmin/`

---

### Can I provide SuperAdmin on another Linux distribution than Ubuntu?

Yes, but we have tested it on __Ubuntu Server__ only. Some developers provide SuperAdmin on Debian distributions, but we don't have any experience with it.

---

### How does monitoring work?

Each Total.js applications need to depend on [monitor module](https://github.com/totaljs/modules/tree/master/Miscellaneous/monitor). Follow module install instructions. If you have monitor module installed then add URL to monitoring to your app in SuperAdmin:

![Monitoring](/download/1709221004Ti63bv.png)

---

### Can I use SuperAdmin in commercial projects?

Of course, we don't limit you. __Premium SuperAdmin__ is under MIT license and you can use it everywhere or sell it to your end-customers.

---

### Which applications are needed for SuperAdmin?

Install requirements:
- __Ubuntu Server +v14__
- `curl`
- `openssl`

SuperAdmin requirements:
- `awk`
- `bash`
- `cat`
- `cp`
- `df`
- `du`
- `free`
- `ftp`
- `grep`
- `ifconfig`
- `last`
- `lsof`
- `mkdir`
- `netstat`
- `npm`
- `ps`
- `tail`
- `tar`
- `unzip`
- `uptime`
- `wc`
- `zip`

---

### A problem with generating of SSL certificates

__Check__:

If you have a problem with generating SSL certificates, try to check your DNS records for __IPv4__ and __IMPORTANT__: __IPv6__ address. ACME checks IPv6 first and  then it checks IPv4.

If the generating of SSL still persist and it worked before, then try to perform the steps below:

- remove the file `/www/superadmin/databases/acmethumbprint.txt`
- try to update acme.sh `curl https://get.acme.sh | sh`
- restart superadmin `$ bash /www/superadmin/run.sh`

---

### How can I reconfigure SuperAdmin from/to HTTPS

When you first install SuperAdmin if for whatever reason the SSL is not generated correctly it will default to HTTP hosting. You now have the option to reconfigure it from/to HTTPS as well as being able to generate a new SSL using the bash script `superadmin/reconfigure.sh`:

```bash
# SET TO HTTPS AND GENERATE SSL:
$ bash reconfigure.sh y superadmin.mydomain.com y

# SET TO HTTPS WITHOUT GENERATING SSL:
$ bash reconfigure.sh y superadmin.mydomain.com

# SET TO HTTP:
$ bash reconfigure.sh n superadmin.mydomain.com
```

---

### How do I run another apps than Total.js?

It's easy, just follow create a start script like this:

```javascript
var express = require('express');
var app = express();

app.get('/', function (req, res) {
    res.send('hello world 2')
});

// !!! IMPORTANT 1:
app.listen(+process.argv[2]);

// !!! IMPORTANT 2 ("total" word must start in the process title):
process.title = 'total: express';
```

And then set a name of start script to __SuperAdmin__:

![Start Script](/download/B20181107T000000002.png)