Initial commit
This commit is contained in:
commit
77d35ff965
51 changed files with 5591 additions and 0 deletions
107
Pages/Setup/Scripts.cshtml
Normal file
107
Pages/Setup/Scripts.cshtml
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
@page
|
||||
@model PlanTempusAdmin.Pages.Setup.ScriptsModel
|
||||
@{
|
||||
ViewData["Title"] = "Backup Scripts";
|
||||
}
|
||||
|
||||
<div class="page-header">
|
||||
<h1 class="page-title">Backup Scripts</h1>
|
||||
<p class="page-subtitle">Bash scripts til Forgejo repository backup</p>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
forgejo-backup.sh
|
||||
<button onclick="copyScript('bash-script')" style="float: right; background: var(--accent); color: var(--background); border: none; padding: 4px 12px; cursor: pointer; font-size: 11px;">
|
||||
Kopier
|
||||
</button>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<pre id="bash-script" style="max-height: 600px; overflow: auto;"><code class="language-bash">@Model.BashScript</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mt-2">
|
||||
<div class="card-header">Environment Konfiguration (.env)</div>
|
||||
<div class="card-body">
|
||||
<pre id="env-config"><code class="language-bash"># Forgejo Repository Backup Configuration
|
||||
|
||||
# Sti til Forgejo repositories
|
||||
FORGEJO_REPO_PATH=/var/lib/forgejo/data/forgejo-repositories
|
||||
|
||||
# Midlertidig mappe til backup filer
|
||||
BACKUP_TEMP_DIR=/tmp/forgejo-backups
|
||||
|
||||
# PostgreSQL database konfiguration
|
||||
BACKUP_DB_HOST=192.168.1.43
|
||||
BACKUP_DB_PORT=5432
|
||||
BACKUP_DB_NAME=ptadmin
|
||||
BACKUP_DB_USER=plantempus_app
|
||||
BACKUP_DB_PASSWORD=your_secure_password_here
|
||||
|
||||
# Azure Blob Storage konfiguration
|
||||
AZURE_STORAGE_ACCOUNT=storageptadmin
|
||||
AZURE_STORAGE_KEY=your_storage_key_here
|
||||
AZURE_STORAGE_CONTAINER=backups
|
||||
AZURE_STORAGE_PATH=forgejo
|
||||
|
||||
# Antal dage backup gemmes
|
||||
BACKUP_RETENTION_DAYS=30</code></pre>
|
||||
<button onclick="copyScript('env-config')" style="background: var(--accent); color: var(--background); border: none; padding: 4px 12px; cursor: pointer; font-size: 11px; margin-top: 8px;">
|
||||
Kopier .env
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mt-2">
|
||||
<div class="card-header">Cron Job Setup</div>
|
||||
<div class="card-body">
|
||||
<p>Tilføj følgende linje til crontab (<code>sudo crontab -e</code>):</p>
|
||||
<pre id="cron-config"><code># Kører backup hver dag kl. 02:00
|
||||
0 2 * * * /opt/backup/forgejo-backup.sh >> /var/log/forgejo-backup.log 2>&1</code></pre>
|
||||
<button onclick="copyScript('cron-config')" style="background: var(--accent); color: var(--background); border: none; padding: 4px 12px; cursor: pointer; font-size: 11px; margin-top: 8px;">
|
||||
Kopier cron
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mt-2">
|
||||
<div class="card-header">Azure CLI Setup</div>
|
||||
<div class="card-body">
|
||||
<p>Installer Azure CLI på serveren:</p>
|
||||
<pre><code class="language-bash"># Installer Azure CLI (Ubuntu/Debian)
|
||||
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
|
||||
|
||||
# Verificer installation
|
||||
az --version
|
||||
|
||||
# Test forbindelse til storage account
|
||||
az storage container list \
|
||||
--account-name storageptadmin \
|
||||
--account-key "YOUR_KEY_HERE" \
|
||||
--output table
|
||||
|
||||
# Test upload
|
||||
echo "test" > /tmp/test.txt
|
||||
az storage blob upload \
|
||||
--account-name storageptadmin \
|
||||
--account-key "YOUR_KEY_HERE" \
|
||||
--container-name backups \
|
||||
--file /tmp/test.txt \
|
||||
--name test/test.txt</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
<script>
|
||||
function copyScript(elementId) {
|
||||
const element = document.getElementById(elementId);
|
||||
const text = element.textContent || element.innerText;
|
||||
navigator.clipboard.writeText(text).then(() => {
|
||||
alert('Kopieret til udklipsholder!');
|
||||
}).catch(err => {
|
||||
console.error('Kunne ikke kopiere:', err);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue