添加项目文件。
This commit is contained in:
22
Gitea/Gitea.projitems
Normal file
22
Gitea/Gitea.projitems
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||
<HasSharedItems>true</HasSharedItems>
|
||||
<SharedGUID>816bea29-9cdb-439d-bc36-d2dd6c52bc69</SharedGUID>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<Import_RootNamespace>Gitea</Import_RootNamespace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Include="$(MSBuildThisFileDirectory)conf.d\gitwoyue.conf" />
|
||||
<None Include="$(MSBuildThisFileDirectory)gitea\docker-compose.yml" />
|
||||
<None Include="$(MSBuildThisFileDirectory)gitea\mysql\config\my.cnf" />
|
||||
<None Include="$(MSBuildThisFileDirectory)gitea\mysql\init\init.sql" />
|
||||
<None Include="$(MSBuildThisFileDirectory)gitea\grant-permissions.sh" />
|
||||
<None Include="$(MSBuildThisFileDirectory)README.md" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="$(MSBuildThisFileDirectory)gitea\mysql\data\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
13
Gitea/Gitea.shproj
Normal file
13
Gitea/Gitea.shproj
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>816bea29-9cdb-439d-bc36-d2dd6c52bc69</ProjectGuid>
|
||||
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
|
||||
<PropertyGroup />
|
||||
<Import Project="Gitea.projitems" Label="Shared" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
|
||||
</Project>
|
||||
50
Gitea/README.md
Normal file
50
Gitea/README.md
Normal file
@@ -0,0 +1,50 @@
|
||||
# Gitea
|
||||
|
||||
## 官网
|
||||
|
||||
https://gitea.io/en-us/
|
||||
|
||||
## 用途
|
||||
|
||||
低配置要求的Gitlab替代。
|
||||
|
||||
## 文件说明
|
||||
|
||||
* `docker-compose.yml`:服务配置;
|
||||
|
||||
## 安装说明
|
||||
|
||||
1. 解析域名到你的服务器;
|
||||
|
||||
2. 安装docker-compose,参考: <a href="https://www.4spaces.org/centos-install-docker-compose/" target="_blank">CENTOS安装Docker Compose</a>;
|
||||
|
||||
3. 完成NginxAndLetsencrypt的部署;
|
||||
|
||||
参见相关说明。(包含把sample.conf改名为gitea.conf或其他名字)
|
||||
|
||||
4. 在/srv下,复制gitea目录。cd进gitea
|
||||
|
||||
5. 在/srv/gitea下,chmod +x ./grant-permissions.sh
|
||||
|
||||
6. 执行该sh脚本。注意,可以通过tail -2 /etc/passwd和tail -2 /etc/group 查看新注册用户的uid和gid。如和docker-compose.yml中的不符合则应修改yml文件。
|
||||
|
||||
7. 参照NginxAndLetsencrypt的sample.conf中的注释说明和sampleApp中的compose文件修改docker-compose.yml的网络设置。
|
||||
|
||||
8. 启动服务
|
||||
|
||||
9. ```
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
10. 参照NginxAndLetsencrypt的sample.conf中的注释说明,获取新创建的container的ip,并返回到gitea.conf中将ip填入。
|
||||
|
||||
11. 重启nginx的docker容器。
|
||||
## 使用说明
|
||||
|
||||
配置文件在:/srv/gitea/gitea/gitea/conf下的app.ini
|
||||
|
||||
邮件smtp服务器要带端口号(通常是25)
|
||||
|
||||
## 测试环境
|
||||
|
||||
* CentOS Linux release 7.3.1611 (Core)
|
||||
35
Gitea/conf.d/gitwoyue.conf
Normal file
35
Gitea/conf.d/gitwoyue.conf
Normal file
@@ -0,0 +1,35 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name git.woyue.org;
|
||||
server_tokens off;
|
||||
|
||||
location /.well-known/acme-challenge/ {
|
||||
root /var/www/certbot;
|
||||
}
|
||||
|
||||
location / {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name git.woyue.org;
|
||||
server_tokens off;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/git.woyue.org/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/git.woyue.org/privkey.pem;
|
||||
include /etc/letsencrypt/options-ssl-nginx.conf;
|
||||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
||||
|
||||
location / {
|
||||
#ip address below should changed accordingly.
|
||||
proxy_pass http://192.168.16.5:3000;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $http_connection;
|
||||
}
|
||||
}
|
||||
44
Gitea/gitea/docker-compose.yml
Normal file
44
Gitea/gitea/docker-compose.yml
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
version: "3.4"
|
||||
|
||||
networks:
|
||||
gitea:
|
||||
external:
|
||||
name: nginxdocker_default
|
||||
|
||||
services:
|
||||
server:
|
||||
image: "gitea/gitea:latest"
|
||||
environment:
|
||||
- USER_UID=1000
|
||||
- USER_GID=1000
|
||||
- DB_TYPE=mysql
|
||||
- DB_HOST=db:3306
|
||||
- DB_NAME=gitea
|
||||
- DB_USER=gitea
|
||||
- DB_PASSWD=Whynotfight?
|
||||
restart: always
|
||||
networks:
|
||||
- gitea
|
||||
volumes:
|
||||
- ./gitea:/data
|
||||
ports:
|
||||
- "3000:3000"
|
||||
- "222:22"
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
db:
|
||||
image: "mysql/mysql-server"
|
||||
restart: always
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=Nowaytohide...
|
||||
- MYSQL_USER=gitea
|
||||
- MYSQL_PASSWORD=Whynotfight?
|
||||
- MYSQL_DATABASE=gitea
|
||||
networks:
|
||||
- gitea
|
||||
volumes:
|
||||
- ./mysql/config/my.cnf:/etc/my.cnf
|
||||
- ./mysql/data:/var/lib/mysql
|
||||
- ./mysql/init:/docker-entrypoint-initdb.d
|
||||
3
Gitea/gitea/grant-permissions.sh
Normal file
3
Gitea/gitea/grant-permissions.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
useradd -M -s /sbin/nologin git
|
||||
chown -R git:git ../gitea
|
||||
13
Gitea/gitea/mysql/config/my.cnf
Normal file
13
Gitea/gitea/mysql/config/my.cnf
Normal file
@@ -0,0 +1,13 @@
|
||||
[mysqld]
|
||||
user=gitea
|
||||
default-authentication-plugin=mysql_native_password
|
||||
skip-name-resolve
|
||||
character-set-client-handshake=0
|
||||
character-set-server=utf8mb4
|
||||
collation-server=utf8mb4_unicode_ci
|
||||
default-time-zone='+8:00'
|
||||
lower_case_table_names=1
|
||||
[client]
|
||||
default-character-set=utf8mb4
|
||||
[mysql]
|
||||
default-character-set=utf8mb4
|
||||
1
Gitea/gitea/mysql/init/init.sql
Normal file
1
Gitea/gitea/mysql/init/init.sql
Normal file
@@ -0,0 +1 @@
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'gitea'@'%' WITH GRANT OPTION;
|
||||
Reference in New Issue
Block a user