| @@ -1,34 +1,8 @@ | |||
| FROM ubuntu:20.04 | |||
| RUN apt-get update | |||
| RUN DEBIAN_FRONTEND=noninteractive apt install -y tzdata | |||
| # basics | |||
| RUN apt-get install -y libssl-dev curl libmysqlclient-dev imagemagick nodejs mysql-server redis-server | |||
| 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 | |||
| # rvm environment variable | |||
| RUN /bin/bash -l -c "source /etc/profile.d/rvm.sh" | |||
| 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" | |||
| #RUN apt-get install -y nodejs | |||
| WORKDIR /home/app/gitlink | |||
| ADD ./ /home/app/gitlink | |||
| RUN cd /home/app/gitlink | |||
| FROM registry.cn-hangzhou.aliyuncs.com/gitlink/ruby:2.4.5 | |||
| ADD ./ /home/pdl/gitlink | |||
| WORKDIR /home/pdl/gitlink | |||
| RUN /bin/bash -l -c 'gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/' | |||
| @@ -36,7 +10,6 @@ RUN /bin/bash -l -c 'gem update --system' | |||
| RUN /bin/bash -l -c 'gem install bundler -v 2.3.26' | |||
| RUN /bin/bash -l -c 'gem install rake' | |||
| RUN /bin/bash -l -c 'gem install puma -v 5.6.5' | |||
| RUN rm -rf Gemfile.lock | |||
| @@ -46,6 +19,9 @@ RUN touch config/redis.yml | |||
| RUN touch config/elasticsearch.yml | |||
| 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' | |||
| @@ -23,9 +23,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' | |||
| @@ -1,62 +1,29 @@ | |||
| # 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 | |||
| 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 | |||
| 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' } %> | |||
| @@ -1,38 +1,69 @@ | |||
| version: '3' | |||
| networks: | |||
| gitlink: | |||
| external: false | |||
| services: | |||
| mysql: | |||
| image: mysql:5.7.17 | |||
| command: --sql-mode="" | |||
| restart: always | |||
| volumes: | |||
| - ./mysql_data/:/var/lib/mysql | |||
| - ./mysql:/var/lib/mysql | |||
| 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_hat:latest | |||
| 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 | |||
| - gitea admin user create --username root --password gitlink#2023 --email root@example.org --config /etc/gitea/app.ini | |||
| 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 | |||
| build: | |||
| context: ../ | |||
| dockerfile: Dockerfile | |||
| # command: bash -c "rm -f tmp/pids/server.pid && rails s -p 4000 -b '0.0.0.0'" | |||
| environment: | |||
| - MYSQL_USER=root | |||
| - MYSQL_PWD=gitea | |||
| - MYSQL_HOST=mysql | |||
| - GITEA_USER=root | |||
| - GITEA_PWD=gitlink#2023 | |||
| - GITEA_URL=gitea | |||
| command: bash -c "cmd /home/pdl/forgeplus && rm -f tmp/pids/server.pid && rails s -p 4000 -b '0.0.0.0'" | |||
| stdin_open: true | |||
| tty: true | |||
| volumes: | |||
| - .:/home/app/gitlink | |||
| # volumes: | |||
| # - .:/home/app/gitlink | |||
| ports: | |||
| - "4000:4000" | |||
| depends_on: | |||
| - mysql | |||
| - redis | |||
| - gitea | |||
| @@ -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 | |||
| @@ -0,0 +1,3 @@ | |||
| #!/bin/bash | |||
| cp /gitea_hat/gitea_hat /usr/local/bin/gitea | |||
| /usr/local/bin/gitea web --config /etc/gitea/app.ini | |||