mirror of
https://github.com/Websoft9/websoft9.git
synced 2025-02-03 01:28:39 +08:00
websoft9
This commit is contained in:
parent
50f251fae3
commit
e000548204
@ -3,7 +3,7 @@ APP_VERSION=1.20.4
|
||||
# port, APP_PORT is need at leaset
|
||||
APP_HTTP_PORT=3000
|
||||
APP_NETWORK=websoft9
|
||||
APP_URL=example
|
||||
APP_URL=gitea.example.com
|
||||
|
||||
INSTALL_LOCK=true
|
||||
DISABLE_SSH=true
|
||||
|
@ -7,7 +7,7 @@ version: '3.8'
|
||||
services:
|
||||
gitea:
|
||||
container_name: $APP_NAME
|
||||
image: websoft9dev/portainer:1.20.4
|
||||
image: websoft9dev/gitea:1.20.4
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
|
@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Create admin credential by admin cli
|
||||
su -c '
|
||||
gitea admin user create --admin --username websoft9 --random-password --email help@websoft9.com > /tmp/credential
|
||||
' git
|
||||
|
||||
# Read credential from tmp
|
||||
username=$(grep -o "New user '[^']*" /tmp/credential | sed "s/New user '//")
|
||||
password=$(grep -o "generated random password is '[^']*" /tmp/credential | sed "s/generated random password is '//")
|
||||
# Create template credential
|
||||
json="{\"username\":\"$username\",\"password\":\"$password\"}"
|
||||
# Save to json
|
||||
filename="/credential"
|
||||
echo "$json" > "$filename"
|
||||
|
||||
# Config webhook url at Gitea admin
|
||||
|
||||
# Gitea API URL
|
||||
api_url="http://localhost:3000/api/v1"
|
||||
hook_url="http://gitea:8080"
|
||||
|
||||
# 创建新hook的数据
|
||||
hook_data='{
|
||||
"type": "gitea",
|
||||
"config": {
|
||||
"url": "'"$hook_url"'",
|
||||
"content_type": "json"
|
||||
},
|
||||
"events": ["push"],
|
||||
"active": true
|
||||
}'
|
||||
|
||||
# 从JSON文件中读取用户名和密码
|
||||
username=$(jq -r '.username' "$filename")
|
||||
password=$(jq -r '.password' "$filename")
|
||||
|
||||
# 发送POST请求创建新hook
|
||||
response=$(curl -s -u "$username:$password" -X POST -H "Content-Type: application/json" -d "$hook_data" "$api_url/user/hooks")
|
||||
|
||||
# 检查响应状态码
|
||||
status_code=$(echo "$response" | jq -r '.status')
|
||||
if [[ $status_code == "ok" ]]; then
|
||||
echo "New hook created successfully."
|
||||
else
|
||||
error_message=$(echo "$response" | jq -r '.message')
|
||||
echo "Failed to create new hook: $error_message"
|
||||
fi
|
||||
|
3
docker/w9portainer/README.md
Normal file
3
docker/w9portainer/README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# Readme
|
||||
|
||||
- create local endpoint and lock
|
Loading…
Reference in New Issue
Block a user