近日将DS214play 淘汰换成 DS216+ii,终于可以docker愉快的玩耍
这里选用数据库用PostgreSql,Drone 的原话是推荐使用PostgreSql。
We strongly recommend using postgres instead of mysql. The system has been optimized for features not found in mysql.
所以,这里我们gitea同样也使用 Postgres 一个数据库搞定
Postgres
这里我们注意将Postgres 的数据库做一个持久化存储,链接到本机
/XX/XX /var/lib/postgresql/data
以及设置环境变量POSTGRES_PASSWORD 和端口绑定1
docker run --name postgres -e POSTGRES_PASSWORD={yourpassword} -v {/XX/XX(本地路径)}:/var/lib/postgresql/data -d -p {yourport}:5432 postgres
创建好后。创建gitea和drone使用的数据库(如果不闲麻烦,可以再为这两个数据库创建对应的用户)。
gitea
这里要注意的东西不多。docker配置的时候注意自己所对应的端口号,并且将对应数据仓库做一个持久化存储
/XX/XX /data
1 | docker run -d --name=gitea -p {ssh-port}:22 -p {http-port}:3000 -v {/XX/XX}:/data gitea/gitea |
创建完成后,属于对应的http 即可启动
进入设置页面后。数据库选择postgres,这里注意数据库的地址,可以填docker网关,172.17.0.1
对应然后填写自己对应的域名,端口。端口部分除了内部服务的3000不用改,其他的端口均需改成docker对应映射的端口号
附上app.ini配置文件1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89APP_NAME = Gitea: Git with a cup of tea
RUN_MODE = prod
RUN_USER = git
[repository]
ROOT = /data/git/repositories
[repository.local]
LOCAL_COPY_PATH = /data/gitea/tmp/local-repo
[repository.upload]
TEMP_PATH = /data/gitea/uploads
[server]
APP_DATA_PATH = /data/gitea
DOMAIN = {域名}
SSH_DOMAIN = {域名}
HTTP_PORT = 3000
ROOT_URL = http://{域名}:{http-port}/
DISABLE_SSH = false
SSH_PORT = {ssh-port}
SSH_LISTEN_PORT = 22
LFS_START_SERVER = true
LFS_CONTENT_PATH = /data/git/lfs
LFS_JWT_SECRET = {XXXXX}
OFFLINE_MODE = false
[database]
PATH = /data/gitea/gitea.db
DB_TYPE = postgres
HOST = {HOST}:{PORT}
NAME = {DATABASE_NAME}
USER = {user}
PASSWD = {password}
SCHEMA =
SSL_MODE = disable
CHARSET = utf8
[indexer]
ISSUE_INDEXER_PATH = /data/gitea/indexers/issues.bleve
[session]
PROVIDER_CONFIG = /data/gitea/sessions
PROVIDER = file
[picture]
AVATAR_UPLOAD_PATH = /data/gitea/avatars
REPOSITORY_AVATAR_UPLOAD_PATH = /data/gitea/repo-avatars
DISABLE_GRAVATAR = false
ENABLE_FEDERATED_AVATAR = true
[attachment]
ENABLED = true
PATH = /data/gitea/attachments
ALLOWED_TYPES = */*
MAX_SIZE = 100
MAX_FILES = 10
[log]
ROOT_PATH = /data/gitea/log
MODE = file
LEVEL = info
[security]
INSTALL_LOCK = true
SECRET_KEY = {XXXX}
INTERNAL_TOKEN = {XXXX}
[service]
DISABLE_REGISTRATION = true
REQUIRE_SIGNIN_VIEW = true
REGISTER_EMAIL_CONFIRM = false
ENABLE_NOTIFY_MAIL = true
ALLOW_ONLY_EXTERNAL_REGISTRATION = false
ENABLE_CAPTCHA = false
DEFAULT_KEEP_EMAIL_PRIVATE = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = false
DEFAULT_ENABLE_TIMETRACKING = true
NO_REPLY_ADDRESS = noreply.localhost
[oauth2]
JWT_SECRET = {XXXXX}
[mailer]
ENABLED = false
[openid]
ENABLE_OPENID_SIGNIN = true
ENABLE_OPENID_SIGNUP = false
drone
drone server
首先在gitea -> 头像 -> 设置 -> 应用 -> OAuth2 中添加应用
设置回调 http://{HOST}:{PORT}/login
拿到client_id, secret_key
配置
DRONE_GITEA_CLIENT_ID
DRONE_GITEA_CLIENT_SECRET
DRONE_GITEA_SERVER {gitea 登陆路径}
DRONE_RPC_SECRET {RPC_SECRET}
DRONE_SERVER_PROTO http
DRONE_SERVER_PORT :80
DRONE_SERVER_HOST {server_host}:{server_port}
DRONE_DATABASE_DRIVER postgres
DRONE_DATABASE_DATASOURCE postgres://{user_name}:{password}@{addr}:{port}/{database}?sslmode=disable
drone runner
runner 可以分开部署到其他机器上
1 | docker run -d \ |