Failed to `launcher rebuild app` for always, how can I replace github to a mainland Chinese mirror?

AI-generated summary

The discussion revolves around the issue of failing to launcher rebuild app due to GitHub being inaccessible in mainland China. snakeninny encounters an error when updating via launcher rebuild app and believes it’s because GitHub is banned in China. linyuiu shares the same error. Dotila_Li suggests using a Hong Kong server.

snakeninny provides a solution by adding code to templates/web.china.template.yml to replace GitHub with a Chinese mirror, specifically using https://githubfast.com/ and configuring gem sources, bundle, and yarn to use mirrors from Tsinghua University and Huawei Cloud. This solution aims to bypass the GitHub ban in mainland China.

When I was updating via launcher rebuild app, I always got error like this:

...
I, [2023-02-25T16:34:01.790521 #1]  INFO -- : > cd /var/www/discourse && sudo -H -E -u discourse git clean -f
I, [2023-02-25T16:34:01.969445 #1]  INFO -- : 
I, [2023-02-25T16:34:01.969665 #1]  INFO -- : > cd /var/www/discourse && sudo -H -E -u discourse git remote set-branches --add origin main
I, [2023-02-25T16:34:01.980319 #1]  INFO -- : 
I, [2023-02-25T16:34:01.980423 #1]  INFO -- : > cd /var/www/discourse && sudo -H -E -u discourse git remote set-branches origin stable
I, [2023-02-25T16:34:01.991560 #1]  INFO -- : 
I, [2023-02-25T16:34:01.991883 #1]  INFO -- : > cd /var/www/discourse && sudo -H -E -u discourse git fetch --depth 1 origin stable
fatal: unable to access 'https://github.com/discourse/discourse.git/': GnuTLS recv error (-110): The TLS connection was non-properly terminated.
...
FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && sudo -H -E -u discourse git fetch --depth 1 origin stable failed with return #<Process::Status: pid 144 exit 128>
Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"code", "cmd"=>["sudo -H -E -u discourse git reset --hard", "sudo -H -E -u discourse git clean -f", "sudo -H -E -u discourse git remote set-branches --add origin main", "sudo -H -E -u discourse git remote set-branches origin $version", "sudo -H -E -u discourse git fetch --depth 1 origin $version", "sudo -H -E -u discourse git checkout $version", "mkdir -p tmp", "chown discourse:www-data tmp", "mkdir -p tmp/pids", "mkdir -p tmp/sockets", "touch tmp/.gitkeep", "mkdir -p                    /shared/log/rails", "bash -c \"touch -a           /shared/log/rails/{production,production_errors,unicorn.stdout,unicorn.stderr,sidekiq}.log\"", "bash -c \"ln    -s           /shared/log/rails/{production,production_errors,unicorn.stdout,unicorn.stderr,sidekiq}.log $home/log\"", "bash -c \"mkdir -p           /shared/{uploads,backups}\"", "bash -c \"ln    -s           /shared/{uploads,backups} $home/public\"", "bash -c \"mkdir -p           /shared/tmp/{backups,restores}\"", "bash -c \"ln    -s           /shared/tmp/{backups,restores} $home/tmp\"", "chown -R discourse:www-data /shared/log/rails /shared/uploads /shared/backups /shared/tmp", "[ ! -d public/plugins ] || find public/plugins/ -maxdepth 1 -xtype l -delete"]}
bootstrap failed with exit code 128
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.
751de54716a7a145e5dc813d9b25330322dbcd69ec1a047d38267c86a57a990c

I believe that github was banned in mainland China so I need to replace https://github.com with a CN mirror like https://hub.fgit.gq
Is it possible and how can I do that? Thanks!

I have the same error, have you solved the problem now

Try using Hongkong server

Put the following code in templates/web.china.template.yml:

hooks:
  before_code:
    - exec:
        cmd:
          - su discourse -c 'git config --global url."https://githubfast.com/".insteadOf "https://github.com/"'

  before_web:
    - exec:
        cmd:
          - su discourse -c 'gem sources --add https://mirrors.tuna.tsinghua.edu.cn/rubygems/ --remove https://rubygems.org/'
          - su discourse -c 'bundle config mirror.https://rubygems.org https://mirrors.tuna.tsinghua.edu.cn/rubygems'

  before_yarn:
    - exec:
        cmd:
          - su discourse -c 'yarn config set registry https://mirrors.huaweicloud.com/repository/npm/'
          - su discourse -c 'pnpm config set registry https://mirrors.huaweicloud.com/repository/npm/'

  before_bundle_exec:
    - exec:
        cmd:
          - su discourse -c 'bundle config mirror.https://rubygems.org https://mirrors.tuna.tsinghua.edu.cn/rubygems'