[[chapter_installation]]
= How to install
:title: Installation

{app-name} is an application developed in .Net.

== PVE Requirements

The minimal version of Proxmox VE is 6.4.

== PVE Permission

For connection to a cluster is require credential **Web Api** or **Token Api**. This require permission for execution. In this moment **all permission** is required.

== AppSettings.json

The configurations are saved in appsettings.json.

Most important options are:

- **urls** set the ip address and port to espose the web application '0.0.0.0' for all (default http://0.0.0.0:5000)

== Binary/Docker Install

=== From binary repository

Download last release from https://github.com/Corsinvest/cv4pve-admin/releases[Project Repository] and unzip in the directory where you want it to run.
Start application:

* Windows .\Corsinvest.ProxmoxVE.Admin.exe
* Linux/MaxOsX ./Corsinvest.ProxmoxVE.Admin

IMPORTANT: For Linux/MaxOsX change permission

[source,bash,subs="normal"]
----
chmod 777 /home/frank/cv4pve-admin/Corsinvest.ProxmoxVE.Admin
chmod -R 0755 /home/frank/cv4pve-admin/wwwroot
----

==== Linux Configure Service

[source,bash,subs="normal"]
----
apt update && apt install unzip wget
cd /temp
wget https://github.com/Corsinvest/cv4pve-admin/releases/download/vXX.XX.XX/cv4pve-admin-linux-x64.zip
unzip /temp/cv4pve-admin-linux-x64.zip -d /var/cv4pve-admin
chmod 777 /var/cv4pve-admin/Corsinvest.ProxmoxVE.Admin
chmod -R 0755 /var/cv4pve-admin/wwwroot
----

Create a service file /etc/systemd/system/{app-name}.service

Copy the following configuration in that file and  it will run our application,

[source,bash,subs="normal"]
----
[Unit]
Description={app-name} Web Application
[Service]
WorkingDirectory=/var/{app-name}
ExecStart=/var/{app-name}/Corsinvest.ProxmoxVE.Admin
Restart=always
RestartSec=10
SyslogIdentifier={app-name}
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
[Install]
WantedBy=multi-user.target
----

Now start the service. Instead of the service name in the below commands use the name of the file made above,

[source,bash,subs="normal"]
----
systemctl enable {app-name}
systemctl start {app-name}
----

Now your proxy server and kestrel server is running and you can access your application through any ip with port 5001.

To redeploy the code your need to replace the dll and stop and start your service again through the following commands

[source,bash,subs="normal"]
----
sudo systemctl stop {app-name}
sudo systemctl start {app-name}
----

Now I expect the {app-name} is running and you can access your application through any ip with port 5000.
The web interface can be reached via https://youripaddress:5000
(default login is: *admin@local*, and the password is *Password123!*).

=== Docker

{app-name} is an application developed in .Net. For deploy is used
https://hub.docker.com/r/corsinvest/{app-name}[Docker image].


[[chapter_installation_update]]
== How to Update

=== From binary repository

Stop application
Save the **data** directory and **appsettings.json**.
Download latest release from https://github.com/Corsinvest/cv4pve-admin/releases[Project Repository] and unzip in previous directory installation.
Restore **data** directory and **appsettings.json**.

=== Docker
See https://hub.docker.com/r/corsinvest/{app-name}[Docker image]
