Compare commits
No commits in common. "master" and "develop" have entirely different histories.
20
Dockerfile
20
Dockerfile
|
@ -1,17 +1,13 @@
|
||||||
FROM ubuntu:20.04
|
FROM ubuntu:20.04
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
|
|
||||||
RUN DEBIAN_FRONTEND=noninteractive apt install -y tzdata
|
|
||||||
# basics
|
# basics
|
||||||
RUN apt-get install -y libssl-dev curl libmysqlclient-dev imagemagick nodejs mysql-server redis-server
|
RUN apt-get install -y libssl-dev curl libmysqlclient-dev imagemagick nodejs mysql-server redis-server tzdata
|
||||||
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||||
# confirm openssl version
|
# confirm openssl version
|
||||||
RUN openssl version
|
RUN openssl version
|
||||||
RUN which openssl
|
RUN which openssl
|
||||||
# install RVM, Ruby, and Bundler
|
# install RVM, Ruby, and Bundler
|
||||||
RUN \curl -L https://get.rvm.io | bash -s stable
|
RUN \curl -L https://get.rvm.io | bash -s stable
|
||||||
# rvm environment variable
|
|
||||||
RUN /bin/bash -l -c "source /etc/profile.d/rvm.sh"
|
|
||||||
RUN /bin/bash -l -c "rvm requirements"
|
RUN /bin/bash -l -c "rvm requirements"
|
||||||
# replace ruby mirror url, accelerate install ruby
|
# replace ruby mirror url, accelerate install ruby
|
||||||
RUN sed -i 's/rvm_remote_server_url2/#rvm_remote_server_url2/g' /usr/local/rvm/config/db
|
RUN sed -i 's/rvm_remote_server_url2/#rvm_remote_server_url2/g' /usr/local/rvm/config/db
|
||||||
|
@ -41,19 +37,11 @@ RUN /bin/bash -l -c 'gem install puma -v 5.6.5'
|
||||||
RUN rm -rf Gemfile.lock
|
RUN rm -rf Gemfile.lock
|
||||||
|
|
||||||
RUN cp config/configuration.yml.example config/configuration.yml
|
RUN cp config/configuration.yml.example config/configuration.yml
|
||||||
RUN cp config/database-docker.yml.example config/database.yml
|
RUN cp config/database.yml.example config/database.yml
|
||||||
RUN touch config/redis.yml
|
RUN touch config/redis.yml
|
||||||
RUN touch config/elasticsearch.yml
|
RUN touch config/elasticsearch.yml
|
||||||
|
|
||||||
RUN /bin/bash -l -c 'bundle install'
|
RUN /bin/bash -l -c 'bundle install'
|
||||||
|
|
||||||
RUN redis-server &
|
#EXPOSE 4000
|
||||||
|
#RUN /bin/bash -l -c 'RAILS_ENV=production puma'
|
||||||
RUN /bin/bash -l -c 'bundle exec rake sync_table_structure:import_csv'
|
|
||||||
|
|
||||||
RUN /bin/bash -l -c 'rails db:migrate RAILS_ENV=development'
|
|
||||||
|
|
||||||
RUN /bin/bash -l -c 'bundle exec sidekiq -C config/sidekiq.yml -e production -d'
|
|
||||||
|
|
||||||
EXPOSE 4000
|
|
||||||
RUN /bin/bash -l -c 'RAILS_ENV=production puma -C config/puma.rb'
|
|
|
@ -1,19 +0,0 @@
|
||||||
FROM ubuntu:20.04
|
|
||||||
RUN apt-get update
|
|
||||||
# basics
|
|
||||||
RUN apt-get install -y libssl-dev curl libmysqlclient-dev imagemagick nodejs mysql-server redis-server tzdata
|
|
||||||
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
|
||||||
# confirm openssl version
|
|
||||||
RUN openssl version
|
|
||||||
RUN which openssl
|
|
||||||
# install RVM, Ruby, and Bundler
|
|
||||||
RUN \curl -L https://get.rvm.io | bash -s stable
|
|
||||||
RUN /bin/bash -l -c "rvm requirements"
|
|
||||||
# replace ruby mirror url, accelerate install ruby
|
|
||||||
RUN sed -i 's/rvm_remote_server_url2/#rvm_remote_server_url2/g' /usr/local/rvm/config/db
|
|
||||||
RUN sed -i 's/cache.ruby-lang.org/cache.ruby-china.com/g' /usr/local/rvm/config/db
|
|
||||||
# install ruby
|
|
||||||
RUN /bin/bash -l -c "rvm install 2.4.5"
|
|
||||||
# confirm ruby version
|
|
||||||
RUN /bin/bash -l -c "rvm list"
|
|
||||||
RUN /bin/bash -l -c "ruby -v"
|
|
10
Gemfile.lock
10
Gemfile.lock
|
@ -245,12 +245,13 @@ GEM
|
||||||
powerpack (0.1.2)
|
powerpack (0.1.2)
|
||||||
prettier (0.18.2)
|
prettier (0.18.2)
|
||||||
public_suffix (4.0.3)
|
public_suffix (4.0.3)
|
||||||
puma (5.6.5)
|
puma (3.12.2)
|
||||||
nio4r (~> 2.0)
|
|
||||||
raabro (1.4.0)
|
raabro (1.4.0)
|
||||||
rack (2.0.9)
|
rack (2.0.9)
|
||||||
rack-cors (1.1.1)
|
rack-cors (1.1.1)
|
||||||
rack (>= 2.0.0)
|
rack (>= 2.0.0)
|
||||||
|
rack-mini-profiler (2.0.1)
|
||||||
|
rack (>= 1.2.0)
|
||||||
rack-protection (2.0.8.1)
|
rack-protection (2.0.8.1)
|
||||||
rack
|
rack
|
||||||
rack-test (1.1.0)
|
rack-test (1.1.0)
|
||||||
|
@ -513,8 +514,9 @@ DEPENDENCIES
|
||||||
parallel (~> 1.19, >= 1.19.1)
|
parallel (~> 1.19, >= 1.19.1)
|
||||||
pdfkit
|
pdfkit
|
||||||
prettier
|
prettier
|
||||||
puma (~> 5.6.5)
|
puma (~> 3.11)
|
||||||
rack-cors
|
rack-cors
|
||||||
|
rack-mini-profiler
|
||||||
rails (~> 5.2.0)
|
rails (~> 5.2.0)
|
||||||
rails-i18n (~> 5.1)
|
rails-i18n (~> 5.1)
|
||||||
ransack
|
ransack
|
||||||
|
@ -536,7 +538,7 @@ DEPENDENCIES
|
||||||
sidekiq-cron (= 1.2.0)
|
sidekiq-cron (= 1.2.0)
|
||||||
sidekiq-failures
|
sidekiq-failures
|
||||||
simple_form
|
simple_form
|
||||||
simple_xlsx_reader (~> 1.0.4)
|
simple_xlsx_reader
|
||||||
sinatra
|
sinatra
|
||||||
solargraph (~> 0.38.0)
|
solargraph (~> 0.38.0)
|
||||||
spreadsheet
|
spreadsheet
|
||||||
|
|
13
README.md
13
README.md
|
@ -3,8 +3,7 @@
|
||||||
GitLink(确实开源)是中国计算机学会(CCF)官方指定的开源创新服务平台,旨在以“为开源创新服务”为使命,以“成为开源创新的汇聚地”为愿景,秉承“创新、开放、协作、共享”的价值观,致力于为大规模开源开放协同创新助力赋能,打造创新成果孵化和新工科人才培养的开源创新生态!
|
GitLink(确实开源)是中国计算机学会(CCF)官方指定的开源创新服务平台,旨在以“为开源创新服务”为使命,以“成为开源创新的汇聚地”为愿景,秉承“创新、开放、协作、共享”的价值观,致力于为大规模开源开放协同创新助力赋能,打造创新成果孵化和新工科人才培养的开源创新生态!
|
||||||
|
|
||||||
<center>
|
<center>
|
||||||
<img src="docs/figs/gitlink.png" width=80% /></center>
|
<img src="https://code.gitlink.org.cn/young/forgeplus/raw/branch/master/docs/figs/gitlink.png?raw=true" width=80% /></center>
|
||||||
|
|
||||||
|
|
||||||
## 特色功能
|
## 特色功能
|
||||||
|
|
||||||
|
@ -175,31 +174,31 @@ http://localhost:3000/
|
||||||
- 项目列表
|
- 项目列表
|
||||||
|
|
||||||
<center>
|
<center>
|
||||||
<img src="docs/figs/project_list.png" width=80% />
|
<img src="https://code.gitlink.org.cn/young/forgeplus/raw/branch/master/docs/figs/project_list.png?raw=true" width=50% />
|
||||||
</center>
|
</center>
|
||||||
|
|
||||||
- 代码仓库
|
- 代码仓库
|
||||||
|
|
||||||
<center>
|
<center>
|
||||||
<img src="docs/figs/repo.png" width=80% />
|
<img src="https://code.gitlink.org.cn/young/forgeplus/raw/branch/master/docs/figs/repo.png?raw=true" width=50% />
|
||||||
</center>
|
</center>
|
||||||
|
|
||||||
- 任务管理
|
- 任务管理
|
||||||
|
|
||||||
<center>
|
<center>
|
||||||
<img src="docs/figs/issues.png" width=80% />
|
<img src="https://code.gitlink.org.cn/young/forgeplus/raw/branch/master/docs/figs/issues.png?raw=true" width=50% />
|
||||||
</center>
|
</center>
|
||||||
|
|
||||||
- 合并请求
|
- 合并请求
|
||||||
|
|
||||||
<center>
|
<center>
|
||||||
<img src="docs/figs/PR.png" width=80% />
|
<img src="https://code.gitlink.org.cn/young/forgeplus/raw/branch/master/docs/figs/PR.png?raw=true" width=50% />
|
||||||
</center>
|
</center>
|
||||||
|
|
||||||
- 引擎配置
|
- 引擎配置
|
||||||
|
|
||||||
<center>
|
<center>
|
||||||
<img src="docs/figs/engine.png" width=80% />
|
<img src="https://code.gitlink.org.cn/young/forgeplus/raw/branch/master/docs/figs/engine.png?raw=true" width=50% />
|
||||||
</center>
|
</center>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -253,7 +253,6 @@ class PullRequestsController < ApplicationController
|
||||||
normal_status(-1, result.message)
|
normal_status(-1, result.message)
|
||||||
end
|
end
|
||||||
rescue => e
|
rescue => e
|
||||||
logger_error(e)
|
|
||||||
normal_status(-1, e.message)
|
normal_status(-1, e.message)
|
||||||
raise ActiveRecord::Rollback
|
raise ActiveRecord::Rollback
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,7 +9,7 @@ module Register
|
||||||
|
|
||||||
login_exist = Owner.exists?(login: login) || ReversedKeyword.check_exists?(login)
|
login_exist = Owner.exists?(login: login) || ReversedKeyword.check_exists?(login)
|
||||||
if user.present?
|
if user.present?
|
||||||
raise LoginError, '登录名已被他人使用' if login_exist && login != user&.login
|
raise LoginError, '登录名已被使用' if login_exist && login != user&.login
|
||||||
else
|
else
|
||||||
raise LoginError, '登录名已被使用' if login_exist
|
raise LoginError, '登录名已被使用' if login_exist
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,7 +8,7 @@ module Register
|
||||||
|
|
||||||
def check!
|
def check!
|
||||||
user = User.find_by(id: user_id)
|
user = User.find_by(id: user_id)
|
||||||
Rails.logger.info "Register::RemoteForm params: id: #{user_id}; username: #{username}; email: #{email}; password: #{password}; platform: #{platform}"
|
Rails.logger.info "Register::RemoteForm params: id: #{user&.id}; username: #{username}; email: #{email}; password: #{password}; platform: #{platform}"
|
||||||
check_login(username, user)
|
check_login(username, user)
|
||||||
check_mail(email,user)
|
check_mail(email,user)
|
||||||
check_password(password)
|
check_password(password)
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th width="5%">序号</th>
|
<th width="5%">序号</th>
|
||||||
<th width="15%">名称</th>
|
<th width="15%">名称</th>
|
||||||
<th width="35%">路由</th>
|
<th width="30%">路由</th>
|
||||||
<th width="15%">标识</th>
|
<th width="20%">标识</th>
|
||||||
<th width="10%">类型</th>
|
<th width="10%">类型</th>
|
||||||
<th width="15%"><%= sort_tag('创建时间', name: 'created_at', path: admins_sites_path) %></th>
|
<th width="20%"><%= sort_tag('创建时间', name: 'created_at', path: admins_sites_path) %></th>
|
||||||
<th width="15%">操作</th>
|
<th width="25%">操作</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td><%= site.url %></td>
|
<td><%= site.url %></td>
|
||||||
|
|
||||||
<td><%= overflow_hidden_span display_text(site.key), width: 170 %></td>
|
<td><%= overflow_hidden_span display_text(site.key), width: 150 %></td>
|
||||||
<td><%= site.site_type.humanize %></td>
|
<td><%= site.site_type.humanize %></td>
|
||||||
<td><%= site.created_at&.strftime('%Y-%m-%d %H:%M') %></td>
|
<td><%= site.created_at&.strftime('%Y-%m-%d %H:%M') %></td>
|
||||||
<td class="action-container">
|
<td class="action-container">
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<%= form_tag(admins_sites_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %>
|
<%= form_tag(admins_sites_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %>
|
||||||
<div class="form-group mr-2">
|
<div class="form-group mr-2">
|
||||||
<label for="status">类型:</label>
|
<label for="status">类型:</label>
|
||||||
<% type_options = [['全部', ''], ['Add', Site.site_types[:add]], ['Personal', Site.site_types[:personal]], ['Common', Site.site_types[:common]], ['Competition', Site.site_types[:competition]]] %>
|
<% type_options = [['全部', ''], ['Add', Site.site_types[:add]], ['Personal', Site.site_types[:personal]], ['Common', Site.site_types[:common]]] %>
|
||||||
<%= select_tag(:site_type, options_for_select(type_options), class: 'form-control') %>
|
<%= select_tag(:site_type, options_for_select(type_options), class: 'form-control') %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
default: &default
|
|
||||||
adapter: mysql2
|
|
||||||
host: <%= ENV.fetch("MYSQL_HOST") { '127.0.0.1' } %>
|
|
||||||
encoding: utf8mb4
|
|
||||||
reconnect: true
|
|
||||||
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
|
||||||
username: <%= ENV.fetch("MYSQL_USER") { 'root' } %>
|
|
||||||
password: <%= ENV.fetch("MYSQL_PWD") { '123456' } %>
|
|
||||||
gitea_server:
|
|
||||||
adapter: mysql2
|
|
||||||
database: <%= ENV.fetch("MYSQL_DB") { 'gitea' } %>
|
|
||||||
host: 127.0.0.1
|
|
||||||
username: <%= ENV.fetch("MYSQL_USER") { 'root' } %>
|
|
||||||
password: <%= ENV.fetch("MYSQL_PWD") { '123456' } %>
|
|
||||||
encoding: utf8
|
|
||||||
|
|
||||||
development:
|
|
||||||
<<: *default
|
|
||||||
host: 127.0.0.1
|
|
||||||
database: forge_development
|
|
||||||
|
|
||||||
test:
|
|
||||||
<<: *default
|
|
||||||
database: forge_test
|
|
||||||
|
|
||||||
production:
|
|
||||||
<<: *default
|
|
||||||
database: <%= ENV.fetch("MYSQL_DB") { 'forge_production' } %>
|
|
|
@ -16,9 +16,9 @@
|
||||||
|
|
||||||
## Steps
|
## Steps
|
||||||
|
|
||||||
### 1. 克隆本地版本仓库(去掉了邮箱和手机号验证码)
|
### 1. 克隆稳定版本仓库
|
||||||
```
|
```
|
||||||
git clone -b dev_local_v1 https://gitlink.org.cn/Gitlink/forgeplus.git
|
git clone -b standalone https://git.trustie.net/jasder/forgeplus.git
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. 安装依赖包
|
### 2. 安装依赖包
|
||||||
|
@ -54,7 +54,7 @@ default: &default
|
||||||
### 4. 配置gitea服务(可选)
|
### 4. 配置gitea服务(可选)
|
||||||
**如需要部署自己的gitea平台,请参考gitea官方平台:https://docs.gitea.io/zh-cn/install-from-binary/**
|
**如需要部署自己的gitea平台,请参考gitea官方平台:https://docs.gitea.io/zh-cn/install-from-binary/**
|
||||||
|
|
||||||
**因目前gitea平台api受限,暂时推荐从forge平台获取gitea部署文件进行部署:https://gitlink.org.cn/Gitlink/gitea-binary**
|
**因目前gitea平台api受限,暂时推荐从forge平台获取gitea部署文件进行部署:https://forgeplus.trustie.net/projects/Trustie/gitea-binary**
|
||||||
|
|
||||||
#### 配置gitea服务步骤
|
#### 配置gitea服务步骤
|
||||||
1. 部署gitea服务,并注册root账户
|
1. 部署gitea服务,并注册root账户
|
||||||
|
@ -93,7 +93,7 @@ rails db:migrate RAILS_ENV=development
|
||||||
### 9. clone前端代码
|
### 9. clone前端代码
|
||||||
**将前端代码克隆到public/react目录下,目录结构应该是: public/react/build**
|
**将前端代码克隆到public/react目录下,目录结构应该是: public/react/build**
|
||||||
```bash
|
```bash
|
||||||
git clone -b dev_local_v1 https://gitlink.org.cn/Gitlink/build.git
|
git clone -b standalone https://git.trustie.net/jasder/build.git
|
||||||
```
|
```
|
||||||
|
|
||||||
### 10. 启动redis(此处已mac系统为例)
|
### 10. 启动redis(此处已mac系统为例)
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
FROM golang:1.20.4
|
|
||||||
|
|
||||||
RUN yum update -y && \
|
|
||||||
yum install -y wget gcc make openssl-devel bzip2-devel libffi-devel zlib-devel git
|
|
||||||
|
|
||||||
#ENV GIT_SSH_COMMAND='ssh -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa'
|
|
||||||
RUN yum install -y autoconf gettext && \
|
|
||||||
wget http://github.com/git/git/archive/v2.32.0.tar.gz && \
|
|
||||||
tar -xvf v2.32.0.tar.gz && \
|
|
||||||
rm -f v2.32.0.tar.gz && \
|
|
||||||
cd git-* && \
|
|
||||||
make configure && \
|
|
||||||
./configure --prefix=/usr && \
|
|
||||||
make -j16 && \
|
|
||||||
make install
|
|
||||||
|
|
121
gitea/app.ini
121
gitea/app.ini
|
@ -1,121 +0,0 @@
|
||||||
APP_NAME = Trustie: Git with trustie
|
|
||||||
RUN_USER = git
|
|
||||||
RUN_MODE = prod
|
|
||||||
|
|
||||||
[oauth2]
|
|
||||||
JWT_SECRET = pyD-ZA6zwykBhVCWdF5FsdRGDtM6kg16JLhcCu8uLPM
|
|
||||||
|
|
||||||
[security]
|
|
||||||
INTERNAL_TOKEN = eyDDbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE1NzQyMzU3OTN9.w7RDQaNanZHdC2XIrr9kAntPIjhfkXXOiBnNTbEdqQ8
|
|
||||||
INSTALL_LOCK = true
|
|
||||||
SECRET_KEY = K4DDaucPzKQnTf7WQxKFIoFNtIlsWVacoN5Ss3VDypQBUes7Ncy96UU735sfGOar
|
|
||||||
PASSWORD_COMPLEXITY = off
|
|
||||||
REVERSE_PROXY_LIMIT = 1
|
|
||||||
REVERSE_PROXY_TRUSTED_PROXIES = *
|
|
||||||
|
|
||||||
[database]
|
|
||||||
DB_TYPE = mysql
|
|
||||||
HOST = 127.0.0.1:3306
|
|
||||||
NAME = gitea
|
|
||||||
USER = root
|
|
||||||
PASSWD = `123456`
|
|
||||||
CHARSET = utf8
|
|
||||||
SSL_MODE = disable
|
|
||||||
PATH = /var/lib/gitea/data/gitea.db
|
|
||||||
CONN_MAX_LIFE_TIME=180
|
|
||||||
MAX_IDLE_CONNS=5
|
|
||||||
MAX_OPEN_CONNS=200
|
|
||||||
LOG_SQL =true
|
|
||||||
|
|
||||||
[repository]
|
|
||||||
ROOT = /data/gitea-repositories
|
|
||||||
DEFAULT_BRANCH = master
|
|
||||||
|
|
||||||
[lfs]
|
|
||||||
PATH = /data/gitea/data/lfs
|
|
||||||
|
|
||||||
[server]
|
|
||||||
SSH_DOMAIN = testgitea2.trustie.net
|
|
||||||
DOMAIN = testgitea2.trustie.net
|
|
||||||
ROOT_URL = https://testgitea2.trustie.net/
|
|
||||||
DISABLE_SSH = false
|
|
||||||
SSH_PORT = 22
|
|
||||||
LFS_START_SERVER = true
|
|
||||||
LFS_CONTENT_PATH = /data/gitea/data/lfs
|
|
||||||
LFS_JWT_SECRET = n2kib4qdArULO57JW0jD2Ygm3z1ehzI8Y4zVfbxouyY
|
|
||||||
OFFLINE_MODE = false
|
|
||||||
ENABLE_PPROF = true
|
|
||||||
#REGISTER_EMAIL_CONFIRM = false
|
|
||||||
|
|
||||||
[webhook]
|
|
||||||
QUEUE_LENGTH = 1000
|
|
||||||
DELIVER_TIMEOUT = 5
|
|
||||||
SKIP_TLS_VERIFY = false
|
|
||||||
PAGING_NUM = 10
|
|
||||||
#PROXY_URL =
|
|
||||||
#PROXY_HOSTS =
|
|
||||||
|
|
||||||
[mailer]
|
|
||||||
ENABLED = false
|
|
||||||
|
|
||||||
[service]
|
|
||||||
REGISTER_EMAIL_CONFIRM = false
|
|
||||||
ENABLE_NOTIFY_MAIL = ANCH = master
|
|
||||||
|
|
||||||
DISABLE_REGISTRATION = false
|
|
||||||
ALLOW_ONLY_EXTERNAL_REGISTRATION = false
|
|
||||||
ENABLE_CAPTCHA = false
|
|
||||||
REQUIRE_SIGNIN_VIEW = true
|
|
||||||
DEFAULT_KEEP_EMAIL_PRIVATE = false
|
|
||||||
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
|
|
||||||
DEFAULT_ENABLE_TIMETRACKING = true
|
|
||||||
NO_REPLY_ADDRESS = noreply.example.org
|
|
||||||
SHOW_REGISTRATION_BUTTON = false
|
|
||||||
|
|
||||||
[picture]
|
|
||||||
DISABLE_GRAVATAR = true
|
|
||||||
ENABLE_FEDERATED_AVATAR = false
|
|
||||||
|
|
||||||
[openid]
|
|
||||||
ENABLE_OPENID_SIGNIN = true
|
|
||||||
ENABLE_OPENID_SIGNUP = true
|
|
||||||
|
|
||||||
[session]
|
|
||||||
PROVIDER = file
|
|
||||||
|
|
||||||
[log]
|
|
||||||
MODE = file
|
|
||||||
LEVEL = Trace
|
|
||||||
ROOT_PATH = /var/lib/gitea/log
|
|
||||||
REDIRECT_MACARON_LOG = true
|
|
||||||
[api]
|
|
||||||
DEFAULT_PAGING_NUM = 20
|
|
||||||
|
|
||||||
[git]
|
|
||||||
PATH =
|
|
||||||
DISABLE_DIFF_HIGHLIGHT = false
|
|
||||||
MAX_GIT_DIFF_LINES = 250
|
|
||||||
MAX_GIT_DIFF_LINE_CHARACTERS = 1200
|
|
||||||
MAX_GIT_DIFF_FILES = 25
|
|
||||||
GC_ARGS =
|
|
||||||
EnableAutoGitWireProtocol = true
|
|
||||||
|
|
||||||
; Operation timeout in seconds
|
|
||||||
[git.timeout]
|
|
||||||
DEFAULT = 1800
|
|
||||||
MIGRATE = 21600
|
|
||||||
MIRROR = 1800
|
|
||||||
CLONE = 1800
|
|
||||||
PULL = 1800
|
|
||||||
GC = 60
|
|
||||||
|
|
||||||
[migrations]
|
|
||||||
ALLOW_LOCALNETWORKS = true
|
|
||||||
|
|
||||||
[cron.update_mirrors]
|
|
||||||
SCHEDULE = @every 24h
|
|
||||||
|
|
||||||
[cron.delete_repo_archives]
|
|
||||||
ENABLED = true
|
|
||||||
RUN_AT_START = true
|
|
||||||
SCHEDULE = @every 72h
|
|
|
@ -1,41 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=Gitea (Git with a cup of tea)
|
|
||||||
After=syslog.target
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
# Uncomment the next line if you have repos with lots of files and get a HTTP 500 error because of that
|
|
||||||
# LimitNOFILE=524288:524288
|
|
||||||
RestartSec=2s
|
|
||||||
Type=simple
|
|
||||||
User=git
|
|
||||||
Group=git
|
|
||||||
WorkingDirectory=/var/lib/gitea/
|
|
||||||
# If using Unix socket: tells systemd to create the /run/gitea folder, which will contain the gitea.sock file
|
|
||||||
# (manually creating /run/gitea doesn't work, because it would not persist across reboots)
|
|
||||||
#RuntimeDirectory=gitea
|
|
||||||
ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini
|
|
||||||
Restart=always
|
|
||||||
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea
|
|
||||||
# If you install Git to directory prefix other than default PATH (which happens
|
|
||||||
# for example if you install other versions of Git side-to-side with
|
|
||||||
# distribution version), uncomment below line and add that prefix to PATH
|
|
||||||
# Don't forget to place git-lfs binary on the PATH below if you want to enable
|
|
||||||
# Git LFS support
|
|
||||||
#Environment=PATH=/path/to/git/bin:/bin:/sbin:/usr/bin:/usr/sbin
|
|
||||||
# If you want to bind Gitea to a port below 1024, uncomment
|
|
||||||
# the two values below, or use socket activation to pass Gitea its ports as above
|
|
||||||
###
|
|
||||||
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
|
|
||||||
#AmbientCapabilities=CAP_NET_BIND_SERVICE
|
|
||||||
###
|
|
||||||
# In some cases, when using CapabilityBoundingSet and AmbientCapabilities option, you may want to
|
|
||||||
# set the following value to false to allow capabilities to be applied on gitea process. The following
|
|
||||||
# value if set to true sandboxes gitea service and prevent any processes from running with privileges
|
|
||||||
# in the host user namespace.
|
|
||||||
###
|
|
||||||
#PrivateUsers=false
|
|
||||||
###
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
|
@ -1,19 +1,16 @@
|
||||||
namespace :commit_log_to_db do
|
namespace :commit_log_to_db do
|
||||||
desc "commit_log_to_db"
|
desc "commit_log_to_db"
|
||||||
task done: :environment do
|
task done: :environment do
|
||||||
# puts "project_id=================#{ENV['project_id']}"
|
puts "project_id=================#{ENV['project_id']}"
|
||||||
# return if ENV['project_id'].blank?
|
return if ENV['project_id'].blank?
|
||||||
# projects = Project.where(id: ENV['project_id'])
|
projects = Project.where(id: ENV['project_id'])
|
||||||
# if ENV['project_name'] == "jittor"
|
if ENV['project_name'] == "jittor"
|
||||||
# projects = Project.where(id: [1403791,1404837,1404087,1403854,1403883,1403886,1403894,1404027,1404187,1404234,1404291,1404522,1404238,1404632,1404003,1403975,1404285,1404525,1404017,1403843,1403867,1403874,1403878,1403881,1403887,1403898,1403916,1403937,1403954,1403961,1403963,1403965,1403967,1403972,1403974,1403976,1403977,1403978,1404007,1404012,1404020,1404023,1404032,1404042,1404058,1404065,1404069,1404071,1404072,1404078,1404094,1404104,1404143,1404146,1404167,1404173,1404174,1404175,1404210,1404216,1404226,1404229,1404240,1404242,1404244,1404247,1404248,1404250,1404261,1404272,1404276,1404290,1404327,1404333,1404360,1404450,1404460,1404466,1404485,1404489,1404491,1404496,1404500,1404502,1404507,1404519,1404521,1404523,1404527,1404530,1404532,1404537,1404540,1404541,1404710,1404328,1404211,1404241,1404107,1403880,1404271,1404268,1404745,1404101,1404051,1404047,1404052,1406706,1403852,1403931,1404165,1404607,1404498,1404014,1404045,1404043,1403739,1403801,1403815,1403821,1403822,1403824,1403836,1403853,1403872,1403904,1403906,1403909,1403915,1403919,1403921,1403943,1403945,1403971,1403981,1404022,1404026,1404030,1404037,1404091,1404133,1404163,1404184,1404209,1404212,1404220,1404246,1404249,1404263,1404265,1404287,1404299,1404311,1404497,1404506,1404546,1404558,1404577,1404582,1404591,1404592,1404594,1404595,1404596,1404597,1404605,1404606,1404609,1404639,1404641,1404659,1404671,1404681,1404702,1404748,1404754,1404759,1404785,1404879,1404955,1405169,1405205,1405265,1405374,1407368,1407446,1407671,1407673,1404956,1404079,1404080,1403889,1404665,1404801,1404224,1404931,1404544,1403844,1404036,1404067,1404587,1404696,1404732,1404598,1405192,1404162,1403920,1403903,1405248,1403792,1403817,1403962,1403841,1404188,1404185,1405273,1404575,1404550,1404834,1405420,1404141,1405256,1404633,1405277,1404590,1404796,1405230,1405189,1404584,1405257,1405198,1403925,1404692,1405253,1403809,1405118,1404756,1404962,1404864,1405190,1405258,1405274,1404642,1404924,1404453,1404926,1404649,1404237,1404233,1404600,1404758,1405259,1404157,1404444,1404451,1404920,1404919,1404927,1403830,1404658,1405145,1405185,1403842,1403807,1403895,1404549,1404593,1404750,1404798,1404551,1404701,1405156,1404579,1404655,1405267,1404957,1404556,1404651,1404456,1405430,1403955,1404063,1404214,1403942,1404040,1404804,1428732,1403939,1404208,1404245,1405278,1404139,1403850,1404192,1404293,1404297,1404370,1404492,1404693,1404757,1404329,1404512,1404228,1404314,1404016,1404652,1405275,1404832,1404561,1404653,1404704,1404892,1404589,1404953,1405269,1404881,1404221,1404230,1404793,1403953,1404933,1404035,1404599,1403924,1404119,1404526,1404581,1404705,1404709,1404073,1403808,1403892,1404574,1403849,1404251,1404792,1403865,1404640,1404783,1404048,1406707,1404708,1404053,1404295,1404050,1404049,1404044,1404274,1404046,1404636])
|
projects = Project.where(id: [1403791,1404837,1404087,1403854,1403883,1403886,1403894,1404027,1404187,1404234,1404291,1404522,1404238,1404632,1404003,1403975,1404285,1404525,1404017,1403843,1403867,1403874,1403878,1403881,1403887,1403898,1403916,1403937,1403954,1403961,1403963,1403965,1403967,1403972,1403974,1403976,1403977,1403978,1404007,1404012,1404020,1404023,1404032,1404042,1404058,1404065,1404069,1404071,1404072,1404078,1404094,1404104,1404143,1404146,1404167,1404173,1404174,1404175,1404210,1404216,1404226,1404229,1404240,1404242,1404244,1404247,1404248,1404250,1404261,1404272,1404276,1404290,1404327,1404333,1404360,1404450,1404460,1404466,1404485,1404489,1404491,1404496,1404500,1404502,1404507,1404519,1404521,1404523,1404527,1404530,1404532,1404537,1404540,1404541,1404710,1404328,1404211,1404241,1404107,1403880,1404271,1404268,1404745,1404101,1404051,1404047,1404052,1406706,1403852,1403931,1404165,1404607,1404498,1404014,1404045,1404043,1403739,1403801,1403815,1403821,1403822,1403824,1403836,1403853,1403872,1403904,1403906,1403909,1403915,1403919,1403921,1403943,1403945,1403971,1403981,1404022,1404026,1404030,1404037,1404091,1404133,1404163,1404184,1404209,1404212,1404220,1404246,1404249,1404263,1404265,1404287,1404299,1404311,1404497,1404506,1404546,1404558,1404577,1404582,1404591,1404592,1404594,1404595,1404596,1404597,1404605,1404606,1404609,1404639,1404641,1404659,1404671,1404681,1404702,1404748,1404754,1404759,1404785,1404879,1404955,1405169,1405205,1405265,1405374,1407368,1407446,1407671,1407673,1404956,1404079,1404080,1403889,1404665,1404801,1404224,1404931,1404544,1403844,1404036,1404067,1404587,1404696,1404732,1404598,1405192,1404162,1403920,1403903,1405248,1403792,1403817,1403962,1403841,1404188,1404185,1405273,1404575,1404550,1404834,1405420,1404141,1405256,1404633,1405277,1404590,1404796,1405230,1405189,1404584,1405257,1405198,1403925,1404692,1405253,1403809,1405118,1404756,1404962,1404864,1405190,1405258,1405274,1404642,1404924,1404453,1404926,1404649,1404237,1404233,1404600,1404758,1405259,1404157,1404444,1404451,1404920,1404919,1404927,1403830,1404658,1405145,1405185,1403842,1403807,1403895,1404549,1404593,1404750,1404798,1404551,1404701,1405156,1404579,1404655,1405267,1404957,1404556,1404651,1404456,1405430,1403955,1404063,1404214,1403942,1404040,1404804,1428732,1403939,1404208,1404245,1405278,1404139,1403850,1404192,1404293,1404297,1404370,1404492,1404693,1404757,1404329,1404512,1404228,1404314,1404016,1404652,1405275,1404832,1404561,1404653,1404704,1404892,1404589,1404953,1405269,1404881,1404221,1404230,1404793,1403953,1404933,1404035,1404599,1403924,1404119,1404526,1404581,1404705,1404709,1404073,1403808,1403892,1404574,1403849,1404251,1404792,1403865,1404640,1404783,1404048,1406707,1404708,1404053,1404295,1404050,1404049,1404044,1404274,1404046,1404636])
|
||||||
# end
|
end
|
||||||
# if ENV['project_name'] == "mindspore"
|
if ENV['project_name'] == "mindspore"
|
||||||
# projects = Project.where(identifier: ['MindSpore-first-experience', ' MindSpore-install', 'MindSpore-Application-practice', 'MindSpore-Model-Development', 'MindSpore-Data-preprocessing', 'Mindspore-Data-storage-use', 'MindSpore-Data-storage-kunpeng', 'MindSpore-LeNet-jzx3', 'MindSpore-competition'] )
|
projects = Project.where(identifier: ['MindSpore-first-experience', ' MindSpore-install', 'MindSpore-Application-practice', 'MindSpore-Model-Development', 'MindSpore-Data-preprocessing', 'Mindspore-Data-storage-use', 'MindSpore-Data-storage-kunpeng', 'MindSpore-LeNet-jzx3', 'MindSpore-competition'] )
|
||||||
# end
|
end
|
||||||
# projects = Project.where(id: [5533,2,5971,299,1707,4418,1673,290,17,29,907,956,162,950])
|
|
||||||
projects = Project.where("id < 6200").where("id not in(5533,2,5971,299,1707,4418,1673,290,17,29,907,956,162,950)").where("project_type !=2")
|
|
||||||
projects.each_with_index do |project, index|
|
projects.each_with_index do |project, index|
|
||||||
next if project.owner.nil?
|
|
||||||
result = Gitea::Repository::Commits::ListService.call(project.owner.login,project.identifier,sha: "", page: 1, limit: 200, token: project.owner.gitea_token)
|
result = Gitea::Repository::Commits::ListService.call(project.owner.login,project.identifier,sha: "", page: 1, limit: 200, token: project.owner.gitea_token)
|
||||||
next if result.blank? || result[:total_count].blank?
|
next if result.blank? || result[:total_count].blank?
|
||||||
total_count = result[:total_count]
|
total_count = result[:total_count]
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
namespace :copy_attachment_files do
|
|
||||||
desc "copy_attachment_files to out path"
|
|
||||||
task done: :environment do
|
|
||||||
cp_path = ENV['path'] || "/home/pdl/cp_files"
|
|
||||||
container_type = ENV['_type']
|
|
||||||
next if container_type.blank?
|
|
||||||
Dir.mkdir(cp_path) unless Dir.exist?(cp_path)
|
|
||||||
attachments = Attachment.where(container_type: container_type)
|
|
||||||
attachments.each do |file|
|
|
||||||
file_path = File.join(file.disk_directory.to_s, file.disk_filename.to_s)
|
|
||||||
next unless File.exist?("#{Rails.root.to_s}/files/#{file_path}")
|
|
||||||
dir_path_year = "#{cp_path}/#{file.disk_directory.to_s.split("/")[0]}"
|
|
||||||
Dir.mkdir(dir_path_year) unless Dir.exist?(dir_path_year)
|
|
||||||
dir_path = "#{cp_path}/#{file.disk_directory}"
|
|
||||||
Dir.mkdir(dir_path) unless Dir.exist?(dir_path)
|
|
||||||
puts "cp #{Rails.root.to_s + File.join("/files/", file_path)} #{dir_path}"
|
|
||||||
system("cp #{Rails.root.to_s + File.join("/files/", file_path)} #{dir_path}")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
task memo: :environment do
|
|
||||||
cp_path = ENV['path'] || "/home/pdl/cp_files"
|
|
||||||
memos = Memo.where("content like '%/attachments/send_file/%'")
|
|
||||||
att_ids = []
|
|
||||||
memos.each do |memo|
|
|
||||||
# 附件的格式为(/api/attachments/ + 附件id)的形式,提取出id进行附件属性关联,做附件访问权限控制
|
|
||||||
att_ids += memo.content.to_s.scan(/\(\/attachments\/send_file\/.+\)/).map{|s|s.match(/\d+/)[0]}
|
|
||||||
att_ids += memo.content.to_s.scan(/\/attachments\/send_file\/.+\"/).map{|s|s.match(/\d+/)[0]}
|
|
||||||
att_ids += memo.content.to_s.scan(/\/attachments\/send_file\/\d+/).map{|s|s.match(/\d+/)[0]}
|
|
||||||
end
|
|
||||||
if att_ids.present?
|
|
||||||
attachments = Attachment.where(id: att_ids)
|
|
||||||
attachments.each do |file|
|
|
||||||
file_path = File.join(file.disk_directory, file.disk_filename)
|
|
||||||
dir_path_year = "#{cp_path}/#{file.disk_directory.to_s.split("/")[0]}"
|
|
||||||
Dir.mkdir(dir_path_year) unless Dir.exist?(dir_path_year)
|
|
||||||
dir_path = "#{cp_path}/#{file.disk_directory}"
|
|
||||||
Dir.mkdir(dir_path) unless Dir.exist?(dir_path)
|
|
||||||
puts "cp #{Rails.root.to_s + File.join("/files/", file_path)} #{dir_path}"
|
|
||||||
system("cp #{Rails.root.to_s + File.join("/files/", file_path)} #{dir_path}")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -4,37 +4,22 @@ namespace :repair_gitea_user do
|
||||||
users = User.find_by_sql("SELECT * FROM `users` WHERE id !=2 AND type='User' AND NOT EXISTS (SELECT * FROM forgegitea.`user` WHERE forgegitea.`user`.id=users.gitea_uid)")
|
users = User.find_by_sql("SELECT * FROM `users` WHERE id !=2 AND type='User' AND NOT EXISTS (SELECT * FROM forgegitea.`user` WHERE forgegitea.`user`.id=users.gitea_uid)")
|
||||||
puts "total users count:#{users.count}"
|
puts "total users count:#{users.count}"
|
||||||
success_count = 0
|
success_count = 0
|
||||||
update_count = 0
|
|
||||||
users.each do |user|
|
users.each do |user|
|
||||||
begin
|
begin
|
||||||
interactor = Gitea::RegisterInteractor.call({ username: user.login, email: user.mail, password: "abc12345678" })
|
interactor = Gitea::RegisterInteractor.call({ username: user.login, email: user.mail, password: "abc12345678" })
|
||||||
if interactor.success?
|
if interactor.success?
|
||||||
gitea_user = interactor.result
|
gitea_user = interactor.result
|
||||||
result = Gitea::User::GenerateTokenService.call(user.login, "abc12345678" )
|
result = Gitea::User::GenerateTokenService.call(user.login, password)
|
||||||
user.gitea_token = result['sha1']
|
user.gitea_token = result['sha1']
|
||||||
user.gitea_uid = gitea_user[:body]['id']
|
user.gitea_uid = gitea_user[:body]['id']
|
||||||
user.is_sync_pwd = false
|
user.is_sync_pwd = false
|
||||||
user.save!
|
user.save!
|
||||||
success_count = success_count + 1
|
success_count = success_count + 1
|
||||||
else
|
|
||||||
if interactor.result[:message].present? && interactor.result[:message].to_s.include?("user already exists")
|
|
||||||
uid = ActiveRecord::Base.connection.query_value("SELECT id FROM forgegitea.`user` WHERE forgegitea.`user`.name='#{user.login}' and forgegitea.`user`.email='#{user.mail}'")
|
|
||||||
if uid.present?
|
|
||||||
result = Gitea::User::GenerateTokenService.call(user.login, "abc12345678" )
|
|
||||||
if result['sha1'].present?
|
|
||||||
user.gitea_token = result['sha1']
|
|
||||||
user.gitea_uid = uid
|
|
||||||
user.is_sync_pwd = false
|
|
||||||
user.save!
|
|
||||||
update_count = update_count + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
puts "repair gitea user: #{user.id}:#{user.login}:, error:#{e}"
|
puts "repair gitea user: #{user.id}:#{user.login}:, error:#{e}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
puts "repair gitea user success total: #{success_count},update_count:#{update_count}"
|
puts "repair gitea user success total: #{success_count}"
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Reference in New Issue