[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[DIR]build/2023-06-15 18:31 -  
[DIR]config/2023-06-15 17:21 -  
[DIR]database/2023-06-15 14:27 -  
[DIR]node_modules/2023-06-15 18:30 -  
[DIR]public/2023-06-15 14:17 -  
[DIR]src/2024-04-09 14:02 -  
[   ]package.json2023-06-15 18:28 965 9cdca9a added node version as npm module [كارل مبارك]
[   ]api.apache.example.conf2023-06-15 14:17 2.0K 
[TXT]README.md2023-06-15 14:17 2.8Kd7c1522 post receive test [كارل مبارك]
[IMG]favicon.ico2023-06-15 14:17 3.6K 
[TXT]USAGE.md2023-06-15 14:17 14K 
[   ]package-lock.json2023-06-15 18:28 604K9cdca9a added node version as npm module [كارل مبارك]

# Back

## Environment Configuration

Configure your .env file based on [this example](/back/.env.example).
```
cd back
nano .env
```
## Installation

Then you can install the required libraries ( ~ 700MB ) and build the admin UI.

```
npm i
npm run build
```

## Development

In a development environment, start Strapi with autoReload enabled.
```
npm run develop
```
## Deployment

In a production environment, start Strapi with autoReload disabled.
```
npm run start
```

Strapi will start on the port configured in the .env file. If any errors occur with initializing mux or mollie clients, it will throw an error and exit.

## Apache / Nginx Configuration

At this point, you should set up a dedicated domain / subdomain for Strapi ( separate from the Vue SPA ) in your DNS manager and point it to your server's IP address.

Next, configure a site in your apache or nginx webserver for this domain and set it up to proxy connections to the port where Strapi is running.

**Note**: Strapi will also be running a socket.io server instance to relay messages, livestream updates and emojis to connected viewers. Please make sure to configure your apache / nginx configuration file to handle these connections.

**Please refer to the [apache configuration example](/back/api.apache.example.conf).**

The example given assumes that you can generate a self-signged SSL certificate on your server, as this is recccommended for Strapi to work across origins!

# todo: maxconnections count on apache

## Creating Users

You can head over to `https://{ your-strapi-host }/admin` and create your admin users / other users.

## Daemonizing

To keep the application running on the server, you need a node proccess manager / daemonizer. I am using `[pm2](https://pm2.keymetrics.io/)` for this:
```
cd back
pm2 start "npm run start" --name "API.LIVE"
```
Viewing logs:
```
pm2 logs API.LIVE
```
Stopping:
```
pm2 stop API.LIVE
```
Restarting
```
pm2 restart API.LIVE
```

## Mux

Last, head over to your mux dashboard and set up a webhook in your settings that points to the following URL scheme:
```
https://{ your-strapi-host }/api/mux-hook
```
This webhook will inform Strapi of all its video and livestream API events, and Strapi in turn informs connected clients of these events. Make sure you pick the appropriate environment.


## Backing-up

We are using the `sqlite` database with strapi so backing up is quite straight forward. On your development server, just copy the entire `back` folder somewhere safe before making any breaking changes to it. This will copy the configurations, database and uploads.

In case you are using git to version manage your strapi config, you can always just copy the following files/folders:
- `back/.tmp/data.db` : the entire sqlite database
- `back/public/uploads`: all the files uploaded through strapi