From 962d2097adde8f690ef9768231122ede732a3681 Mon Sep 17 00:00:00 2001 From: OsCoder Date: Fri, 11 Sep 2026 15:48:53 +0200 Subject: Initial Commit with podman scripts --- .gitignore | 1 + Cargo.lock | 7 +++++++ Cargo.toml | 6 ++++++ scripts/insert-test-data.sh | 6 ++++++ scripts/start-db.sh | 16 ++++++++++++++++ scripts/stop-db.sh | 3 +++ src/main.rs | 3 +++ 7 files changed, 42 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100755 scripts/insert-test-data.sh create mode 100755 scripts/start-db.sh create mode 100755 scripts/stop-db.sh create mode 100644 src/main.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..c88cf7f --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "postgres_browser" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..af6c894 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "postgres_browser" +version = "0.1.0" +edition = "2024" + +[dependencies] diff --git a/scripts/insert-test-data.sh b/scripts/insert-test-data.sh new file mode 100755 index 0000000..b817cce --- /dev/null +++ b/scripts/insert-test-data.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -euo pipefail + +podman exec -it pg-postgres-browser psql -U postgres -d testdb -c \ + "CREATE TABLE clients (id serial PRIMARY KEY, label text, city text); + INSERT INTO clients (label, city) VALUES ('Anna Schmidt', 'Kiel'), ('Ben Weber', 'Flensburg');" \ No newline at end of file diff --git a/scripts/start-db.sh b/scripts/start-db.sh new file mode 100755 index 0000000..d46e5f5 --- /dev/null +++ b/scripts/start-db.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -euo pipefail + +CONTAINER_NAME="pg-postgres-browser" + +if podman ps -a --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then + echo "Container existiert bereits, starte neu..." + podman start "${CONTAINER_NAME}" +else + echo "Erstelle neuen Container..." + podman run -d --name "${CONTAINER_NAME}" \ + -e POSTGRES_PASSWORD=test \ + -e POSTGRES_DB=testdb \ + -p 5432:5432 \ + postgres:latest +fi \ No newline at end of file diff --git a/scripts/stop-db.sh b/scripts/stop-db.sh new file mode 100755 index 0000000..1c6b0af --- /dev/null +++ b/scripts/stop-db.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -euo pipefail +podman stop pg-postgres-browser \ No newline at end of file diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} -- cgit v1.2.3