Compare commits
11 Commits
v1.1.0
...
1ae54a46e7
| Author | SHA1 | Date | |
|---|---|---|---|
| 1ae54a46e7 | |||
| 918fe80566 | |||
| 073a392f19 | |||
| 703ab3b07d | |||
| b2cc478c85 | |||
| ac90952499 | |||
| dcea388b6f | |||
| 2b91c19afb | |||
| bac62a1577 | |||
| c39b51c070 | |||
| dbdeacdf7d |
@@ -8,6 +8,7 @@ on:
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
release-please:
|
||||
@@ -61,7 +62,7 @@ jobs:
|
||||
name: Deploy to Kubernetes
|
||||
needs: release-please
|
||||
if: ${{ needs.release-please.outputs.release_created }}
|
||||
runs-on: [ k3s-lan-01 ]
|
||||
runs-on: [ k3s-internal-htz-01 ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
".": "1.1.0"
|
||||
".": "1.2.0"
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,26 @@
|
||||
# Changelog
|
||||
|
||||
## [1.2.0](https://github.com/JDB-NET/opnsense-sftp/compare/v1.1.2...v1.2.0) (2025-11-01)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* :sparkles: latest backup api endpoint - /api/backups/latest ([703ab3b](https://github.com/JDB-NET/opnsense-sftp/commit/703ab3b07da0b60f91d674fd6f4a39d3c45ae1e6))
|
||||
|
||||
## [1.1.2](https://github.com/JDB-NET/opnsense-sftp/compare/v1.1.1...v1.1.2) (2025-11-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* :bug: k3s character limit ([2b91c19](https://github.com/JDB-NET/opnsense-sftp/commit/2b91c19afbf95f9192b43b46ebdc7816bb407db9))
|
||||
|
||||
## [1.1.1](https://github.com/JDB-NET/opnsense-sftp/compare/v1.1.0...v1.1.1) (2025-11-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* :bug: allow writing packages ([dbdeacd](https://github.com/JDB-NET/opnsense-sftp/commit/dbdeacdf7de133a0db4c44c13828458ff08a028a))
|
||||
|
||||
## [1.1.0](https://github.com/JDB-NET/opnsense-sftp/compare/v1.0.0...v1.1.0) (2025-11-01)
|
||||
|
||||
|
||||
|
||||
@@ -342,6 +342,23 @@ def delete_backup(backup_id):
|
||||
return redirect(url_for('backups'))
|
||||
|
||||
|
||||
@app.route('/api/backups/latest')
|
||||
def api_latest_backups():
|
||||
"""API endpoint to get the latest backup date and time for each instance."""
|
||||
latest_backups = db.get_latest_backup_per_instance()
|
||||
|
||||
# Format the response
|
||||
result = []
|
||||
for item in latest_backups:
|
||||
result.append({
|
||||
'instance_id': item['instance_id'],
|
||||
'instance_name': item['instance_name'],
|
||||
'latest_backup': item['latest_backup'].isoformat() if item['latest_backup'] else None
|
||||
})
|
||||
|
||||
return jsonify(result)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host='0.0.0.0', port=5000, debug=True)
|
||||
|
||||
|
||||
+23
@@ -279,4 +279,27 @@ class Database:
|
||||
except Error as e:
|
||||
logger.error(f"Error getting instance by ID: {e}")
|
||||
return None
|
||||
|
||||
def get_latest_backup_per_instance(self) -> List[Dict[str, Any]]:
|
||||
"""Get the latest backup date and time for each instance."""
|
||||
try:
|
||||
with self.get_connection() as conn:
|
||||
cursor = conn.cursor(dictionary=True)
|
||||
cursor.execute("""
|
||||
SELECT
|
||||
o.id as instance_id,
|
||||
o.name as instance_name,
|
||||
o.identifier as instance_identifier,
|
||||
MAX(b.uploaded_at) as latest_backup
|
||||
FROM opnsense_instances o
|
||||
LEFT JOIN backups b ON o.id = b.instance_id
|
||||
GROUP BY o.id, o.name, o.identifier
|
||||
ORDER BY o.name
|
||||
""")
|
||||
results = cursor.fetchall()
|
||||
cursor.close()
|
||||
return results
|
||||
except Error as e:
|
||||
logger.error(f"Error getting latest backup per instance: {e}")
|
||||
return []
|
||||
|
||||
|
||||
+11
-11
@@ -19,12 +19,12 @@ spec:
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 5000
|
||||
name: "opnsense-sftp"
|
||||
name: "opnsense-web"
|
||||
- containerPort: 2222
|
||||
name: "opnsense-sftp-sftp"
|
||||
name: "opnsense-sftp"
|
||||
env:
|
||||
- name: DB_HOST
|
||||
value: "10.10.2.27"
|
||||
value: "10.10.25.4"
|
||||
- name: DB_PORT
|
||||
value: "3306"
|
||||
- name: DB_NAME
|
||||
@@ -38,7 +38,7 @@ spec:
|
||||
- name: ADMIN_PASSWORD
|
||||
value: "CVk7QKIB3MjZ8mt6MxES"
|
||||
- name: SFTP_PUBLIC_HOST
|
||||
value: "10.10.2.29"
|
||||
value: "10.10.25.8"
|
||||
- name: SFTP_PUBLIC_PORT
|
||||
value: "30222"
|
||||
volumeMounts:
|
||||
@@ -49,17 +49,17 @@ spec:
|
||||
volumes:
|
||||
- name: keys-volume
|
||||
nfs:
|
||||
server: 10.10.2.5
|
||||
path: /srv/Backups/OPNsense/keys
|
||||
server: 10.10.25.2
|
||||
path: /srv/k3s/opnsense/keys
|
||||
- name: backups-volume
|
||||
nfs:
|
||||
server: 10.10.2.5
|
||||
path: /srv/Backups/OPNsense/backups
|
||||
server: 10.10.25.2
|
||||
path: /srv/k3s/opnsense/backups
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: opnsense-sftp-ingress-service
|
||||
name: opnsense-web-ingress-service
|
||||
namespace: opnsense-sftp
|
||||
spec:
|
||||
selector:
|
||||
@@ -73,7 +73,7 @@ spec:
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: opnsense-sftp-sftp-service
|
||||
name: opnsense-sftp-service
|
||||
namespace: opnsense-sftp
|
||||
spec:
|
||||
type: NodePort
|
||||
@@ -100,7 +100,7 @@ spec:
|
||||
path: "/"
|
||||
backend:
|
||||
service:
|
||||
name: opnsense-sftp-ingress-service
|
||||
name: opnsense-web-ingress-service
|
||||
port:
|
||||
number: 80
|
||||
---
|
||||
@@ -42,18 +42,11 @@
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
class="w-full bg-orange-500 hover:bg-orange-600 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200"
|
||||
>
|
||||
class="w-full bg-orange-500 hover:bg-orange-600 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200 hover:cursor-pointer">
|
||||
Sign In
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<div class="mt-6 p-4 bg-neutral-700 rounded-md">
|
||||
<p class="text-xs text-neutral-400">
|
||||
Default credentials: <code class="text-orange-400">admin / admin</code>
|
||||
<br>Please change these after first login!
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user