ragepluginhook怎么用(ragepluginhook)

时间:2023-12-12 06:36:06 来源:互联网 编辑:心若向阳

文件断点续传——tusd

tus/tusd, 这是项目官网, 该项目是一个后端服务, 用于接收从前端页面所上传的文件。搭配前端 JS 库 transloadit/uppy, 即可实现完整的文件上传功能。

tusd 这个库的一大亮点, 是可以实现文件的断点续传。

官网

https://tus.io/

github地址:

https://github/tus/tusd

https://github/tus/tus-js-client

下载地址

tus.js

https://cdn.jsdelivr/npm/tus-js-client@latest/dist/tus.js

tus.min.js

https://cdn.jsdelivr/npm/tus-js-client@latest/dist/tus.min.js

安装:

> # git clone https://github/tus/tusd.git

> # cd tusd

> # go build -o tusd cmd/tusd/main.go

查看帮助

> # ./tusd --help

Usage of ./tusd:

-base-path string

Basepath of the HTTP server (default "/files/")

-behind-proxy

Respect X-Forwarded-* and similar headers which may be set by proxies

-cpuprofile string

write cpu profile to file

-expose-metrics

Expose metrics about tusd usage (default true)

-gcs-bucket string

Use Google Cloud Storage with this bucket as storage backend (requires the GCS_SERVICE_ACCOUNT_FILE environment variable to be set)

-gcs-object-prefix string

