Merge pull request '整理docker打包' (#336) from docker into dev_local_v1

This commit is contained in:
xxq250 2023-06-14 14:42:26 +08:00
commit 8874898ff3
15 changed files with 7432 additions and 263 deletions

View File

@ -1,33 +1,29 @@
FROM ubuntu:18.04
FROM registry.cn-hangzhou.aliyuncs.com/gitlink/ruby:2.4.5
RUN apt update
ADD ./ /home/pdl/gitlink
RUN apt install -y openssl libssl-dev imagemagick git ruby-dev nodejs libmariadb-dev libmysqlclient-dev shared-mime-info libpq-dev libxml2-dev libxslt-dev
RUN DEBIAN_FRONTEND="noninteractive" apt -y install tzdata
RUN ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
WORKDIR /home/pdl/gitlink
WORKDIR /home/app/gitlink
RUN /bin/bash -l -c "source /etc/profile.d/rvm.sh"
ADD ./ /home/app/gitlink
RUN /bin/bash -l -c 'gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/'
RUN gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
RUN gem update --system
RUN gem install bundler
RUN gem install rake
RUN /bin/bash -l -c 'gem update --system'
RUN rm -rf Gemfile.lock
#RUN cp config/configuration.yml.example config/configuration.yml
#RUN cp config/database.yml.example config/database.yml
#RUN touch config/redis.yml
#RUN touch config/elasticsearch.yml
RUN bundle install
EXPOSE 4000
RUN rails s -p 4000 -b '0.0.0.0'
RUN cp config/configuration.yml.example config/configuration.yml
RUN cp config/database.yml.example config/database.yml
RUN cp config/environments/production.rb.example config/environments/production.rb
RUN cp config/secrets.yml.example config/secrets.yml
RUN touch config/redis.yml
RUN touch config/elasticsearch.yml
RUN mkdir log
RUN /bin/bash -l -c 'bundle install'
#RUN /bin/bash -l -c 'RAILS_ENV=production rails db:create'
#RUN /bin/bash -l -c 'RAILS_ENV=production bundle exec rake sync_table_structure:import_csv'
#RUN /bin/bash -l -c 'RAILS_ENV=production rails db:migrate'
#EXPOSE 4000
#RUN /bin/bash -l -c 'RAILS_ENV=production puma'

19
Dockerfile-ruby Normal file
View File

@ -0,0 +1,19 @@
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"

View File

@ -4,7 +4,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem 'rails', '~> 5.2.0'
gem 'mysql2', '>= 0.4.4', '< 0.6.0'
gem 'puma', '~> 3.11'
gem 'puma', '~> 5.6.5'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
@ -20,6 +20,8 @@ gem 'bootsnap', '>= 1.1.0', require: false
gem 'chinese_pinyin'
# gem 'loofah','~> 2.20.0'
gem 'rack-cors'
gem 'redis-rails'
gem 'roo-xls'
@ -53,7 +55,7 @@ gem 'acts_as_list'
gem 'omniauth-cas'
# profiler Middleware
gem 'rack-mini-profiler'
# gem 'rack-mini-profiler'
# object-based searching
gem 'ransack'

View File

@ -1,47 +1,47 @@
GEM
remote: https://mirrors.cloud.tencent.com/rubygems/
specs:
aasm (5.0.6)
aasm (5.5.0)
concurrent-ruby (~> 1.0)
actioncable (5.2.4.1)
actionpack (= 5.2.4.1)
actioncable (5.2.8.1)
actionpack (= 5.2.8.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.4.1)
actionpack (= 5.2.4.1)
actionview (= 5.2.4.1)
activejob (= 5.2.4.1)
actionmailer (5.2.8.1)
actionpack (= 5.2.8.1)
actionview (= 5.2.8.1)
activejob (= 5.2.8.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.4.1)
actionview (= 5.2.4.1)
activesupport (= 5.2.4.1)
actionpack (5.2.8.1)
actionview (= 5.2.8.1)
activesupport (= 5.2.8.1)
rack (~> 2.0, >= 2.0.8)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.4.1)
activesupport (= 5.2.4.1)
actionview (5.2.8.1)
activesupport (= 5.2.8.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
active_decorator (1.3.2)
active_decorator (1.4.0)
activesupport
activejob (5.2.4.1)
activesupport (= 5.2.4.1)
activejob (5.2.8.1)
activesupport (= 5.2.8.1)
globalid (>= 0.3.6)
activemodel (5.2.4.1)
activesupport (= 5.2.4.1)
activerecord (5.2.4.1)
activemodel (= 5.2.4.1)
activesupport (= 5.2.4.1)
activemodel (5.2.8.1)
activesupport (= 5.2.8.1)
activerecord (5.2.8.1)
activemodel (= 5.2.8.1)
activesupport (= 5.2.8.1)
arel (>= 9.0)
activestorage (5.2.4.1)
actionpack (= 5.2.4.1)
activerecord (= 5.2.4.1)
marcel (~> 0.3.1)
activesupport (5.2.4.1)
activestorage (5.2.8.1)
actionpack (= 5.2.8.1)
activerecord (= 5.2.8.1)
marcel (~> 1.0.0)
activesupport (5.2.8.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
@ -50,20 +50,20 @@ GEM
activerecord (>= 5.0, < 6.1)
acts_as_list (0.9.19)
activerecord (>= 3.0)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
ancestry (3.0.7)
activerecord (>= 3.2.0)
annotate (2.6.5)
addressable (2.8.4)
public_suffix (>= 2.0.2, < 6.0)
ancestry (4.0.0)
activerecord (>= 5.2.4.5)
annotate (2.6.7)
activerecord (>= 2.3.0)
rake (>= 0.8.7)
rake (~> 10.4.2, >= 10.4.2)
archive-zip (0.12.0)
io-like (~> 0.3.0)
arel (9.0.0)
ast (2.4.0)
autoprefixer-rails (9.7.4)
execjs
awesome_print (1.8.0)
ast (2.4.2)
autoprefixer-rails (10.4.13.0)
execjs (~> 2)
awesome_print (1.9.2)
axlsx (3.0.0.pre)
htmlentities (~> 4.3, >= 4.3.4)
mimemagic (~> 0.3)
@ -72,40 +72,40 @@ GEM
axlsx_rails (0.5.2)
actionpack (>= 3.1)
axlsx (>= 2.0.1)
backport (1.1.2)
benchmark (0.1.0)
backport (1.2.0)
benchmark (0.2.1)
bindex (0.8.1)
bootsnap (1.4.6)
msgpack (~> 1.0)
bootsnap (1.12.0)
msgpack (~> 1.2)
bootstrap (4.3.1)
autoprefixer-rails (>= 9.1.0)
popper_js (>= 1.14.3, < 2)
sassc-rails (>= 2.0.0)
builder (3.2.4)
bulk_insert (1.7.0)
bulk_insert (1.9.0)
activerecord (>= 3.2.0)
capybara (3.15.1)
capybara (3.32.2)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (~> 1.2)
regexp_parser (~> 1.5)
xpath (~> 3.2)
chartkick (3.3.1)
chartkick (3.4.2)
childprocess (3.0.0)
chinese_pinyin (1.0.2)
chinese_pinyin (1.1.0)
chromedriver-helper (2.1.1)
archive-zip (~> 0.10)
nokogiri (~> 1.8)
chunky_png (1.3.11)
concurrent-ruby (1.1.6)
connection_pool (2.2.2)
chunky_png (1.4.0)
concurrent-ruby (1.2.2)
connection_pool (2.2.5)
crass (1.0.6)
deep_cloneable (3.0.0)
activerecord (>= 3.1.0, < 7)
diff-lcs (1.3)
diffy (3.3.0)
diff-lcs (1.5.0)
diffy (3.4.2)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
doorkeeper (5.5.1)
@ -121,19 +121,19 @@ GEM
elasticsearch-transport (7.5.0)
faraday (>= 0.14, < 1)
multi_json
enumerize (2.3.1)
enumerize (2.5.0)
activesupport (>= 3.2)
erubi (1.9.0)
et-orbi (1.2.4)
erubi (1.12.0)
et-orbi (1.2.7)
tzinfo
execjs (2.7.0)
execjs (2.8.1)
faraday (0.15.4)
multipart-post (>= 1.2, < 3)
ffi (1.12.2)
ffi (1.15.5)
font-awesome-sass (4.7.0)
sass (>= 3.2)
fugit (1.4.1)
et-orbi (~> 1.1, >= 1.1.8)
fugit (1.8.1)
et-orbi (~> 1, >= 1.2.7)
raabro (~> 1.4)
gitea-client (1.4.2)
rest-client (~> 2.1.0)
@ -145,78 +145,78 @@ GEM
groupdate (4.1.2)
activesupport (>= 4.2)
harmonious_dictionary (0.0.1)
hashie (3.6.0)
hashie (5.0.0)
htmlentities (4.3.4)
http-accept (1.7.0)
http-cookie (1.0.5)
domain_name (~> 0.5)
i18n (1.8.2)
i18n (1.13.0)
concurrent-ruby (~> 1.0)
io-like (0.3.1)
jaro_winkler (1.5.4)
jbuilder (2.10.0)
jaro_winkler (1.5.5)
jbuilder (2.11.5)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
jquery-rails (4.3.5)
jquery-rails (4.5.1)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jwt (2.2.1)
kaminari (1.2.0)
jwt (2.3.0)
kaminari (1.2.2)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.2.0)
kaminari-activerecord (= 1.2.0)
kaminari-core (= 1.2.0)
kaminari-actionview (1.2.0)
kaminari-actionview (= 1.2.2)
kaminari-activerecord (= 1.2.2)
kaminari-core (= 1.2.2)
kaminari-actionview (1.2.2)
actionview
kaminari-core (= 1.2.0)
kaminari-activerecord (1.2.0)
kaminari-core (= 1.2.2)
kaminari-activerecord (1.2.2)
activerecord
kaminari-core (= 1.2.0)
kaminari-core (1.2.0)
letter_avatar (0.3.8)
kaminari-core (= 1.2.2)
kaminari-core (1.2.2)
letter_avatar (0.3.9)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
loofah (2.4.0)
loofah (2.20.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (0.3.3)
mimemagic (~> 0.3.2)
marcel (1.0.2)
maruku (0.7.3)
method_source (0.9.2)
method_source (1.0.0)
mime-types (3.4.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2023.0218.1)
mimemagic (0.3.10)
mimemagic (0.4.3)
nokogiri (~> 1)
rake
mini_mime (1.0.2)
mini_mime (1.1.2)
mini_portile2 (2.4.0)
minitest (5.14.0)
msgpack (1.3.3)
multi_json (1.14.1)
minitest (5.15.0)
msgpack (1.6.1)
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.1.1)
mustermann (1.1.1)
multipart-post (2.3.0)
mustermann (1.1.2)
ruby2_keywords (~> 0.0.1)
mysql2 (0.5.3)
mysql2 (0.5.5)
netrc (0.11.0)
nio4r (2.5.2)
nokogiri (1.10.8)
nio4r (2.5.9)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
oauth2 (1.4.4)
faraday (>= 0.8, < 2.0)
oauth2 (1.4.8)
faraday (>= 0.8, < 3.0)
jwt (>= 1.0, < 3.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
omniauth (1.9.0)
hashie (>= 3.4.6, < 3.7.0)
omniauth (1.9.2)
hashie (>= 3.4.6)
rack (>= 1.6.2, < 3)
omniauth-cas (1.1.1)
omniauth-cas (2.0.0)
addressable (~> 2.3)
nokogiri (~> 1.5)
omniauth (~> 1.2)
@ -235,85 +235,81 @@ GEM
omniauth-wechat-oauth2 (0.2.2)
omniauth (>= 1.3.2)
omniauth-oauth2 (>= 1.1.1)
parallel (1.19.1)
parser (2.7.1.1)
ast (~> 2.4.0)
pdfkit (0.8.4.1)
polyamorous (2.3.2)
activerecord (>= 5.2.1)
popper_js (1.16.0)
powerpack (0.1.2)
prettier (0.18.2)
public_suffix (4.0.3)
puma (3.12.2)
parallel (1.20.1)
parser (2.7.2.0)
ast (~> 2.4.1)
pdfkit (0.8.4.3.2)
popper_js (1.16.1)
powerpack (0.1.3)
prettier (2.1.0)
public_suffix (4.0.7)
puma (5.6.5)
nio4r (~> 2.0)
raabro (1.4.0)
rack (2.0.9)
rack-cors (1.1.1)
rack (2.0.9.3)
rack-cors (2.0.1)
rack (>= 2.0.0)
rack-mini-profiler (2.0.1)
rack (>= 1.2.0)
rack-protection (2.0.8.1)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.4.1)
actioncable (= 5.2.4.1)
actionmailer (= 5.2.4.1)
actionpack (= 5.2.4.1)
actionview (= 5.2.4.1)
activejob (= 5.2.4.1)
activemodel (= 5.2.4.1)
activerecord (= 5.2.4.1)
activestorage (= 5.2.4.1)
activesupport (= 5.2.4.1)
rack-test (2.1.0)
rack (>= 1.3)
rails (5.2.8.1)
actioncable (= 5.2.8.1)
actionmailer (= 5.2.8.1)
actionpack (= 5.2.8.1)
actionview (= 5.2.8.1)
activejob (= 5.2.8.1)
activemodel (= 5.2.8.1)
activerecord (= 5.2.8.1)
activestorage (= 5.2.8.1)
activesupport (= 5.2.8.1)
bundler (>= 1.3.0)
railties (= 5.2.4.1)
railties (= 5.2.8.1)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
rails-html-sanitizer (1.5.0)
loofah (~> 2.19, >= 2.19.1)
rails-i18n (5.1.3)
i18n (>= 0.7, < 2)
railties (>= 5.0, < 6)
railties (5.2.4.1)
actionpack (= 5.2.4.1)
activesupport (= 5.2.4.1)
railties (5.2.8.1)
actionpack (= 5.2.8.1)
activesupport (= 5.2.8.1)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
rainbow (3.0.0)
rake (13.0.1)
ransack (2.3.2)
activerecord (>= 5.2.1)
activesupport (>= 5.2.1)
rainbow (3.1.1)
rake (10.4.2)
ransack (2.4.1)
activerecord (>= 5.2.4)
activesupport (>= 5.2.4)
i18n
polyamorous (= 2.3.2)
rb-fsevent (0.10.3)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rchardet (1.8.0)
redcarpet (3.5.0)
redis (4.1.3)
redis-actionpack (5.2.0)
actionpack (>= 5, < 7)
redcarpet (3.6.0)
redis (4.8.1)
redis-actionpack (5.3.0)
actionpack (>= 5, < 8)
redis-rack (>= 2.1.0, < 3)
redis-store (>= 1.1.0, < 2)
redis-activesupport (5.2.0)
activesupport (>= 3, < 7)
redis-activesupport (5.3.0)
activesupport (>= 3, < 8)
redis-store (>= 1.3, < 2)
redis-rack (2.1.2)
redis-rack (2.1.4)
rack (>= 2.0.8, < 3)
redis-store (>= 1.2, < 2)
redis-rails (5.0.2)
redis-actionpack (>= 5.0, < 6)
redis-activesupport (>= 5.0, < 6)
redis-store (>= 1.2, < 2)
redis-store (1.8.2)
redis (>= 4, < 5)
regexp_parser (1.7.0)
request_store (1.5.0)
redis-store (1.9.2)
redis (>= 4, < 6)
regexp_parser (1.8.2)
request_store (1.5.1)
rack (>= 1.4)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
@ -334,15 +330,15 @@ GEM
rqrcode_png (0.1.5)
chunky_png
rqrcode
rspec-core (3.9.1)
rspec-support (~> 3.9.1)
rspec-expectations (3.9.0)
rspec-core (3.9.3)
rspec-support (~> 3.9.3)
rspec-expectations (3.9.4)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-rails (3.9.0)
rspec-rails (3.9.1)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
@ -350,7 +346,7 @@ GEM
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.2)
rspec-support (3.9.4)
rubocop (0.52.1)
parallel (~> 1.10)
parser (>= 2.4.0.2, < 3.0)
@ -359,8 +355,8 @@ GEM
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-ole (1.2.12.2)
ruby-progressbar (1.10.1)
ruby2_keywords (0.0.2)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
ruby_dep (1.5.0)
rubyzip (1.3.0)
sass (3.7.4)
@ -368,13 +364,13 @@ GEM
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sass-rails (5.0.7)
railties (>= 4.0.0, < 6)
sass-rails (5.1.0)
railties (>= 5.2.0)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
sassc (2.2.1)
sassc (2.4.0)
ffi (~> 1.9)
sassc-rails (2.1.2)
railties (>= 4.0.0)
@ -382,9 +378,9 @@ GEM
sprockets (> 3.0)
sprockets-rails
tilt
searchkick (3.1.3)
activemodel (>= 4.2)
elasticsearch (>= 5)
searchkick (4.6.3)
activemodel (>= 5)
elasticsearch (>= 6, < 7.14)
hashie
selenium-webdriver (3.142.7)
childprocess (>= 0.5, < 4.0)
@ -399,10 +395,10 @@ GEM
sidekiq (>= 4.2.1)
sidekiq-failures (1.0.4)
sidekiq (>= 4.0.0)
simple_form (5.0.2)
simple_form (5.0.3)
actionpack (>= 5.0)
activemodel (>= 5.0)
simple_xlsx_reader (1.0.4)
simple_xlsx_reader (1.0.5)
nokogiri
rubyzip
sinatra (2.0.8.1)
@ -424,46 +420,45 @@ GEM
thor (~> 1.0)
tilt (~> 2.0)
yard (~> 0.9)
spreadsheet (1.2.6)
ruby-ole (>= 1.0)
spring (2.0.2)
activesupport (>= 4.2)
spreadsheet (1.3.0)
ruby-ole
spring (2.1.1)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.1)
sprockets-rails (3.2.2)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
thor (1.0.1)
thor (1.2.2)
thread_safe (0.3.6)
tilt (2.0.10)
tilt (2.1.0)
turbolinks (5.2.1)
turbolinks-source (~> 5.2)
turbolinks-source (5.2.0)
tzinfo (1.2.6)
tzinfo (1.2.11)
thread_safe (~> 0.1)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unf (0.1.4)
unf_ext
unf_ext (0.0.8.2)
unicode-display_width (1.6.1)
unicode-display_width (1.8.0)
web-console (3.7.0)
actionview (>= 5.0)
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
websocket-driver (0.7.1)
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.4)
wkhtmltopdf-binary (0.12.5.4)
websocket-extensions (0.1.5)
wkhtmltopdf-binary (0.12.6.6)
xpath (3.2.0)
nokogiri (~> 1.8)
yard (0.9.24)
yard (0.9.34)
PLATFORMS
ruby
@ -502,6 +497,7 @@ DEPENDENCIES
kaminari (~> 1.1, >= 1.1.1)
letter_avatar
listen (>= 3.0.5, < 3.2)
loofah (~> 2.20.0)
mysql2 (>= 0.4.4, < 0.6.0)
oauth2
omniauth (~> 1.9.0)
@ -514,9 +510,8 @@ DEPENDENCIES
parallel (~> 1.19, >= 1.19.1)
pdfkit
prettier
puma (~> 3.11)
puma (~> 5.6.5)
rack-cors
rack-mini-profiler
rails (~> 5.2.0)
rails-i18n (~> 5.1)
ransack
@ -538,7 +533,7 @@ DEPENDENCIES
sidekiq-cron (= 1.2.0)
sidekiq-failures
simple_form
simple_xlsx_reader
simple_xlsx_reader (~> 1.0.4)
sinatra
solargraph (~> 0.38.0)
spreadsheet
@ -551,4 +546,4 @@ DEPENDENCIES
wkhtmltopdf-binary
BUNDLED WITH
2.1.4
1.17.3

