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="Swashbuckle.AspNetCore" Version="6.5.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>
|
||||
|
90
install.sh
90
install.sh
@ -73,27 +73,13 @@ if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Install PostgreSQL
|
||||
print_section "Installing PostgreSQL"
|
||||
if ! command -v psql &> /dev/null; then
|
||||
echo "Installing PostgreSQL..."
|
||||
apt-get install -y postgresql postgresql-contrib
|
||||
else
|
||||
echo "PostgreSQL is already installed."
|
||||
fi
|
||||
# PostgreSQL is not needed in simplified version
|
||||
print_section "Checking dependencies"
|
||||
echo "Using simplified version without database dependencies."
|
||||
|
||||
# Start PostgreSQL service
|
||||
systemctl start postgresql
|
||||
systemctl enable postgresql
|
||||
|
||||
# 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
|
||||
# No need for Entity Framework tools in the simplified version
|
||||
print_section "Checking .NET tools"
|
||||
echo "Using simplified version without database dependencies."
|
||||
|
||||
# Create installation directory
|
||||
print_section "Setting up application"
|
||||
@ -103,45 +89,50 @@ mkdir -p $INSTALL_DIR
|
||||
# Download or clone the application
|
||||
if [ ! -d "$INSTALL_DIR/.git" ]; then
|
||||
echo "Downloading application files..."
|
||||
# Clone the repository
|
||||
git clone https://git.powerdata.dk/masterdraco/Torrent-Manager.git $INSTALL_DIR
|
||||
# Clone the repository (main branch)
|
||||
git clone -b main https://git.powerdata.dk/masterdraco/Torrent-Manager.git $INSTALL_DIR
|
||||
else
|
||||
echo "Updating existing installation..."
|
||||
cd $INSTALL_DIR
|
||||
git pull
|
||||
fi
|
||||
|
||||
# Setup database
|
||||
print_section "Setting up database"
|
||||
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
|
||||
# Setup configuration directory
|
||||
print_section "Setting up configuration"
|
||||
CONFIG_DIR="/etc/transmission-rss-manager"
|
||||
mkdir -p $CONFIG_DIR
|
||||
|
||||
# Create config file with default settings
|
||||
echo '{
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Host=localhost;Database='$DB_NAME';Username='$DB_USER';Password='$DB_PASSWORD'"
|
||||
"Transmission": {
|
||||
"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"
|
||||
|
||||
# Set proper permissions
|
||||
chown -R postgres:postgres "$CONFIG_DIR"
|
||||
chmod 750 "$CONFIG_DIR"
|
||||
chmod 640 "$CONFIG_DIR/appsettings.json"
|
||||
chown -R root:root "$CONFIG_DIR"
|
||||
chmod 755 "$CONFIG_DIR"
|
||||
chmod 644 "$CONFIG_DIR/appsettings.json"
|
||||
|
||||
# Build and deploy the application
|
||||
print_section "Building application"
|
||||
@ -164,10 +155,9 @@ dotnet publish -c Release -o $INSTALL_DIR/publish
|
||||
# Copy configuration
|
||||
cp "$CONFIG_DIR/appsettings.json" "$INSTALL_DIR/publish/appsettings.json"
|
||||
|
||||
# Run migrations
|
||||
print_section "Running database migrations"
|
||||
cd "$PROJECT_DIR"
|
||||
dotnet ef database update
|
||||
# No database migrations needed in simplified version
|
||||
print_section "Configuration completed"
|
||||
echo "No database migrations needed in simplified version."
|
||||
|
||||
# Create systemd service
|
||||
print_section "Creating systemd service"
|
||||
|
Loading…
x
Reference in New Issue
Block a user