Skip to content

Commit

Permalink
init install docs
Browse files Browse the repository at this point in the history
  • Loading branch information
nkoexe committed Sep 24, 2024
1 parent 8e2e951 commit 74d38b3
Show file tree
Hide file tree
Showing 5 changed files with 225 additions and 6 deletions.
76 changes: 76 additions & 0 deletions docs/images/scuolasync.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,16 @@
fill: var(--base-color);
}

/* @media (prefers-color-scheme: dark) {
@media (prefers-color-scheme: dark) {
.app-name {
filter: hue-rotate(0.5turn) brightness(1.7) invert(1);
filter: hue-rotate(0.5turn) brightness(2) invert(1);
}
}*/
}
</style>
<script>
window.$docsify = {
name: 'ScuolaSync',
logo: 'images/scuolasync.svg',
repo: 'nkoexe/scuolasync',
coverpage: true,
loadSidebar: "sidebar.md",
Expand Down Expand Up @@ -125,6 +126,9 @@
<script src="https://cdn.jsdelivr.net/npm/docsify/lib/plugins/search.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify-copy-code/dist/docsify-copy-code.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify-pagination/dist/docsify-pagination.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-bash.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-ini.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/prismjs@1/components/prism-systemd.min.js"></script>
</body>

</html>
6 changes: 3 additions & 3 deletions docs/installazione/display.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ eseguire il login

Crea il file `/etc/systemd/sleep.conf.d/nosuspend.conf`

```conf
```ini
[Sleep]
AllowSuspend=no
AllowHibernation=no
Expand All @@ -49,7 +49,7 @@ AllowHybridSleep=no
Se utilizzando un laptop, previeni la sospensione quando si abbassa lo schermo.
Modifica il file `/etc/systemd/logind.conf`:

```conf
```ini
[Login]
HandleLidSwitch=ignore
HandleLidSwitchDocked=ignore
Expand Down Expand Up @@ -93,7 +93,7 @@ Creazione file di configurazione di lightdm per il login automatico all'accensio
`/etc/lightdm/lightdm.conf`
Impostare `UTENTE` allo username effettivo.

```conf
```ini
[SeatDefaults]
autologin-user=UTENTE
user-session=openbox
Expand Down
138 changes: 138 additions & 0 deletions docs/installazione/server.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# 🖥️ Server

Installazione del server di sistema.


## Introduzione

server scuolasync

## Requisiti

* connessione internet
* un server linux
* python 3.11 o superiore
* boh di spazio

## Installazione

Clona il repository

```sh
git clone https://github.com/nkoexe/scuolasync.git
cd scuolasync
```

Creare un virtualenv

```sh
python -m venv env
source env/bin/activate
```

Installa le dipendenze

```sh
pip install -r requirements.txt
```

Oppure installando manualmente le dipendenze

```sh
pip install flask flask-login flask-socketio flask-wtf beartype apscheduler pandas openpyxl xlsxwriter odspy pylibmagic python-magic oauthlib google-auth google-api-python-client qrcode gunicorn gevent
```

Esegui lo script di setup

```sh
python -m sostituzioni.setup
```

Creazione servizio systemd `scuolasync.service`

```sh
nano /etc/systemd/system/scuolasync.service
```

Assicurarsi di sostituire gli attributi correttamente:
- `<USER>` e `<GROUP>` con il nome utente e gruppo corretto
- `<REPODIR>` con il percorso del repository
- `<PYENV>` con il percorso dell'ambiente virtuale di python


```systemd
[Unit]
Description=ScuolaSync - Server
After=network.target
[Service]
Type=simple
User=<USER>
Group=<GROUP>
WorkingDirectory=<REPODIR>
Environment=PATH=<PYENV>/bin:/usr/bin
Environment=SCUOLASYNC_SERVICE=scuolasync.service
ExecStart=<PYENV>/bin/gunicorn --workers 1 -k gevent --bind 127.0.0.1:5123 sostituzioni.app:app
Restart=always
RestartSec=1
[Install]
WantedBy=multi-user.target
```

Esempio:

```systemd
[Unit]
Description=ScuolaSync - Server
After=network.target
[Service]
Type=simple
User=scuolasync
Group=www-data
WorkingDirectory=/scuolasync
Environment=PATH=/scuolasync/env/bin:/usr/bin
Environment=SCUOLASYNC_SERVICE=scuolasync.service
ExecStart=/scuolasync/env/bin/gunicorn --workers 1 -k gevent --bind 127.0.0.1:5123 sostituzioni.app:app
Restart=always
RestartSec=1
[Install]
WantedBy=multi-user.target
[Service]
WorkingDirectory=/home/scuolasync
ExecStart=/usr/bin/python -m sostituzioni
```

Abilita il servizio allo startup

```sh
systemctl daemon-reload
systemctl enable scuolasync.service
```

Configurazione nginx

```sh
nano /etc/nginx/sites-available/scuolasync
```

Assicurarsi di sostituire gli attributi correttamente:
- `<SERVERNAME>` con il nome del server web (esempio: `scuolasync.fuss.bz.it`)

```nginx
server {
listen 80;
server_name <SERVERNAME>;
location / {
proxy_pass http://127.0.0.1:5123;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
```
1 change: 1 addition & 0 deletions docs/sidebar.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
* [⭐ ScuolaSync](README.md)
* [⚒️ Installazione](installazione/README.md)
* [🖥️ Server](installazione/server.md)
* [📺 Display](installazione/display.md)
* [⁉ FAQ](faq.md)

0 comments on commit 74d38b3

Please sign in to comment.