8
bin/start.sh Normal file
View File

@ -0,0 +1,8 @@
#!/bin/bash
bash -l -c "source /etc/profile.d/rvm.sh"
export PATH=/usr/local/rvm/gems/ruby-2.4.5/bin:/usr/local/rvm/gems/ruby-2.4.5@global/bin:/usr/local/rvm/rubies/ruby-2.4.5/bin:$PATH
bash -c "RAILS_ENV=production rails db:create"
#bash -c "RAILS_ENV=production bundle exec rake sync_table_structure:import_csv"
bash -c "RAILS_ENV=production rails db:migrate"
#bash -c "rm -f tmp/pids/server.pid && RAILS_ENV=production rails s -p 4000 -b '0.0.0.0'"
bash -c "RAILS_ENV=production puma -C config/puma.rb"

View File

@ -1,5 +1,11 @@
default: &default
platform_url: 'http://localhost:3000'
wechat:
appid: '123'
secret: '123'
weapp:
appid: '123'
secret: '123'
oauth:
qq:
appid: 'test'
@ -23,9 +29,9 @@ default: &default
redirect_uri: 'https://test.a.com/api/auth/educoder/callback'
gitea:
access_key_id: ''
access_key_secret: ''
domain: 'https://testgit.trustie.net'
access_key_id: <%= ENV.fetch("GITEA_USER") { 'root' } %>
access_key_secret: <%= ENV.fetch("GITEA_PWD") { '123456' } %>
domain: <%= ENV.fetch("GITEA_URL") { 'http://gitea:3000' } %>
base_url: '/api/v1'
admin_token: '123123'
hat_base_url: '/api/hat'

