Changes for page How to set up a gitea docker instance
Last modified by Alexandru Pentilescu on 2024/07/16 22:44
From version 2.1
edited by Alexandru Pentilescu
on 2024/07/16 20:56
on 2024/07/16 20:56
Change comment:
There is no comment for this version
To version 4.1
edited by Alexandru Pentilescu
on 2024/07/16 21:17
on 2024/07/16 21:17
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -40,3 +40,61 @@ 40 40 networks: 41 41 - gitea 42 42 {{/code}} 43 + 44 +What the above docker-compose configuration will do is that it will, in essence, create two, always on, services, that will forever be restarted: a mariadb database server that will write all of its data to a local "db" directory, and another web service that will server as the main git server and the web server alongside it. 45 + 46 +Before starting the docker services, please create the necessary resources first. 47 + 48 += Create the required local directories to store the data in = 49 + 50 +Do a simple command to create the necessary directories: 51 + 52 +{{code language="bash"}} 53 +mkdir data db 54 +{{/code}} 55 +Backing up just these two directories should, in theory, be enough to allow for full restoration of all git repository resources into the future. **WARNING: This has not been tested yet!!!** 56 + 57 += Create a separate git user to login into via SSH = 58 +Creating a separate user, technically, is unnecessary, but it makes the configuration more conventional. 59 + 60 +{{code language="bash"}} 61 +useradd -m -u 1002 git 62 +{{/code}} 63 + 64 +Assuming the 1002 UID is already assigned to a different user, feel free to use a different UID (**be sure to update the yaml configuration with the proper user ID, then**). 65 + 66 +Once this configuration has been done, go ahead and generate an /home/git/.ssh/ directory for the user to have. Be sure to chown this specific directory to the git user as appropriate: 67 + 68 +{{code language="bash"}} 69 +chown git:git -R /home/git/.ssh/ 70 +chmod 700 /home/git/.ssh/ 71 +{{/code}} 72 + 73 +Once all these steps are done, you can proceed to the next step. 74 + 75 += Spin up a container from the docker image = 76 + 77 +{{code language="bash"}} 78 +docker-compose up -d 79 +{{/code}} 80 + 81 +Had all the necessary steps been done properly, this should yield a fully functional container. If there are any errors encountered by this point, please fix them before proceeding. 82 + 83 += Set up a proper nginx endpoint for the docker service = 84 +Deploy the following configuration to make the container accessible to the outside world: 85 + 86 +{{code language="nginx"}} 87 +server { 88 + server_name git.transistor.one; 89 + 90 + listen [::]:443 http2 ssl; # managed by Certbot 91 + listen 443 http2 ssl; # managed by Certbot 92 + # http2 on; 93 + 94 + include /etc/nginx/snippets/ssl.conf; 95 + 96 + location / { 97 + proxy_pass http://localhost:3000; 98 + } 99 +} 100 +{{/code}}