added helper scrip for vault installation in dev env

This commit is contained in:
tdv
2025-10-30 16:54:22 +02:00
parent e92194f739
commit d0cece3001
4 changed files with 96 additions and 35 deletions

72
certs/vault_install.sh Normal file
View File

@@ -0,0 +1,72 @@
#!/usr/bin/env bash
# -------------------------------------------------------
# HashiCorp Vault Installation and Configuration Script
# -------------------------------------------------------
set -e
# -------------------------------------------------------
# 1. Install Vault
# -------------------------------------------------------
# yum install -y yum-utils
# yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
# yum -y install vault
# echo "[+] Vault installed successfully."
# -------------------------------------------------------
# 2. Create directories and set permissions
# -------------------------------------------------------
useradd --system --home /opt/vault --shell /bin/false vault
mkdir -p /opt/vault/data
chown -R vault:vault /opt/vault
mkdir -p /etc/vault
chown -R vault:vault /etc/vault
echo "[+] Directories and permissions set."
# -------------------------------------------------------
# 3. Create Vault configuration file
# -------------------------------------------------------
cat > /etc/vault/config.hcl <<'EOF'
storage "file" {
path = "/opt/vault/data"
}
listener "tcp" {
address = "127.0.0.1:8200"
tls_disable = 1
}
disable_mlock = true
ui = true
EOF
echo "[+] Vault configuration file created at /etc/vault/config.hcl."
# -------------------------------------------------------
# 4. Create systemd service file
# -------------------------------------------------------
cat > /etc/systemd/system/vault.service <<'EOF'
[Unit]
Description=HashiCorp Vault
After=network-online.target
Wants=network-online.target
[Service]
User=vault
Group=vault
ExecStart=/usr/bin/vault server -config=/etc/vault/config.hcl
Restart=on-failure
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
EOF
echo "[+] Vault systemd service file created at /etc/systemd/system/vault.service."
# -------------------------------------------------------
# 5. Enable and start Vault service
# -------------------------------------------------------
restorecon -v /usr/bin/vault
systemctl daemon-reload
systemctl enable vault
systemctl start vault
echo "[+] Vault service started and enabled."
# -------------------------------------------------------
# 6. Final status
# -------------------------------------------------------
systemctl --no-pager status vault | grep "Active:" || echo "[+] Vault service may need manual check."

View File

@@ -37,18 +37,16 @@ const minWidthClass = props.minTableWidth ?? 'min-w-[1100px]' // tweak as needed
</script> </script>
<template> <template>
<div class="w-full h-full border rounded-md flex flex-col"> <!-- Parent must not rely on h-full; use overflow-hidden to contain scrollbars -->
<!-- Both-direction scroll area --> <div class="w-full max-h-full border rounded-md flex flex-col overflow-hidden">
<ScrollArea class="flex-1 w-full"> <!-- This element grows and can scroll internally -->
<!-- The min-width container enables horizontal scroll on small displays --> <ScrollArea class="flex-1 min-h-0 w-full">
<!-- min-width keeps horizontal scroll available when needed -->
<div :class="['w-full', minWidthClass]"> <div :class="['w-full', minWidthClass]">
<Table class="w-full"> <!-- separate borders help sticky headers render above rows -->
<!-- header --> <Table class="w-full border-separate border-spacing-0">
<TableHeader> <TableHeader>
<TableRow <TableRow v-for="headerGroup in table.getHeaderGroups()" :key="headerGroup.id">
v-for="headerGroup in table.getHeaderGroups()"
:key="headerGroup.id"
>
<TableHead <TableHead
v-for="header in headerGroup.headers" v-for="header in headerGroup.headers"
:key="header.id" :key="header.id"
@@ -60,8 +58,6 @@ const minWidthClass = props.minTableWidth ?? 'min-w-[1100px]' // tweak as needed
:props="header.getContext()" :props="header.getContext()"
/> />
</TableHead> </TableHead>
<!-- extra empty head for dropdown column -->
<TableHead <TableHead
v-if="props.dropdownComponent" v-if="props.dropdownComponent"
class="sticky top-0 bg-background z-10 w-12" class="sticky top-0 bg-background z-10 w-12"
@@ -69,7 +65,6 @@ const minWidthClass = props.minTableWidth ?? 'min-w-[1100px]' // tweak as needed
</TableRow> </TableRow>
</TableHeader> </TableHeader>
<!-- body -->
<TableBody> <TableBody>
<template v-if="table.getRowModel().rows.length"> <template v-if="table.getRowModel().rows.length">
<TableRow <TableRow
@@ -77,18 +72,10 @@ const minWidthClass = props.minTableWidth ?? 'min-w-[1100px]' // tweak as needed
:key="row.id" :key="row.id"
class="whitespace-nowrap" class="whitespace-nowrap"
> >
<!-- data cells --> <TableCell v-for="cell in row.getVisibleCells()" :key="cell.id">
<TableCell <FlexRender :render="cell.column.columnDef.cell" :props="cell.getContext()" />
v-for="cell in row.getVisibleCells()"
:key="cell.id"
>
<FlexRender
:render="cell.column.columnDef.cell"
:props="cell.getContext()"
/>
</TableCell> </TableCell>
<!-- dropdown cell -->
<TableCell v-if="props.dropdownComponent" class="text-right"> <TableCell v-if="props.dropdownComponent" class="text-right">
<component <component
:is="props.dropdownComponent" :is="props.dropdownComponent"
@@ -101,7 +88,6 @@ const minWidthClass = props.minTableWidth ?? 'min-w-[1100px]' // tweak as needed
</TableRow> </TableRow>
</template> </template>
<!-- no-data row -->
<template v-else> <template v-else>
<TableRow> <TableRow>
<TableCell <TableCell
@@ -116,9 +102,9 @@ const minWidthClass = props.minTableWidth ?? 'min-w-[1100px]' // tweak as needed
</Table> </Table>
</div> </div>
<!-- Scrollbars --> <!-- Always show both scrollbars when needed -->
<ScrollBar orientation="horizontal" /> <ScrollBar orientation="horizontal" />
<ScrollBar orientation="vertical" /> <ScrollBar orientation="vertical" />
</ScrollArea> </ScrollArea>
</div> </div>
</template> </template>