View File

@ -1,62 +1,31 @@
# MySQL. Versions 5.1.10 and up are supported.
#
# Install the MySQL driver
# gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
# gem 'mysql2'
#
# And be sure to use new-style password hashing:
# https://dev.mysql.com/doc/refman/5.7/en/password-hashing.html
#
default: &default
adapter: mysql2
host: 127.0.0.1
host: <%= ENV.fetch("MYSQL_HOST") { '127.0.0.1' } %>
encoding: utf8mb4
reconnect: true
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
username: root
password: 123456
# socket: /var/run/mysqld/mysqld.sock
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 20 } %>
username: <%= ENV.fetch("MYSQL_USER") { 'root' } %>
password: <%= ENV.fetch("MYSQL_PWD") { '123456' } %>
wait_timeout: 10
ssl_mode: disabled
gitea_server:
adapter: mysql2
database: gitea_development
host: 127.0.0.1
username: root
password: "123456"
database: <%= ENV.fetch("MYSQL_DB_GITEA") { 'gitea' } %>
host: <%= ENV.fetch("MYSQL_HOST") { '127.0.0.1' } %>
username: <%= ENV.fetch("MYSQL_USER") { 'root' } %>
password: <%= ENV.fetch("MYSQL_PWD") { '123456' } %>
encoding: utf8
ssl_mode: disabled
development:
<<: *default
host: 127.0.0.1
database: forge_development
database: forgeplus_development
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: forge_test
database: forgeplus_test
# As with config/secrets.yml, you never want to store sensitive information,
# like your database password, in your source code. If your source code is
# ever seen by anyone, they now have access to your database.
#
# Instead, provide the password as a unix environment variable when you boot
# the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
# for a full rundown on how to provide these environment variables in a
# production deployment.
#
# On Heroku and other platform providers, you may have a full connection URL
# available as an environment variable. For example:
#
# DATABASE_URL="mysql2://myuser:mypass@localhost/somedatabase"
#
# You can use this database configuration with:
#
# production:
# url: <%= ENV['DATABASE_URL'] %>
#
production:
<<: *default
database: forge_production
database: <%= ENV.fetch("MYSQL_DB") { 'forgeplus' } %>

