api working
This commit is contained in:
Binary file not shown.
+1
-1
@@ -4,5 +4,5 @@ cmd="$*"
|
|||||||
|
|
||||||
echo "Running on hosts: $cmd"
|
echo "Running on hosts: $cmd"
|
||||||
|
|
||||||
pssh -h "$hosts_file" "$cmd"
|
pssh -h "$hosts_file" -t 0 "$cmd"
|
||||||
|
|
||||||
|
|||||||
Regular → Executable
Regular → Executable
+13
-13
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
# ========= CONFIG =========
|
# ========= CONFIG =========
|
||||||
API_KEY="your-secret-api-key"
|
API_KEY="your-secret-api-key"
|
||||||
BASE_URL="http://localhost:8888"
|
BASE_URL="https://dev.local"
|
||||||
CONTAINER_ID="123e4567-e89b-12d3-a456-426614174000" # sample UUID
|
CONTAINER_ID="123e4567-e89b-12d3-a456-426614174000" # sample UUID
|
||||||
# ==========================
|
# ==========================
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ root_redirect() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
update_container() {
|
update_container() {
|
||||||
curl -X POST "$BASE_URL/container/update" \
|
curl -k -X POST "$BASE_URL/container/update" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-H "X-API-Key: $API_KEY" \
|
-H "X-API-Key: $API_KEY" \
|
||||||
-d '{
|
-d '{
|
||||||
@@ -29,71 +29,71 @@ update_container() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
start_container() {
|
start_container() {
|
||||||
curl -X POST "$BASE_URL/container/start" \
|
curl -k -X POST "$BASE_URL/container/start" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-H "X-API-Key: $API_KEY" \
|
-H "X-API-Key: $API_KEY" \
|
||||||
-d '{ "container_id": "'"$CONTAINER_ID"'" }'
|
-d '{ "container_id": "'"$CONTAINER_ID"'" }'
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_container() {
|
stop_container() {
|
||||||
curl -X POST "$BASE_URL/container/stop" \
|
curl -k -X POST "$BASE_URL/container/stop" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-H "X-API-Key: $API_KEY" \
|
-H "X-API-Key: $API_KEY" \
|
||||||
-d '{ "container_id": "'"$CONTAINER_ID"'" }'
|
-d '{ "container_id": "'"$CONTAINER_ID"'" }'
|
||||||
}
|
}
|
||||||
|
|
||||||
nuke_container() {
|
nuke_container() {
|
||||||
curl -X POST "$BASE_URL/container/nuke" \
|
curl -k -X POST "$BASE_URL/container/nuke" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-H "X-API-Key: $API_KEY" \
|
-H "X-API-Key: $API_KEY" \
|
||||||
-d '{ "container_id": "'"$CONTAINER_ID"'" }'
|
-d '{ "container_id": "'"$CONTAINER_ID"'" }'
|
||||||
}
|
}
|
||||||
|
|
||||||
info_all() {
|
info_all() {
|
||||||
curl -X POST "$BASE_URL/container/info" \
|
curl -k -X POST "$BASE_URL/container/info" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-H "X-API-Key: $API_KEY" \
|
-H "X-API-Key: $API_KEY" \
|
||||||
-d '{}'
|
-d '{}'
|
||||||
}
|
}
|
||||||
|
|
||||||
info_one() {
|
info_one() {
|
||||||
curl -X POST "$BASE_URL/container/info" \
|
curl -k -X POST "$BASE_URL/container/info" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-H "X-API-Key: $API_KEY" \
|
-H "X-API-Key: $API_KEY" \
|
||||||
-d '{ "container_id": "'"$CONTAINER_ID"'" }'
|
-d '{ "container_id": "'"$CONTAINER_ID"'" }'
|
||||||
}
|
}
|
||||||
|
|
||||||
bump_container() {
|
bump_container() {
|
||||||
curl -X POST "$BASE_URL/container/bump" \
|
curl -k -X POST "$BASE_URL/container/bump" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-H "X-API-Key: $API_KEY" \
|
-H "X-API-Key: $API_KEY" \
|
||||||
-d '{ "container_id": "'"$CONTAINER_ID"'" }'
|
-d '{ "container_id": "'"$CONTAINER_ID"'" }'
|
||||||
}
|
}
|
||||||
|
|
||||||
container_quota() {
|
container_quota() {
|
||||||
curl -X POST "$BASE_URL/container/quota" \
|
curl -k -X POST "$BASE_URL/container/quota" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-H "X-API-Key: $API_KEY" \
|
-H "X-API-Key: $API_KEY" \
|
||||||
-d '{ "container_id": "'"$CONTAINER_ID"'" }'
|
-d '{ "container_id": "'"$CONTAINER_ID"'" }'
|
||||||
}
|
}
|
||||||
|
|
||||||
system_containers() {
|
system_containers() {
|
||||||
curl -X GET "$BASE_URL/system/containers" \
|
curl -k -X GET "$BASE_URL/system/containers" \
|
||||||
-H "X-API-Key: $API_KEY"
|
-H "X-API-Key: $API_KEY"
|
||||||
}
|
}
|
||||||
|
|
||||||
system_images() {
|
system_images() {
|
||||||
curl -X GET "$BASE_URL/system/images" \
|
curl -k -X GET "$BASE_URL/system/images" \
|
||||||
-H "X-API-Key: $API_KEY"
|
-H "X-API-Key: $API_KEY"
|
||||||
}
|
}
|
||||||
|
|
||||||
system_info() {
|
system_info() {
|
||||||
curl -X GET "$BASE_URL/system/info" \
|
curl -k -X GET "$BASE_URL/system/info" \
|
||||||
-H "X-API-Key: $API_KEY"
|
-H "X-API-Key: $API_KEY"
|
||||||
}
|
}
|
||||||
|
|
||||||
system_pull() {
|
system_pull() {
|
||||||
curl -X POST "$BASE_URL/system/pull" \
|
curl -k -X POST "$BASE_URL/system/pull" \
|
||||||
-H "X-API-Key: $API_KEY"
|
-H "X-API-Key: $API_KEY"
|
||||||
}
|
}
|
||||||
|
|
||||||
+1
-1
@@ -26,7 +26,7 @@ prsync -h "$hosts_file" -avz ./sbin/ /4server/sbin/
|
|||||||
template templates/4server /etc/4server
|
template templates/4server /etc/4server
|
||||||
|
|
||||||
#INSTALL API SERVICE
|
#INSTALL API SERVICE
|
||||||
template templates/init.d/4server-api /etc/init.d/4server-api:
|
template templates/init.d/4server-api /etc/init.d/4server-api
|
||||||
rex doas chmod 0755 /etc/init.d/4server-api
|
rex doas chmod 0755 /etc/init.d/4server-api
|
||||||
rex doas chown root:root /etc/init.d/4server-api
|
rex doas chown root:root /etc/init.d/4server-api
|
||||||
rex doas rc-update add 4server-api default
|
rex doas rc-update add 4server-api default
|
||||||
|
|||||||
Reference in New Issue
Block a user