mirror of
https://codeberg.org/gothub/pages
synced 2024-12-06 19:16:41 +01:00
1 line
9.5 KiB
JSON
1 line
9.5 KiB
JSON
{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Home","text":"<p>This is the documentation for GotHub, the free and open source alternative front-end for GitHub. It's mostly aimed towards developers and instance owners who want to self-host GotHub.</p> <p>GotHub website GotHub repository</p>"},{"location":"environment_variables/","title":"Environment variables used by GotHub","text":"<p>You can set these in two ways:</p> <ol> <li> <p>Create a .env file in the root directory of GotHub and set the variables there.</p> </li> <li> <p>Set the variables in your environment.</p> </li> </ol>"},{"location":"environment_variables/#instance-configuration","title":"Instance configuration","text":""},{"location":"environment_variables/#gothub_setup_complete","title":"GOTHUB_SETUP_COMPLETE","text":"<p>This variable is used by GotHub to check if you've completed setup or not. The GotHub setup wizard sets this to true for you. If it's empty, you will get a banner on GotHub's main page saying you haven't completed setup. Once you're done setting up GotHub, set this to true.</p>"},{"location":"environment_variables/#gothub_proxying_enabled","title":"GOTHUB_PROXYING_ENABLED","text":"<p>If you don't want to proxy non-essential things (ie. avatars, repo archives, raw files) through your instance, set this to false.</p>"},{"location":"environment_variables/#gothub_ip_logged","title":"GOTHUB_IP_LOGGED","text":"<p>If you log IPs on your instance, set this to true. Otherwise, set it to false.</p>"},{"location":"environment_variables/#gothub_request_url_logged","title":"GOTHUB_REQUEST_URL_LOGGED","text":"<p>If you log request URLs on your instance, set this to true. Otherwise, set it to false.</p>"},{"location":"environment_variables/#gothub_user_agent_logged","title":"GOTHUB_USER_AGENT_LOGGED","text":"<p>If you log user agents on your instance, set this to true. Otherwise, set it to false.</p>"},{"location":"environment_variables/#gothub_diagnostic_info_logged","title":"GOTHUB_DIAGNOSTIC_INFO_LOGGED","text":"<p>If you log diagnostic info on your instance, set this to true. Otherwise, set it to false.</p>"},{"location":"environment_variables/#gothub_instance_privacy_policy","title":"GOTHUB_INSTANCE_PRIVACY_POLICY","text":"<p>URL to your instance's privacy policy. Set to \"\" if you don't have one. For example: <code>GOTHUB_INSTANCE_PRIVACY_POLICY=https://instance.dev/privacy-policy</code></p>"},{"location":"environment_variables/#gothub_instance_country","title":"GOTHUB_INSTANCE_COUNTRY","text":"<p>Country where your instance is hosted. For example: <code>GOTHUB_INSTANCE_COUNTRY=Norway</code></p>"},{"location":"environment_variables/#gothub_instance_provider","title":"GOTHUB_INSTANCE_PROVIDER","text":"<p>Name of your ISP/Hosting provider. For example: <code>GOTHUB_INSTANCE_PROVIDER=Altibox</code></p>"},{"location":"environment_variables/#gothub_instance_cloudflare","title":"GOTHUB_INSTANCE_CLOUDFLARE","text":"<p>If you're using Cloudflare, set this to true. Otherwise, set it to false.</p>"},{"location":"environment_variables/#gothub-server-configuration","title":"GotHub server configuration","text":""},{"location":"environment_variables/#gothub_port","title":"GOTHUB_PORT","text":"<p>Port to run GotHub on. For example: <code>GOTHUB_PORT=8080</code>. This gets overwritten by the \"--port\" flag if you pass it to the \"gothub serve\" command. Set to 3000 by default, optional.</p>"},{"location":"environment_variables/#gothub_user_agent","title":"GOTHUB_USER_AGENT","text":"<p>User agent to use when making requests to GitHub. For example: <code>GOTHUB_USER_AGENT=GotHub/1.0.0</code>. Set to Chrome on Windows 10 by default, optional.</p>"},{"location":"setup_caddy/","title":"Setting up Caddy for GotHub","text":"<p>Setting up the Caddy web server is not hard at all. Caddy is the recommended web server for GotHub, due it being made in Go, having HTTP/3 support and automatic certificate generation.</p> <p>After installing Caddy, append the following to the <code>Caddyfile</code>:</p> <pre><code>gothub.domain.tld {\n reverse_proxy localhost:3000\n}\n</code></pre>"},{"location":"setup_docker/","title":"Setup GotHub in a Docker container","text":"<p>Note</p> <p>Installing an automatic container update tool alongside GotHub is highly recommended. We recommend Watchtower. </p>"},{"location":"setup_docker/#requirements","title":"Requirements","text":"<ul> <li>Docker (duh)</li> <li>A web server (we recommend Caddy)</li> </ul>"},{"location":"setup_docker/#run-method","title":"Run method","text":"<p>Note</p> <p>We recommend you to use the Compose method mentioned below, because it's easier to maintain and update.</p> <p>Our Docker image is available on the Codeberg registry here.</p> <p>You can run GotHub in a Docker container by running the following command:</p> <pre><code>docker run -d --name gothub -p 3000:3000 codeberg.org/gothub/gothub:dev\n</code></pre> <p>You can also run the <code>master</code> branch of GotHub by replacing <code>dev</code> with <code>latest</code>. Confusing, right?</p> <p>Warning</p> <p>GotHub requires a couple of environment variables if you'd like to get listed on the instances list. We mention the most minimal command up there just in case someone wants to run GotHub locally. You can pass a .env file to the docker run command by adding <code>--env-file .env</code> to the command.</p>"},{"location":"setup_docker/#compose-method","title":"Compose method","text":"<p>We have a compose.yml file available on our Codeberg repository. You can find it here.</p> <p>You can run GotHub in a Docker container by running the following command:</p> <pre><code>mkdir gothub\ncd gothub\nwget https://codeberg.org/gothub/gothub/raw/branch/dev/compose.yml\ndocker compose up -d\n</code></pre> <p>Warning</p> <p>You should definitely edit the compose.yml file, as it contains a couple of environment variables you should fill out if you want to get listed on the instances list.</p>"},{"location":"setup_docker/#keep-gothub-up-to-date","title":"Keep GotHub up-to-date","text":"<p>We recommend you get an automatic container update tool alongside GotHub. We recommend Watchtower for this.</p> <p>If you don't want to use Watchtower, you can update GotHub by running the following command:</p> <pre><code>docker compose pull && docker compose down && docker compose up -d\n</code></pre>"},{"location":"setup_manual/","title":"Setup GotHub manually","text":"<p>Note</p> <p>We recommend you to use Docker over manually running GotHub, because it's easier and you can have automatic updates via Watchtower. You can find the Docker documentation here. If you still want to run GotHub manually, you can continue reading.</p>"},{"location":"setup_manual/#requirements","title":"Requirements","text":"<ul> <li>Git</li> <li>Go 1.19 or higher</li> <li>A web server (we recommend Caddy)</li> </ul>"},{"location":"setup_manual/#installation","title":"Installation","text":"<p>You need to clone the repository. You can do this by running the following command:</p> <pre><code>git clone https://codeberg.org/gothub/gothub.git\ngit checkout master\n</code></pre> <p>If you want to run the bleeding edge, in exchange for having to deal with occasional bugs, run the following command:</p> <pre><code>git checkout dev\n</code></pre> <p>Then, you need to build the binary. You can do this by running the following command:</p> <pre><code>go build -ldflags=\"-X codeberg.org/gothub/gothubs/utils.Branch=$(git rev-parse --abbrev-ref HEAD)\"\n</code></pre>"},{"location":"setup_manual/#configuration","title":"Configuration","text":"<p>GotHub uses environment variables for configuration. You can find a list of all environment variables here.</p> <p>GotHub has a setup wizard that will help you configure GotHub. Run the following command to start the setup wizard:</p> <pre><code>./gothub setup\n</code></pre> <p>The wizard will ask you a few questions about your privacy practices, where you're hosting etc. After you've answered all the questions, the wizard will generate a \".env\" file for you. You can then start GotHub by running the following command:</p> <pre><code>./gothub serve\n</code></pre> <p>You can also pass <code>--port</code> to specify a port to run GotHub on. This overrides the GOTHUB_PORT environment variable.</p>"},{"location":"setup_manual/#keep-gothub-up-to-date","title":"Keep GotHub up-to-date","text":"<p>GotHub's CLI has a command to update GotHub. You can run this command by running the following command:</p> <pre><code>./gothub update\n</code></pre> <p>It will try to pull from Git and then rebuild the binary. If it doesn't work, just run <code>git pull</code> and then <code>go build</code>.</p>"},{"location":"setup_nginx/","title":"Setting up NGINX for GotHub","text":"<p>Note</p> <p>NGINX does not support automatic certificate generation. You need to use <code>certbot</code> to create and maintain the certificates but that is out of scope of this tutorial. We also recommend you to try the Caddy web server, because it has automatic HTTPS, HTTP/3 and easier configuration. </p> <p>After installing NGINX, create /etc/nginx/conf.d/gothub.conf with the following contents</p> <pre><code>server {\n listen 80;\n listen [::]:80;\n\n server_name gothub.domain.tld;\n\n # Recommended but not required\n access_log off;\n error_log /var/log/nginx/error.log crit;\n\n location / {\n proxy_pass http://127.0.0.1:3000;\n proxy_set_header X-Forwarded-For $remote_addr;\n proxy_set_header Host $host; # so GotHub knows domain\n proxy_http_version 1.1; # to keep alive\n proxy_set_header Connection \"\"; # to keep alive\n }\n}\n</code></pre>"}]} |