View File

@ -0,0 +1,120 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
#
# config.cache_store = :memory_store
# config.public_file_server.headers = {
# 'Cache-Control' => "public"
# }
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
# config.require_master_key = true
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
## config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
config.public_file_server.enabled = true
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Store uploaded files on the local file system (see config/storage.yml for options)
config.active_storage.service = :local
# Mount Action Cable outside main process or domain
# config.action_cable.mount_path = nil
config.action_cable.url = 'wss://testforgeplus.trustie.net/cable'
config.action_cable.allowed_request_origins = ['http://localhost:3000', 'https://testforgeplus.trustie.net', /https:\/\/testforgeplus.*/]
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :info
# Prepend all log lines with the following tags.
config.log_tags = [:request_id]
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Use a real queuing backend for Active Job (and separate queues per environment)
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "educoderplus_#{Rails.env}"
config.action_mailer.perform_caching = false
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Use a different logger for distributed setups.
# require 'syslog/logger'
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
config.logger = Logger.new("#{Rails.root}/log/#{Rails.env}.log", 'daily')
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
config.active_record.belongs_to_required_by_default = false
# config.cache_store = :file_store, "#{Rails.root }/files/cache_store/"
# config.cache_store = :redis_store, 'redis://127.0.0.1:6379/0/cache', { expires_in: 90.minutes }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.exmail.qq.com',
port: 25,
domain: 'smtp.qq.com',
user_name: '123@trustie.org',
password: '123',
authentication: '123',
enable_starttls_auto: true
}
end

