Simplify installation script and project dependencies
This commit is contained in:
parent
3f9875cb1a
commit
b6d7183094
@ -14,6 +14,11 @@
|
|||||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.7" />
|
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.7" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||||
<PackageReference Include="System.ServiceModel.Syndication" Version="7.0.0" />
|
<PackageReference Include="System.ServiceModel.Syndication" Version="7.0.0" />
|
||||||
|
<PackageReference Include="Cronos" Version="0.7.1" />
|
||||||
|
<PackageReference Include="SharpCompress" Version="0.35.0" />
|
||||||
|
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
|
||||||
|
<PackageReference Include="System.Text.Json" Version="7.0.3" />
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
90
install.sh
90
install.sh
@ -73,27 +73,13 @@ if [ $? -ne 0 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install PostgreSQL
|
# PostgreSQL is not needed in simplified version
|
||||||
print_section "Installing PostgreSQL"
|
print_section "Checking dependencies"
|
||||||
if ! command -v psql &> /dev/null; then
|
echo "Using simplified version without database dependencies."
|
||||||
echo "Installing PostgreSQL..."
|
|
||||||
apt-get install -y postgresql postgresql-contrib
|
|
||||||
else
|
|
||||||
echo "PostgreSQL is already installed."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Start PostgreSQL service
|
# No need for Entity Framework tools in the simplified version
|
||||||
systemctl start postgresql
|
print_section "Checking .NET tools"
|
||||||
systemctl enable postgresql
|
echo "Using simplified version without database dependencies."
|
||||||
|
|
||||||
# Install Entity Framework Core tools
|
|
||||||
print_section "Installing EF Core tools"
|
|
||||||
if ! su - postgres -c "dotnet tool list -g" | grep "dotnet-ef" > /dev/null; then
|
|
||||||
echo "Installing Entity Framework Core tools..."
|
|
||||||
su - postgres -c "dotnet tool install --global dotnet-ef --version 7.0.15"
|
|
||||||
else
|
|
||||||
echo "Entity Framework Core tools are already installed."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create installation directory
|
# Create installation directory
|
||||||
print_section "Setting up application"
|
print_section "Setting up application"
|
||||||
@ -103,45 +89,50 @@ mkdir -p $INSTALL_DIR
|
|||||||
# Download or clone the application
|
# Download or clone the application
|
||||||
if [ ! -d "$INSTALL_DIR/.git" ]; then
|
if [ ! -d "$INSTALL_DIR/.git" ]; then
|
||||||
echo "Downloading application files..."
|
echo "Downloading application files..."
|
||||||
# Clone the repository
|
# Clone the repository (main branch)
|
||||||
git clone https://git.powerdata.dk/masterdraco/Torrent-Manager.git $INSTALL_DIR
|
git clone -b main https://git.powerdata.dk/masterdraco/Torrent-Manager.git $INSTALL_DIR
|
||||||
else
|
else
|
||||||
echo "Updating existing installation..."
|
echo "Updating existing installation..."
|
||||||
cd $INSTALL_DIR
|
cd $INSTALL_DIR
|
||||||
git pull
|
git pull
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Setup database
|
# Setup configuration directory
|
||||||
print_section "Setting up database"
|
print_section "Setting up configuration"
|
||||||
DB_NAME="torrentmanager"
|
|
||||||
DB_USER="torrentmanager"
|
|
||||||
DB_PASSWORD=$(tr -dc 'A-Za-z0-9' < /dev/urandom | head -c 16)
|
|
||||||
|
|
||||||
# Check if database exists
|
|
||||||
DB_EXISTS=$(su - postgres -c "psql -tAc \"SELECT 1 FROM pg_database WHERE datname='$DB_NAME'\"")
|
|
||||||
if [ "$DB_EXISTS" != "1" ]; then
|
|
||||||
echo "Creating database and user..."
|
|
||||||
# Create database and user
|
|
||||||
su - postgres -c "psql -c \"CREATE USER $DB_USER WITH PASSWORD '$DB_PASSWORD';\""
|
|
||||||
su - postgres -c "psql -c \"CREATE DATABASE $DB_NAME OWNER $DB_USER;\""
|
|
||||||
su - postgres -c "psql -c \"GRANT ALL PRIVILEGES ON DATABASE $DB_NAME TO $DB_USER;\""
|
|
||||||
else
|
|
||||||
echo "Database already exists."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Save connection string
|
|
||||||
CONFIG_DIR="/etc/transmission-rss-manager"
|
CONFIG_DIR="/etc/transmission-rss-manager"
|
||||||
mkdir -p $CONFIG_DIR
|
mkdir -p $CONFIG_DIR
|
||||||
|
|
||||||
|
# Create config file with default settings
|
||||||
echo '{
|
echo '{
|
||||||
"ConnectionStrings": {
|
"Transmission": {
|
||||||
"DefaultConnection": "Host=localhost;Database='$DB_NAME';Username='$DB_USER';Password='$DB_PASSWORD'"
|
"Host": "localhost",
|
||||||
|
"Port": 9091,
|
||||||
|
"Username": "",
|
||||||
|
"Password": "",
|
||||||
|
"UseHttps": false
|
||||||
|
},
|
||||||
|
"AutoDownloadEnabled": true,
|
||||||
|
"CheckIntervalMinutes": 30,
|
||||||
|
"DownloadDirectory": "/var/lib/transmission-daemon/downloads",
|
||||||
|
"MediaLibraryPath": "/media/library",
|
||||||
|
"PostProcessing": {
|
||||||
|
"Enabled": false,
|
||||||
|
"ExtractArchives": true,
|
||||||
|
"OrganizeMedia": true,
|
||||||
|
"MinimumSeedRatio": 1
|
||||||
|
},
|
||||||
|
"UserPreferences": {
|
||||||
|
"EnableDarkMode": true,
|
||||||
|
"AutoRefreshUIEnabled": true,
|
||||||
|
"AutoRefreshIntervalSeconds": 30,
|
||||||
|
"NotificationsEnabled": true
|
||||||
}
|
}
|
||||||
}' > "$CONFIG_DIR/appsettings.json"
|
}' > "$CONFIG_DIR/appsettings.json"
|
||||||
|
|
||||||
# Set proper permissions
|
# Set proper permissions
|
||||||
chown -R postgres:postgres "$CONFIG_DIR"
|
chown -R root:root "$CONFIG_DIR"
|
||||||
chmod 750 "$CONFIG_DIR"
|
chmod 755 "$CONFIG_DIR"
|
||||||
chmod 640 "$CONFIG_DIR/appsettings.json"
|
chmod 644 "$CONFIG_DIR/appsettings.json"
|
||||||
|
|
||||||
# Build and deploy the application
|
# Build and deploy the application
|
||||||
print_section "Building application"
|
print_section "Building application"
|
||||||
@ -164,10 +155,9 @@ dotnet publish -c Release -o $INSTALL_DIR/publish
|
|||||||
# Copy configuration
|
# Copy configuration
|
||||||
cp "$CONFIG_DIR/appsettings.json" "$INSTALL_DIR/publish/appsettings.json"
|
cp "$CONFIG_DIR/appsettings.json" "$INSTALL_DIR/publish/appsettings.json"
|
||||||
|
|
||||||
# Run migrations
|
# No database migrations needed in simplified version
|
||||||
print_section "Running database migrations"
|
print_section "Configuration completed"
|
||||||
cd "$PROJECT_DIR"
|
echo "No database migrations needed in simplified version."
|
||||||
dotnet ef database update
|
|
||||||
|
|
||||||
# Create systemd service
|
# Create systemd service
|
||||||
print_section "Creating systemd service"
|
print_section "Creating systemd service"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user