added helper scrip for vault installation in dev env
This commit is contained in:
72
certs/vault_install.sh
Normal file
72
certs/vault_install.sh
Normal 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."
|
||||
@@ -37,18 +37,16 @@ const minWidthClass = props.minTableWidth ?? 'min-w-[1100px]' // tweak as needed
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="w-full h-full border rounded-md flex flex-col">
|
||||
<!-- Both-direction scroll area -->
|
||||
<ScrollArea class="flex-1 w-full">
|
||||
<!-- The min-width container enables horizontal scroll on small displays -->
|
||||
<!-- Parent must not rely on h-full; use overflow-hidden to contain scrollbars -->
|
||||
<div class="w-full max-h-full border rounded-md flex flex-col overflow-hidden">
|
||||
<!-- This element grows and can scroll internally -->
|
||||
<ScrollArea class="flex-1 min-h-0 w-full">
|
||||
<!-- min-width keeps horizontal scroll available when needed -->
|
||||
<div :class="['w-full', minWidthClass]">
|
||||
<Table class="w-full">
|
||||
<!-- header -->
|
||||
<!-- separate borders help sticky headers render above rows -->
|
||||
<Table class="w-full border-separate border-spacing-0">
|
||||
<TableHeader>
|
||||
<TableRow
|
||||
v-for="headerGroup in table.getHeaderGroups()"
|
||||
:key="headerGroup.id"
|
||||
>
|
||||
<TableRow v-for="headerGroup in table.getHeaderGroups()" :key="headerGroup.id">
|
||||
<TableHead
|
||||
v-for="header in headerGroup.headers"
|
||||
:key="header.id"
|
||||
@@ -60,8 +58,6 @@ const minWidthClass = props.minTableWidth ?? 'min-w-[1100px]' // tweak as needed
|
||||
:props="header.getContext()"
|
||||
/>
|
||||
</TableHead>
|
||||
|
||||
<!-- extra empty head for dropdown column -->
|
||||
<TableHead
|
||||
v-if="props.dropdownComponent"
|
||||
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>
|
||||
</TableHeader>
|
||||
|
||||
<!-- body -->
|
||||
<TableBody>
|
||||
<template v-if="table.getRowModel().rows.length">
|
||||
<TableRow
|
||||
@@ -77,18 +72,10 @@ const minWidthClass = props.minTableWidth ?? 'min-w-[1100px]' // tweak as needed
|
||||
:key="row.id"
|
||||
class="whitespace-nowrap"
|
||||
>
|
||||
<!-- data cells -->
|
||||
<TableCell
|
||||
v-for="cell in row.getVisibleCells()"
|
||||
:key="cell.id"
|
||||
>
|
||||
<FlexRender
|
||||
:render="cell.column.columnDef.cell"
|
||||
:props="cell.getContext()"
|
||||
/>
|
||||
<TableCell v-for="cell in row.getVisibleCells()" :key="cell.id">
|
||||
<FlexRender :render="cell.column.columnDef.cell" :props="cell.getContext()" />
|
||||
</TableCell>
|
||||
|
||||
<!-- dropdown cell -->
|
||||
<TableCell v-if="props.dropdownComponent" class="text-right">
|
||||
<component
|
||||
:is="props.dropdownComponent"
|
||||
@@ -101,7 +88,6 @@ const minWidthClass = props.minTableWidth ?? 'min-w-[1100px]' // tweak as needed
|
||||
</TableRow>
|
||||
</template>
|
||||
|
||||
<!-- no-data row -->
|
||||
<template v-else>
|
||||
<TableRow>
|
||||
<TableCell
|
||||
@@ -116,7 +102,7 @@ const minWidthClass = props.minTableWidth ?? 'min-w-[1100px]' // tweak as needed
|
||||
</Table>
|
||||
</div>
|
||||
|
||||
<!-- Scrollbars -->
|
||||
<!-- Always show both scrollbars when needed -->
|
||||
<ScrollBar orientation="horizontal" />
|
||||
<ScrollBar orientation="vertical" />
|
||||
</ScrollArea>
|
||||
|
||||
@@ -59,7 +59,7 @@ function fmt(ts?: string | null) {
|
||||
|
||||
const task_columns: ColumnDef<TaskDto, any>[] = [
|
||||
{ accessorKey: 'id', header: 'ID' },
|
||||
// { accessorKey: 'deviceGuid', header: 'GUID' },
|
||||
// { accessorKey: 'deviceGuid', header: 'GUID' },
|
||||
{ accessorKey: 'type', header: 'Task' },
|
||||
{
|
||||
accessorKey: 'payload',
|
||||
@@ -77,9 +77,9 @@ const task_columns: ColumnDef<TaskDto, any>[] = [
|
||||
const s = row.original.status
|
||||
const cls =
|
||||
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 === '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'
|
||||
: 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'
|
||||
: 'px-2 py-0.5 rounded text-xs text-amber-700 bg-amber-100'
|
||||
return h('span', { class: cls }, s)
|
||||
},
|
||||
},
|
||||
@@ -100,7 +100,7 @@ const task_columns: ColumnDef<TaskDto, any>[] = [
|
||||
|
||||
<template>
|
||||
<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">
|
||||
<div>
|
||||
<DialogTitle>Tasks</DialogTitle>
|
||||
@@ -119,7 +119,10 @@ const task_columns: ColumnDef<TaskDto, any>[] = [
|
||||
Loading tasks…
|
||||
</div>
|
||||
<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>
|
||||
|
||||
<DialogFooter>
|
||||
|
||||
@@ -20,10 +20,10 @@ vault kv put kv/snoop \
|
||||
minio_presign_ttl_seconds="900"
|
||||
```
|
||||
|
||||
Unseal Key 1: XdERN+/hxR9RjLC/S8c+y0omToYvB7Qs1jaUenZQvphD
|
||||
Unseal Key 2: VBhPBtYcq1GAk7ByPfAsamxV4tJOZ49chAYxxOvc49Oj
|
||||
Unseal Key 1: AMLVUGoP2hlEd02nWWghAiVYT4jtiXv50WsZyQ2MbpP/
|
||||
Unseal Key 2: OtaDsNoGE2EF6UfrQUkU0NoDVxPK/KwBFg9cUfQuhBs+
|
||||
|
||||
Initial Root Token: hvs.tZ4eh9P18sCZ5c1PZIz59EmH
|
||||
Initial Root Token: hvs.rKzgIc5aaucOCtlJNsUdZuEH
|
||||
|
||||
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user