View File

@ -0,0 +1,22 @@
# Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
# You can use `rails secret` to generate a secure secret key.
# Make sure the secrets in this file are kept private
# if you're sharing your code publicly.
development:
secret_key_base: 66ad08589cd561754c8cd659a5a50a3694904f9c455dd2177115697d12d2c27b873222da8646f34c8cf4598a0f108f12c05141d645a3534c9a9a9833f239f397
test:
secret_key_base: 66ad08589cd561754c8cd659a5a50a3694904f9c455dd2177115697d12d2c27b873222da8646f34c8cf4598a0f108f12c05141d645a3534c9a9a9833f239f397
# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
secret_key_base: <%= ENV.fetch("SECRET_KEY_BASE") { '66ad08589cd561754c8cd659a5a50a3694904f9c455dd2177115697d12d2c27b873222da8646f34c8cf4598a0f108f12c05141d645a3534c9a9a9833f239f397' } %>

6883
db/init.sql Normal file

File diff suppressed because one or more lines are too long

View File

@ -4942,7 +4942,7 @@ CREATE TABLE `sites` (
LOCK TABLES `sites` WRITE;
/*!40000 ALTER TABLE `sites` DISABLE KEYS */;
INSERT INTO `sites` VALUES (1,'新建镜像项目','/projects/mirror/new','add_mirror_project',0,'2021-08-27 08:51:45','2021-08-27 08:51:45'),(2,'新建托管项目','/projects/deposit/new','add_common',0,'2021-08-27 08:51:45','2021-08-27 08:51:45'),(3,'新建组织','/organize/new','add_r',0,'2021-08-27 08:51:45','2021-08-27 08:51:45'),(4,'个人中心','/users/current_user','my_page',1,'2021-08-27 08:51:45','2021-08-27 08:51:45'),(5,'我的组织','/users/current_user/organizes','my_organizes',1,'2021-08-27 08:51:45','2021-08-27 08:51:45'),(6,'通知','/users/current_user/user_messages','notice',2,'2021-08-27 08:51:45','2021-08-27 08:51:45'),(7,'找回密码','/account/lost_password','lost_password',2,'2021-08-27 08:51:45','2021-08-27 08:51:45'),(8,'注册','/login?login=false','register',2,'2021-08-27 08:51:45','2021-08-27 08:51:45');
INSERT INTO `sites` VALUES (1,'新建项目','/projects/deposit/new','add_mirror_project',0,'2021-08-27 08:51:45','2021-08-27 08:51:45'),(2,'导入项目','/projects/mirror/new','add_common',0,'2021-08-27 08:51:45','2021-08-27 08:51:45'),(3,'新建组织','/organize/new','add_org',0,'2021-08-27 08:51:45','2021-08-27 08:51:45'),(4,'个人主页','/current_user','my_page',1,'2021-08-27 08:51:45','2021-08-27 08:51:45'),(6,'设置','/settings/profile','profile',1,'2021-08-27 08:51:45','2021-08-27 08:51:45'),(8,'注册','/register','register',2,'2021-08-27 08:51:45','2021-08-27 08:51:45');
/*!40000 ALTER TABLE `sites` ENABLE KEYS */;
UNLOCK TABLES;

View File

@ -1,38 +1,81 @@
version: '3'
networks:
gitlink:
external: false
services:
mysql:
image: mysql:5.7.17
container_name: gitlink-mysql
command: --sql-mode=""
restart: always
volumes:
- ./mysql_data/:/var/lib/mysql
- /data/mysql:/var/lib/mysql
- ./db/init.sql:/docker-entrypoint-initdb.d/forgeplus-init.sql
ports:
- "3306:3306"
- "13306:3306"
environment:
MYSQL_ROOT_PASSWORD: 123456789
MYSQL_DATABASE: educoder
- MYSQL_ROOT_PASSWORD=gitea
- MYSQL_USER=gitea
- MYSQL_PASSWORD=gitea
- MYSQL_DATABASE=gitea
networks:
- gitlink
redis:
image: redis:6.2.5
container_name: redis
gitea:
image: registry.cn-hangzhou.aliyuncs.com/gitlink/gitea:v2
container_name: gitea
restart: always
ports:
- "6379:6379"
- "3000:3000"
volumes:
- ./redis_data:/data
- ./gitea/app.ini:/etc/gitea/app.ini
- ./gitea/start.sh:/start.sh
- /data/repositories:/data/repositories
command:
- 'bash'
- '/start.sh'
environment:
- GITEA_WORK_DIR=/var/lib/gitea
- GITEA__database__DB_TYPE=mysql
- GITEA__database__HOST=mysql:3306
- GITEA__database__NAME=gitea
- GITEA__database__USER=gitea
- GITEA__database__PASSWD=gitea
depends_on:
- mysql
networks:
- gitlink
web:
image: gitlink-ubuntu18.04:latest
image: gitlink-ubuntu20.04:latest
container_name: gitlink-web
build:
context: ../
context: ./
dockerfile: Dockerfile
# command: bash -c "rm -f tmp/pids/server.pid && rails s -p 4000 -b '0.0.0.0'"
environment:
- GEM_PATH=/usr/local/rvm/gems/ruby-2.4.5:/usr/local/rvm/gems/ruby-2.4.5@global
- GEM_HOME=/usr/local/rvm/gems/ruby-2.4.5
- MYSQL_USER=root
- MYSQL_PWD=gitea
- MYSQL_HOST=mysql
- GITEA_USER=root
- GITEA_PWD=gitlink#2023 #GITEA_PWD from gitea/start.sh
- GITEA_URL=gitea
command:
- 'bash'
- '/start.sh'
stdin_open: true
tty: true
volumes:
- .:/home/app/gitlink
- ./bin/start.sh:/start.sh
- /data/webguazai/publicfiles:/home/pdl/forgeplus/public/files
- /data/webguazai/publicavatars:/home/pdl/forgeplus/public/images/avatars
- /data/webguazai/files:/home/pdl/forgeplus/files
ports:
- "4000:4000"
depends_on:
- mysql
- redis
- gitea
networks:
- gitlink

99
gitea/app.ini Normal file
View File

@ -0,0 +1,99 @@
APP_NAME = 开源项目托管
RUN_USER = root
RUN_MODE = prod
I_AM_BEING_UNSAFE_RUNNING_AS_ROOT = true
[oauth2]
JWT_SECRET = pyD-ZA6zwykBhVCWdF5FsdRGDtM6kg16JLhcCu8uLPM
[security]
INTERNAL_TOKEN = eyDDbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE1NzQyMzU3OTN9.w7RDQaNanZHdC2XIrr9kAntPIjhfkXXOiBnNTbEdqQ8
INSTALL_LOCK = true
SECRET_KEY = K4DDaucPzKQnTf7WQxKFIoFNtIlsWVacoN5Ss3VDypQBUes7Ncy96UU735sfGOar
PASSWORD_COMPLEXITY = off
[database]
DB_TYPE = mysql
HOST = mysql:3306
NAME = gitea
USER = root
PASSWD = `gitea`
CHARSET = utf8
SSL_MODE = disable
#PATH = /var/lib/gitea/gitea.db
PATH =/var/lib/gitea/data/gitea.db
[repository]
ROOT = /data/repositories
[lfs]
PATH = /data/gitea/data/lfs
[server]
SSH_DOMAIN = 106.75.10.84
DOMAIN = 106.75.10.84
ROOT_URL = http://106.75.10.84:3000/
DISABLE_SSH = false
SSH_PORT = 22
LFS_START_SERVER = true
;LFS_CONTENT_PATH = /data/gitea/data/lfs
LFS_JWT_SECRET = n2kib4qdArULO57JW0jD2Ygm3z1ehzI8Y4zVfbxouyY
OFFLINE_MODE = false
[mailer]
ENABLED = false
[service]
REGISTER_EMAIL_CONFIRM = false
ENABLE_NOTIFY_MAIL = false
DISABLE_REGISTRATION = false
ALLOW_ONLY_EXTERNAL_REGISTRATION = false
ENABLE_CAPTCHA = false
REQUIRE_SIGNIN_VIEW = false
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 = false
ENABLE_FEDERATED_AVATAR = true
[openid]
ENABLE_OPENID_SIGNIN = true
ENABLE_OPENID_SIGNUP = true
[session]
PROVIDER = file
[log]
MODE = file
LEVEL = info
ROUTER = console
ROOT_PATH = /var/lib/gitea/log
[api]
DEFAULT_PAGING_NUM = 20
MAX_RESPONSE_ITEMS = 200
[git]
PATH =
DISABLE_DIFF_HIGHLIGHT = false
MAX_GIT_DIFF_LINES = 1000
MAX_GIT_DIFF_LINE_CHARACTERS = 5000
MAX_GIT_DIFF_FILES = 100
GC_ARGS =
EnableAutoGitWireProtocol = true
COMMITS_RANGE_SIZE = 50
; 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

4
gitea/start.sh Normal file
View File

@ -0,0 +1,4 @@
#!/bin/bash
/usr/local/bin/gitea web --config /etc/gitea/app.ini
#/usr/local/bin/gitea admin user create --username root --password gitlink#2023 --email root@example.org --config /etc/gitea/app.ini

View File

@ -6,6 +6,9 @@ namespace :sync_table_structure do
database_config = Rails.configuration.database_configuration
table_count = ActiveRecord::Base.connection.query_value("SELECT count(*) FROM information_schema.`TABLES` where TABLE_SCHEMA='#{database_config[Rails.env]["database"]}'")
next if table_count.to_i > 10
database = database_config[Rails.env]["database"]
database_username = database_config[Rails.env]["username"]
database_password = database_config[Rails.env]["password"]
@ -14,7 +17,7 @@ namespace :sync_table_structure do
puts "bash: mysql -u#{database_username} -p#{database_password} -P#{database_port} -h#{database_host} #{database}"
system "mysql -u#{database_username} -p#{database_password} -P#{database_port} -h#{database_host} #{database} < #{Rails.root}/db/structure.sql"
system "mysql --ssl-mode='DISABLED' -u#{database_username} -p#{database_password} -P#{database_port} -h#{database_host} #{database} < #{Rails.root}/db/structure.sql"
puts "init success"
end