mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-02 04:13:56 +08:00
🌴 Sync 2026-03-05 23:51:42
This commit is contained in:
1 parent
97c049ed0a
commit
0acff03804
14253 files changed
+3893239
No files matched your search
@@ -0,0 +1,12 @@
|
||||
config main
|
||||
option 'http_port' '9001'
|
||||
option 'config_path' ''
|
||||
option 'public_uri' 'http://localhost:9001'
|
||||
option 'redis_uri' 'redis://penpot-redis/0'
|
||||
option 'db_uri' 'postgresql://penpot-postgres/penpot'
|
||||
option 'db_name' 'penpot'
|
||||
option 'db_username' 'penpot'
|
||||
option 'db_password' 'penpot'
|
||||
option 'smtp_default_from' 'no-reply@example.com'
|
||||
option 'smtp_default_reply_to' 'no-reply@example.com'
|
||||
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
#!/bin/sh
|
||||
# Author Xiaobao(xiaobao@linkease.com)
|
||||
|
||||
ACTION=${1}
|
||||
shift 1
|
||||
|
||||
do_install() {
|
||||
local config=`uci get penpot.@main[0].config_path 2>/dev/null`
|
||||
if [ -z "$config" ]; then
|
||||
echo "config path is empty!"
|
||||
exit 1
|
||||
fi
|
||||
mkdir -p $config
|
||||
|
||||
lua /usr/libexec/istorec/penpot_template.lua penpot /usr/share/penpot/config.template.env $config/config.env
|
||||
RET=$?
|
||||
if [ ! "$RET" = "0" ]; then
|
||||
echo "convert config.env failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
lua /usr/libexec/istorec/penpot_template.lua penpot /usr/share/penpot/docker-compose.template.yaml $config/docker-compose.yaml
|
||||
RET=$?
|
||||
if [ ! "$RET" = "0" ]; then
|
||||
echo "convert config.env failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd $config
|
||||
docker-compose down || true
|
||||
docker-compose up -d
|
||||
echo "Wait 120 to intialize"
|
||||
sleep 120
|
||||
echo "Now you should create a user manually"
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo "usage: $0 sub-command"
|
||||
echo "where sub-command is one of:"
|
||||
echo " install Install the penpot"
|
||||
echo " upgrade Upgrade the penpot"
|
||||
echo " rm/start/stop/restart Remove/Start/Stop/Restart the penpot"
|
||||
echo " status Penpot status"
|
||||
echo " port Penpot port"
|
||||
}
|
||||
|
||||
case ${ACTION} in
|
||||
"install")
|
||||
do_install
|
||||
;;
|
||||
"upgrade")
|
||||
do_install
|
||||
;;
|
||||
"rm")
|
||||
config=`uci get penpot.@main[0].config_path 2>/dev/null`
|
||||
cd $config && docker-compose down
|
||||
;;
|
||||
"start" | "stop" | "restart")
|
||||
config=`uci get penpot.@main[0].config_path 2>/dev/null`
|
||||
cd $config && docker-compose ${ACTION}
|
||||
;;
|
||||
"status")
|
||||
docker ps --all -f 'name=^/penpot_penpot-frontend_1$' --format '{{.State}}'
|
||||
;;
|
||||
"port")
|
||||
uci get -q penpot.@main[0].http_port 2>/dev/null
|
||||
;;
|
||||
"create-user")
|
||||
echo docker exec -ti penpot_penpot-backend_1 ./manage.sh create-profile -u "${1}" -p "${2}" -n "${3}"
|
||||
docker exec -ti penpot_penpot-backend_1 ./manage.sh create-profile -u "${1}" -p "${2}" -n "${3}"
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,96 @@
|
||||
local util = require "luci.util"
|
||||
local tparser = require "luci.template.parser"
|
||||
local uci = require "luci.model.uci"
|
||||
local nixio = require "nixio"
|
||||
|
||||
local tostring, pairs, loadstring = tostring, pairs, loadstring
|
||||
local setmetatable, loadfile = setmetatable, loadfile
|
||||
local getfenv, setfenv, rawget = getfenv, setfenv, rawget
|
||||
local assert, type, error = assert, type, error
|
||||
|
||||
local default_ctx = {tostring = tostring}
|
||||
|
||||
local from_string = function(template)
|
||||
return Template(default_ctx, nil, template)
|
||||
end
|
||||
|
||||
local from_file = function(template_file)
|
||||
return Template(default_ctx, template_file)
|
||||
end
|
||||
|
||||
-- Template class
|
||||
Template = util.class()
|
||||
|
||||
-- Constructor - Reads and compiles the template on-demand
|
||||
function Template.__init__(self, viewns, name, template)
|
||||
if name then
|
||||
self.name = name
|
||||
else
|
||||
self.name = "[string]"
|
||||
end
|
||||
|
||||
-- Create a new namespace for this template
|
||||
self.viewns = viewns
|
||||
|
||||
-- Compile template
|
||||
local err
|
||||
local sourcefile
|
||||
|
||||
if name then
|
||||
sourcefile = name
|
||||
self.template, _, err = tparser.parse(sourcefile)
|
||||
else
|
||||
sourcefile = "[string]"
|
||||
self.template, _, err = tparser.parse_string(template)
|
||||
end
|
||||
|
||||
-- If we have no valid template throw error, otherwise cache the template
|
||||
if not self.template then
|
||||
error("Failed to load template '" .. self.name .. "'.\n" ..
|
||||
"Error while parsing template '" .. sourcefile .. "':\n" ..
|
||||
(err or "Unknown syntax error"))
|
||||
end
|
||||
end
|
||||
|
||||
-- Renders a template
|
||||
function Template.render(self, scope)
|
||||
|
||||
-- Put our predefined objects in the scope of the template
|
||||
setfenv(self.template, setmetatable({}, {__index =
|
||||
function(tbl, key)
|
||||
return rawget(tbl, key) or self.viewns[key] or scope[key]
|
||||
end}))
|
||||
|
||||
-- Now finally render the thing
|
||||
local stat, err = util.copcall(self.template)
|
||||
if not stat then
|
||||
error("Failed to execute template '" .. self.name .. "'.\n" ..
|
||||
"A runtime error occurred: " .. tostring(err or "(nil)"))
|
||||
end
|
||||
end
|
||||
|
||||
if #arg == 3 then
|
||||
local cur = uci.cursor()
|
||||
local configs = {}
|
||||
cur:foreach(arg[1], "main", function(s)
|
||||
for k, v in pairs(s) do
|
||||
configs[k] = v
|
||||
end
|
||||
end)
|
||||
if not nixio.fs.access(arg[2]) then
|
||||
print(arg[2] .. " not found")
|
||||
os.exit(10)
|
||||
end
|
||||
local target = io.open(arg[3], "w")
|
||||
if not target then
|
||||
print(arg[3] .. " can not write")
|
||||
end
|
||||
configs.write = function(data)
|
||||
target:write(data)
|
||||
end
|
||||
from_file(arg[2]):render(configs)
|
||||
target:close()
|
||||
else
|
||||
print("penpot_template.lua [appname] [template-in] [template-out]")
|
||||
end
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
## Should be set to the public domain where penpot is going to be served.
|
||||
##
|
||||
## NOTE: If you are going to serve it under different domain than
|
||||
## 'localhost' without HTTPS, consider setting the
|
||||
## `disable-secure-session-cookies' flag on the 'PENPOT_FLAGS'
|
||||
## setting.
|
||||
|
||||
PENPOT_PUBLIC_URI=<%=public_uri%>
|
||||
|
||||
## Feature flags.
|
||||
PENPOT_FLAGS=enable-registration enable-login disable-email-verification disable-secure-session-cookies
|
||||
|
||||
## Temporal workaround because of bad builtin default
|
||||
|
||||
PENPOT_HTTP_SERVER_HOST=0.0.0.0
|
||||
|
||||
## Standard database connection parameters (only postgresql is supported):
|
||||
|
||||
PENPOT_DATABASE_URI=<%=db_uri%>
|
||||
PENPOT_DATABASE_USERNAME=<%=db_username%>
|
||||
PENPOT_DATABASE_PASSWORD=<%=db_password%>
|
||||
|
||||
## Redis is used for the websockets notifications.
|
||||
|
||||
PENPOT_REDIS_URI=<%=redis_uri%>
|
||||
|
||||
## By default, files uploaded by users are stored in local
|
||||
## filesystem. But it can be configured to store in AWS S3.
|
||||
|
||||
PENPOT_ASSETS_STORAGE_BACKEND=assets-fs
|
||||
PENPOT_STORAGE_ASSETS_FS_DIRECTORY=/opt/data/assets
|
||||
|
||||
## Telemetry. When enabled, a periodical process will send anonymous
|
||||
## data about this instance. Telemetry data will enable us to learn on
|
||||
## how the application is used, based on real scenarios. If you want
|
||||
## to help us, please leave it enabled.
|
||||
|
||||
PENPOT_TELEMETRY_ENABLED=true
|
||||
|
||||
## Email sending configuration. By default, emails are printed in the
|
||||
## console, but for production usage is recommended to setup a real
|
||||
## SMTP provider. Emails are used to confirm user registrations.
|
||||
|
||||
PENPOT_SMTP_DEFAULT_FROM=<%=smtp_default_from%>
|
||||
PENPOT_SMTP_DEFAULT_REPLY_TO=<%=smtp_default_reply_to%>
|
||||
# PENPOT_SMTP_HOST=
|
||||
# PENPOT_SMTP_PORT=
|
||||
# PENPOT_SMTP_USERNAME=
|
||||
# PENPOT_SMTP_PASSWORD=
|
||||
# PENPOT_SMTP_TLS=true
|
||||
# PENPOT_SMTP_SSL=false
|
||||
|
||||
## Comma separated list of allowed domains to register. Empty to allow
|
||||
## all.
|
||||
|
||||
# PENPOT_REGISTRATION_DOMAIN_WHITELIST=""
|
||||
|
||||
## Authentication providers
|
||||
|
||||
## Google
|
||||
|
||||
# PENPOT_GOOGLE_CLIENT_ID=
|
||||
# PENPOT_GOOGLE_CLIENT_SECRET=
|
||||
|
||||
## GitHub
|
||||
|
||||
# PENPOT_GITHUB_CLIENT_ID=
|
||||
# PENPOT_GITHUB_CLIENT_SECRET=
|
||||
|
||||
## GitLab
|
||||
|
||||
# PENPOT_GITLAB_BASE_URI=https://gitlab.com
|
||||
# PENPOT_GITLAB_CLIENT_ID=
|
||||
# PENPOT_GITLAB_CLIENT_SECRET=
|
||||
|
||||
## OpenID Connect (since 1.5.0)
|
||||
|
||||
# PENPOT_OIDC_BASE_URI=
|
||||
# PENPOT_OIDC_CLIENT_ID=
|
||||
# PENPOT_OIDC_CLIENT_SECRET=
|
||||
|
||||
## LDAP
|
||||
##
|
||||
## NOTE: to enable ldap, you will need to put 'enable-login-with-ldap'
|
||||
## on the 'PENPOT_FLAGS' environment variable.
|
||||
|
||||
# PENPOT_LDAP_HOST=ldap
|
||||
# PENPOT_LDAP_PORT=10389
|
||||
# PENPOT_LDAP_SSL=false
|
||||
# PENPOT_LDAP_STARTTLS=false
|
||||
# PENPOT_LDAP_BASE_DN=ou=people,dc=planetexpress,dc=com
|
||||
# PENPOT_LDAP_BIND_DN=cn=admin,dc=planetexpress,dc=com
|
||||
# PENPOT_LDAP_BIND_PASSWORD=GoodNewsEveryone
|
||||
# PENPOT_LDAP_ATTRS_USERNAME=uid
|
||||
# PENPOT_LDAP_ATTRS_EMAIL=mail
|
||||
# PENPOT_LDAP_ATTRS_FULLNAME=cn
|
||||
@@ -0,0 +1,73 @@
|
||||
---
|
||||
version: "3.5"
|
||||
|
||||
networks:
|
||||
penpot:
|
||||
|
||||
services:
|
||||
penpot-frontend:
|
||||
image: "penpotapp/frontend:latest"
|
||||
ports:
|
||||
- <%=http_port%>:80
|
||||
|
||||
volumes:
|
||||
- <%=config_path%>/data/asserts:/opt/data
|
||||
|
||||
env_file:
|
||||
- config.env
|
||||
|
||||
depends_on:
|
||||
- penpot-backend
|
||||
- penpot-exporter
|
||||
|
||||
networks:
|
||||
- penpot
|
||||
|
||||
penpot-backend:
|
||||
image: "penpotapp/backend:latest"
|
||||
volumes:
|
||||
- <%=config_path%>/data/asserts:/opt/data
|
||||
|
||||
depends_on:
|
||||
- penpot-postgres
|
||||
- penpot-redis
|
||||
|
||||
env_file:
|
||||
- config.env
|
||||
|
||||
networks:
|
||||
- penpot
|
||||
|
||||
penpot-exporter:
|
||||
image: "penpotapp/exporter:latest"
|
||||
env_file:
|
||||
- config.env
|
||||
environment:
|
||||
# Don't touch it; this uses internal docker network to
|
||||
# communicate with the frontend.
|
||||
- PENPOT_PUBLIC_URI=http://penpot-frontend
|
||||
networks:
|
||||
- penpot
|
||||
|
||||
penpot-postgres:
|
||||
image: "postgres:14"
|
||||
restart: always
|
||||
stop_signal: SIGINT
|
||||
|
||||
environment:
|
||||
- POSTGRES_INITDB_ARGS=--data-checksums
|
||||
- POSTGRES_DB=<%=db_name%>
|
||||
- POSTGRES_USER=<%=db_username%>
|
||||
- POSTGRES_PASSWORD=<%=db_password%>
|
||||
|
||||
volumes:
|
||||
- <%=config_path%>/data/postgres:/var/lib/postgresql/data
|
||||
|
||||
networks:
|
||||
- penpot
|
||||
|
||||
penpot-redis:
|
||||
image: redis:7
|
||||
restart: always
|
||||
networks:
|
||||
- penpot
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"luci-app-penpot": {
|
||||
"description": "Grant UCI access for luci-app-penpot",
|
||||
"read": {
|
||||
"uci": [ "penpot" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "penpot" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user