Prefix for GCS object names (can't contain underscore character)

-hooks-dir string

Directory to search for available hooks scripts

-hooks-enabled-events string

Comma separated list of enabled hook events (e.g. post-create,post-finish). Leave empty to enable default events (default "pre-create,post-create,post-receive,post-terminate,post-finish")

-hooks-grpc string

An gRPC endpoint to which hook events will be sent to

-hooks-grpc-backoff int

Number of seconds to wait before retrying each retry (default 1)

-hooks-grpc-retry int

Number of times to retry on a server error or network timeout (default 3)

-hooks-http string

An HTTP endpoint to which hook events will be sent to

-hooks-http-backoff int

Number of seconds to wait before retrying each retry (default 1)

-hooks-http-forward-headers string

List of HTTP request headers to be forwarded from the client request to the hook endpoint

-hooks-http-retry int

Number of times to retry on a 500 or network timeout (default 3)

-hooks-plugin string

Path to a Go plugin for loading hook functions (only supported on Linux and macOS; highly EXPERIMENTAL and may BREAK in the future)

-hooks-stop-code int

Return code from post-receive hook which causes tusd to stop and delete the current upload. A zero value means that no uploads will be stopped

-host string

Host to bind HTTP server to (default "0.0.0.0")

-max-size int

Maximum size of a single upload in bytes

-metrics-path string

Path under which the metrics endpoint will be accessible (default "/metrics")

-port string

Port to bind HTTP server to (default "1080")

-s3-bucket string

Use AWS S3 with this bucket as storage backend (requires the AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_REGION environment variables to be set)

-s3-disable-content-hashes

Disable the calculation of MD5 and SHA256 hashes for the content that gets uploaded to S3 for minimized CPU usage (experimental and may be removed in the future)

-s3-endpoint string

Endpoint to use S3 compatible implementations like minio (requires s3-bucket to be pass)

-s3-object-prefix string

Prefix for S3 object names

-s3-part-size int

Size in bytes of the individual upload requests made to the S3 API. Defaults to 50MiB (experimental and may be removed in the future) (default 52428800)

-s3-transfer-acceleration

Use AWS S3 transfer acceleration endpoint (requires -s3-bucket option and Transfer Acceleration property on S3 bucket to be set)

-timeout int

Read timeout for connections in milliseconds. A zero value means that reads will not timeout (default 6000)

-tls-certificate string

Path to the file containing the x509 TLS certificate to be used. The file should also contain any intermediate certificates and the CA certificate.

-tls-key string

Path to the file containing the key for the TLS certificate.

-tls-mode string

Specify which TLS mode to use; valid modes are tls13, tls12, and tls12-strong. (default "tls12")

-unix-sock string

If set, will listen to a UNIX socket at this location instead of a TCP socket

-upload-dir string

Directory to store uploads in (default "./data")

-verbose

Enable verbose logging output (default true)

-version

Print tusd version information

> # ./tusd -upload-dir=./data -port 8080

[tusd] 2021/01/23 10:42:26 Using '/data/tusd/data' as directory storage.

[tusd] 2021/01/23 10:42:26 Using 0.00MB as maximum size.

[tusd] 2021/01/23 10:42:26 Using 0.0.0.0:8080 as address to listen.

[tusd] 2021/01/23 10:42:26 Using /files/ as the base path.

[tusd] 2021/01/23 10:42:26 Using /metrics as the metrics path.

[tusd] 2021/01/23 10:42:26 Supported tus extensions: creation,creation-with-upload,termination,concatenation,creation-defer-length

[tusd] 2021/01/23 10:42:26 You can now upload files to: http://0.0.0.0:8080/files/

开放端口号

> # firewall-cmd --permanent --zone=public --add-port=8080/tcp

> # firewall-cmd --reload

上传地址:

http://192.168.117.130:8080/files/

Jenkins自动部署笔记(一)基础环境配置和Jenkins安装

一、安装jdk

方法一:下载源进行安装

1.Oracle官网下载jdk1.8:https://www.oracle/java/technologies/javase/javase-jdk8-downloads.html需要注册用户。

2.上传到服务器。

3.解压:

tar -zxvf jdk-8u211-linux-x64.tar.gz

4.配置环境变量:vim /etc/profile文件末尾增加:

export JA_HOME=/DATA/jdk/jdk1.8.0_211export CLASSPATH=$:CLASSPATH:$JA_HOME/lib/export PATH=$PATH:$JA_HOME/bin

刷新环境变量文件:

source /etc/profile

查看版本:

java -version

方法二:yum安装

1.查询源:

yum -y list java*

2.安装jdk1.8:

yum install -y java-1.8.0-openjdk.x86_64二、安装Jenkins并运行

1.下载jenkins:https://www.jenkins.io/download/

2.上传到服务器。

3.运行:

nohup java -jar jenkins.war --httpPort=80 > jenkins.out 2>&1 &

4.配置jenkins开机运行:

4.1创建启动脚本

(1)创建脚本jenkins.sh,内容如下:

#!/bin/bash###主要目的用于开机启动服务,不然 启动jenkins.war包没有java -jar的权限JA_HOME=/usr/local/jdk1.8 pid=`ps -ef | grep jenkins.war | grep -v 'grep'| awk '{print $2}'| wc -l` if [ "$1" = "start" ];then if [ $pid -gt 0 ];then echo 'jenkins is running...'else ### java启动服务 配置java安装根路径,和启动war包存的根路径 nohup $JA_HOME/bin/java -jar /usr/local/jenkins/jenkins.war --httpPort=8080 > jenkins.out 2>&1 & fi elif [ "$1" = "stop" ];then exec ps -ef | grep jenkins | grep -v grep | awk '{print $2}'| xargs kill -9 echo 'jenkins is stop..'else echo "Please input like this:"./jenkins.sh start" or "./jenkins stop"" fi

将JA_HOME的路径改为自己的jdk安装路径。

(2)设置jenkins.sh可执行权限

chmod +x jenkins.sh

此时可以使用一下命令:

启动:

jenkins.sh start

停止:

jenkins.sh stop

4.2设置开机启动服务

(1)到 /lib/systemd/system 服务注册目录下创建 jenkins.service,内容如下:

[Unit]Description=JenkinsAfter=network.target[Service]Type=forkingExecStart=/usr/local/jenkins/jenkins.sh startExecReload=ExecStop=/usr/local/jenkins/jenkins.sh stopPrivateTmp=true[Install]WantedBy=multi-user.target

(2)执行刷新命令:systemctl daemon-reload,此时可以通过systemctl start jenkins.service启动jenkins

(3)设置开机启动:systemctl list-units --type=service

5.浏览器打开jenkins管理地址:http://ip:8080/login?from=%2F,等待几分钟

6.安装推荐的插件,等待安装插件

7.创建第一个管理用户:admin 123456

8.安装以下几个插件,根据自己需要了,也可以不安装。

点击jenkins 系统管理->插件管理,点击可选插件,搜索以下插件并安装:

(1)Git plugin 可能默认已经安装

(2)Git client plugin 可能默认已经安装

(3)Maven Integration plugin

(4)Publish Over SSH 用于远程部署

(5)Gitlab Hook Plugin 用于gitlab提交触发自动部署

9.远程应用服务器信息配置

打开系统管理-》系统设置,找到Publish over SSH,设置远程服务器信息SSH Servers:

name:随便起名字

Hostname:ip

Username:登录用户名,可以用root

Remote Directory:jenkins将jar包上传到服务器的初始路径,需要提前在远程服务器中创建好,不设置默认为根目录

选择“高级”选中“Use password authentication, or use a different key”使用密码进行验证。

Passphrase / Password:root密码

若还有其他远程服务器,点击新增继续添加,否则点击保存退出。

10.全局工具配置

分别配置它的JDK GIT 和MEN,如果本机已经有了,则输入安装路径即可,如果没有可以使用JENKINS的自动安装功能

(1)jdk:JA_HOME填写jdk安装路径即可。

(2)git:需要下载安装git:yum -y install git,查找git安装路径:whereis git

(3)maven:选择自动安装即可

11.接下来就可以创建部署任务啦。。。

声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送至邮件举报,一经查实,本站将立刻删除。转载务必注明出处:http://www.hixs.net/article/20231212/169624434131540.html