Compare commits

..

1 Commits

Author SHA1 Message Date
push-app-to-main[bot]
81ca9cdcb9 Add hammer (ct) 2026-09-11 06:43:39 +00:00
5 changed files with 126 additions and 94 deletions

View File

@@ -5,17 +5,17 @@ source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_
# Copyright (c) 2021-2026 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://www.elastic.co/elasticsearch
# Source: https://github.com/Darkrock-Studios/hammer-editor
APP="Elasticsearch"
var_tags="${var_tags:-database;search}"
APP="Hammer"
var_tags="${var_tags:-writing;sync-server}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-4096}"
var_disk="${var_disk:-20}"
var_ram="${var_ram:-2048}"
var_disk="${var_disk:-8}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
#var_arm64="${var_arm64:-no}" # unset = ask the user; set yes/no only when verified
var_unprivileged="${var_unprivileged:-1}"
var_arm64="${var_arm64:-yes}"
header_info "$APP"
variables
@@ -27,20 +27,24 @@ function update_script() {
check_container_storage
check_container_resources
if [[ ! -f /etc/elasticsearch/elasticsearch.yml ]]; then
if [[ ! -d /opt/hammer ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
msg_info "Updating ${APP}"
$STD apt update
$STD apt install -y elasticsearch
msg_ok "Updated ${APP}"
if check_for_gh_release "hammer" "Darkrock-Studios/hammer-editor"; then
msg_info "Stopping Service"
systemctl stop hammer
msg_ok "Stopped Service"
msg_info "Restarting Service"
systemctl restart elasticsearch
msg_ok "Restarted Service"
msg_ok "Updated successfully!"
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "hammer" "Darkrock-Studios/hammer-editor" "prebuild" "latest" "/opt/hammer" "server.zip"
chmod +x /opt/hammer/bin/server
msg_info "Starting Service"
systemctl start hammer
msg_ok "Started Service"
msg_ok "Updated successfully!"
fi
exit
}
@@ -51,6 +55,4 @@ description
msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW}Access it using the following URL:${CL}"
echo -e "${GATEWAY}${BGN}http://${IP}:9200${CL}"
echo -e "${INFO}${YW}Set the password for the 'elastic' user:${CL}"
echo -e "${TAB}${DEFAULT}${BGN}/usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic${CL}"
echo -e "${GATEWAY}${BGN}http://${IP}:8080${CL}"

View File

@@ -1,6 +0,0 @@
________ __ _ __
/ ____/ /___ ______/ /_(_)____________ ____ ___________/ /_
/ __/ / / __ `/ ___/ __/ / ___/ ___/ _ \/ __ `/ ___/ ___/ __ \
/ /___/ / /_/ (__ ) /_/ / /__(__ ) __/ /_/ / / / /__/ / / /
/_____/_/\__,_/____/\__/_/\___/____/\___/\__,_/_/ \___/_/ /_/

6
ct/headers/hammer Normal file
View File

@@ -0,0 +1,6 @@
__ __
/ / / /___ _____ ___ ____ ___ ___ _____
/ /_/ / __ `/ __ `__ \/ __ `__ \/ _ \/ ___/
/ __ / /_/ / / / / / / / / / / / __/ /
/_/ /_/\__,_/_/ /_/ /_/_/ /_/ /_/\___/_/

View File

@@ -1,70 +0,0 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://www.elastic.co/elasticsearch
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
# vm.max_map_count is not namespaced, so a container cannot raise it - the value
# is inherited from the Proxmox host. Elasticsearch refuses to start below the
# required limit once it binds to a non-loopback address (production mode).
msg_info "Checking Kernel Limits"
if (($(sysctl -n vm.max_map_count) < 262144)); then
msg_error "vm.max_map_count is $(sysctl -n vm.max_map_count), Elasticsearch needs at least 262144"
msg_error "Set it on the PROXMOX HOST, not in this container:"
msg_error " echo 'vm.max_map_count=1048576' >/etc/sysctl.d/99-elasticsearch.conf && sysctl --system"
exit 1
fi
msg_ok "Checked Kernel Limits"
JAVA_VERSION="21" setup_java
setup_deb822_repo \
"elasticsearch" \
"https://artifacts.elastic.co/GPG-KEY-elasticsearch" \
"https://artifacts.elastic.co/packages/9.x/apt" \
"stable" \
"main"
msg_info "Installing Elasticsearch"
$STD apt install -y elasticsearch
msg_ok "Installed Elasticsearch"
msg_info "Configuring Elasticsearch"
mkdir -p /opt/elasticsearch_data
chown -R elasticsearch:elasticsearch /opt/elasticsearch_data
cat <<EOF >/etc/elasticsearch/elasticsearch.yml
cluster.name: proxmox
node.name: ${HOSTNAME}
path.data: /opt/elasticsearch_data
path.logs: /var/log/elasticsearch
network.host: 0.0.0.0
http.port: 9200
discovery.type: single-node
xpack.security.enabled: true
xpack.security.enrollment.enabled: true
xpack.security.http.ssl.enabled: false
xpack.security.transport.ssl.enabled: false
EOF
cat <<EOF >/etc/elasticsearch/jvm.options.d/heap.options
-Xms1g
-Xmx1g
EOF
systemctl enable -q --now elasticsearch
msg_ok "Configured Elasticsearch"
motd_ssh
customize
cleanup_lxc

100
install/hammer-install.sh Normal file
View File

@@ -0,0 +1,100 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/Darkrock-Studios/hammer-editor
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt install -y \
unzip \
fontconfig \
libfreetype6
msg_ok "Installed Dependencies"
JAVA_VERSION="21" setup_java
fetch_and_deploy_gh_release "hammer" "Darkrock-Studios/hammer-editor" "prebuild" "latest" "/opt/hammer" "server.zip"
msg_info "Configuring Hammer Sync Server"
chmod +x /opt/hammer/bin/server
mkdir -p /opt/hammer_data
cat <<EOF >/opt/hammer_data/config.toml
# Hammer Sync Server configuration
# Reference: https://github.com/Darkrock-Studios/hammer-editor/blob/develop/docs/HOW-TO-RUN-A-SERVER.md
# Loaded automatically from the data directory. Apply changes with:
# systemctl restart hammer
host = "${LOCAL_IP}"
port = 8080
# Hammer clients speak https only and will not connect to plain HTTP. Either put
# a TLS reverse proxy in front of this port, or let Hammer terminate TLS itself
# with a real certificate (self-signed certs are rejected by the clients).
#
# Behind a reverse proxy on this host, restrict the plain port to loopback and
# set the URL the clients actually use:
# bindHosts = ["127.0.0.1", "::1"]
# publicUrl = "https://hammer.example.com"
#
# Hammer terminating TLS itself:
# sslPort = 443
# [sslCert]
# certChainPath = "/etc/letsencrypt/live/hammer.example.com/fullchain.pem"
# privateKeyPath = "/etc/letsencrypt/live/hammer.example.com/privkey.pem"
# forceHttps = true
# Per-page social share images. fontconfig and libfreetype6 are already installed.
# richLinkPreviews = true
# communityEnabled = true
# Storage defaults to an in-process PostgreSQL under /opt/hammer_data/pgdata.
# To use an external PostgreSQL instead:
# [storage]
# type = "remote"
# [storage.remote]
# host = "db.example.com"
# port = 5432
# database = "hammer"
# user = "hammer"
# password = "change-me"
# useSsl = true
# Regenerable render/preview caches, default <data dir>/cache.
# [cache]
# directory = "/var/tmp/hammer-cache"
# maxSizeMb = 200
EOF
cat <<EOF >/etc/systemd/system/hammer.service
[Unit]
Description=Hammer Sync Server
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=root
WorkingDirectory=/opt/hammer
Environment=SERVER_OPTS=-Duser.home=/opt
ExecStart=/opt/hammer/bin/server
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now hammer
msg_ok "Configured Hammer Sync Server"
motd_ssh
customize
cleanup_lxc