View File

@@ -59,7 +59,7 @@ function fmt(ts?: string | null) {
const task_columns: ColumnDef<TaskDto, any>[] = [ const task_columns: ColumnDef<TaskDto, any>[] = [
{ accessorKey: 'id', header: 'ID' }, { accessorKey: 'id', header: 'ID' },
// { accessorKey: 'deviceGuid', header: 'GUID' }, // { accessorKey: 'deviceGuid', header: 'GUID' },
{ accessorKey: 'type', header: 'Task' }, { accessorKey: 'type', header: 'Task' },
{ {
accessorKey: 'payload', accessorKey: 'payload',
@@ -77,9 +77,9 @@ const task_columns: ColumnDef<TaskDto, any>[] = [
const s = row.original.status const s = row.original.status
const cls = const cls =
s === 'finished' ? 'px-2 py-0.5 rounded text-xs text-green-700 bg-green-100' s === 'finished' ? 'px-2 py-0.5 rounded text-xs text-green-700 bg-green-100'
: s === 'running' ? 'px-2 py-0.5 rounded text-xs text-blue-700 bg-blue-100' : s === 'running' ? 'px-2 py-0.5 rounded text-xs text-blue-700 bg-blue-100'
: s === 'error' ? 'px-2 py-0.5 rounded text-xs text-red-700 bg-red-100' : s === 'error' ? 'px-2 py-0.5 rounded text-xs text-red-700 bg-red-100'
: 'px-2 py-0.5 rounded text-xs text-amber-700 bg-amber-100' : 'px-2 py-0.5 rounded text-xs text-amber-700 bg-amber-100'
return h('span', { class: cls }, s) return h('span', { class: cls }, s)
}, },
}, },
@@ -100,7 +100,7 @@ const task_columns: ColumnDef<TaskDto, any>[] = [
<template> <template>
<Dialog :open="props.modelValue" @update:open="(v: boolean) => emit('update:modelValue', v)"> <Dialog :open="props.modelValue" @update:open="(v: boolean) => emit('update:modelValue', v)">
<DialogContent class="sm:min-w-[1000px]"> <DialogContent class="sm:min-w-[1200px] max-h-[80vh] p-0 flex flex-col">
<DialogHeader class="flex flex-row items-center justify-between gap-4"> <DialogHeader class="flex flex-row items-center justify-between gap-4">
<div> <div>
<DialogTitle>Tasks</DialogTitle> <DialogTitle>Tasks</DialogTitle>
@@ -119,7 +119,10 @@ const task_columns: ColumnDef<TaskDto, any>[] = [
Loading tasks Loading tasks
</div> </div>
<div v-else> <div v-else>
<DataTableNoCheckboxScroll :columns="task_columns" :data="tasks" minTableWidth="min-w-[800px]"/> <!-- SCROLLABLE MIDDLE: flex-1 + min-h-0 so child can overflow -->
<div class="flex-1 min-h-0 px-6 pb-4">
<DataTableNoCheckboxScroll :columns="task_columns" :data="tasks" minTableWidth="min-w-[800px]" />
</div>
</div> </div>
<DialogFooter> <DialogFooter>

View File

@@ -20,10 +20,10 @@ vault kv put kv/snoop \
minio_presign_ttl_seconds="900" minio_presign_ttl_seconds="900"
``` ```
Unseal Key 1: XdERN+/hxR9RjLC/S8c+y0omToYvB7Qs1jaUenZQvphD Unseal Key 1: AMLVUGoP2hlEd02nWWghAiVYT4jtiXv50WsZyQ2MbpP/
Unseal Key 2: VBhPBtYcq1GAk7ByPfAsamxV4tJOZ49chAYxxOvc49Oj Unseal Key 2: OtaDsNoGE2EF6UfrQUkU0NoDVxPK/KwBFg9cUfQuhBs+
Initial Root Token: hvs.tZ4eh9P18sCZ5c1PZIz59EmH Initial Root Token: hvs.rKzgIc5aaucOCtlJNsUdZuEH
{ {