{"id":519,"date":"2018-06-18T20:23:58","date_gmt":"2018-06-18T20:23:58","guid":{"rendered":"http:\/\/wp.spoton.cz\/?p=519"},"modified":"2018-06-18T20:23:58","modified_gmt":"2018-06-18T20:23:58","slug":"gitea-whats-up","status":"publish","type":"post","link":"https:\/\/spoton.cz\/index.php\/2018\/06\/18\/gitea-whats-up\/","title":{"rendered":"Gitea, what&#8217;s up?"},"content":{"rendered":"<p>GitHub has been recently (as of writing this article) acquired by Micro$oft. Some might like it, some might not. If you, as I do, belong to the GTFO camp, let&#8217;s face it: There is a quadrillion of possibilities, some are plain stupid, others perfectly perfect. I choose GiTea &#8211; and self-hosted on top of that!<\/p>\n<p><!--more--><\/p>\n<h2>The choice<\/h2>\n<p>Now this was a simple one. Why do I prefer Gitea over anything else? I do not have any, I mean ANY knowledge base of GitLab, Gitea, Gogs, or whatever else, I am a book yet to be written in this regard.<\/p>\n<p>My choice was purely an intuitive one. I like tea. That&#8217;s it, full stop.<\/p>\n<p>Now let&#8217;s get it installed and look at what it looks like. I definitely want to self-host it, as I do not want to move anymore. This will be my last Git GUI Repo of my life! \ud83d\ude42<\/p>\n<h2>The install<\/h2>\n<p>Just find the latest bin \/ script, ironically enough, hosted on GitHub as the first iteration I found. Later, I managed to find one on gitea as well.<\/p>\n<p>This install will be done on Linux, of course, as Linux is the go-to server platform OS today and Win just sucks.\u00a0<\/p>\n<p>I&#8217;ve created a user named &#8220;git&#8221; some time ago and had a plain old git remote rpository on this server, so running gitea as the &#8220;git&#8221; user only makes sense to me.<\/p>\n<pre>su - git\nwget https:\/\/dl.gitea.io\/gitea\/1.4.2\/gitea-1.4.2-linux-amd64 -O gitea<\/pre>\n<p>This will get you everyhting you need. Almost. It will not get you the DB to use, but let&#8217;s talk about later on that.<\/p>\n<p>Instructions say it clearly:\u00a0<\/p>\n<pre>.\/gitea web\n2018\/06\/18 19:50:53 [W] Custom config '\/home\/git\/custom\/conf\/app.ini' not found, ignore this if you're running first time\n2018\/06\/18 19:50:53 [T] AppPath: \/home\/git\/gitea\n2018\/06\/18 19:50:53 [T] AppWorkPath: \/home\/git\n2018\/06\/18 19:50:53 [T] Custom path: \/home\/git\/custom\n2018\/06\/18 19:50:53 [T] Log path: \/home\/git\/log\n2018\/06\/18 19:50:53 [I] Gitea v1.4.2 built with: bindata, sqlite\n2018\/06\/18 19:50:53 [I] Log Mode: Console(Info)\n2018\/06\/18 19:50:53 [I] XORM Log Mode: Console(Info)\n2018\/06\/18 19:50:53 [I] Cache Service Enabled\n2018\/06\/18 19:50:53 [I] Session Service Enabled\n2018\/06\/18 19:50:53 [I] SQLite3 Supported\n2018\/06\/18 19:50:53 [I] Run Mode: Development\n2018\/06\/18 19:50:53 Serving [::]:3000 with pid 12321\n2018\/06\/18 19:50:53 [I] Listen: http:\/\/0.0.0.0:3000\n\n<\/pre>\n<p>Now this should launch a web application that should guide you through the rest of the setup process &#8211; on the port 3000.<\/p>\n<p>If you don&#8217;t have it open, open it now, at least for the time of installation<\/p>\n<p>Opened browser, typed in http:\/\/bastart.spoton.cz:3000 and voila:<\/p>\n<p><a href=\"http:\/\/wp.spoton.cz\/wp-content\/uploads\/2018\/06\/Screenshot_2018-06-18_21-52-36.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-520\" src=\"http:\/\/wp.spoton.cz\/wp-content\/uploads\/2018\/06\/Screenshot_2018-06-18_21-52-36.png\" alt=\"\" width=\"1087\" height=\"563\" srcset=\"https:\/\/spoton.cz\/wp-content\/uploads\/2018\/06\/Screenshot_2018-06-18_21-52-36.png 1087w, https:\/\/spoton.cz\/wp-content\/uploads\/2018\/06\/Screenshot_2018-06-18_21-52-36-300x155.png 300w, https:\/\/spoton.cz\/wp-content\/uploads\/2018\/06\/Screenshot_2018-06-18_21-52-36-1024x530.png 1024w, https:\/\/spoton.cz\/wp-content\/uploads\/2018\/06\/Screenshot_2018-06-18_21-52-36-768x398.png 768w\" sizes=\"(max-width: 1087px) 100vw, 1087px\" \/><\/a><\/p>\n<p>It was at this point, I realized, hell, I don&#8217;t have a database installed! On the other hand, it should be built with sqlite and it is even said at the startup. Well, select SQLite, change some settings to fit my needs and fire!<\/p>\n<p>Tada, that was simple!<\/p>\n<h2>Now, how to get it started with systemd<\/h2>\n<p>This is quite simple, although there are some things we need to care about.<\/p>\n<p>First of all, let&#8217;s create the service file in <strong>\/etc\/systemd\/system\/gitea.service\u00a0<\/strong>with this content:<\/p>\n<pre>[Unit]\nDescription=Gitea. Git with a cup of tea\nAfter=network-online.target\nBefore=multi-user.target\nDefaultDependencies=no\n\n[Service]\nUser=git\nGroup=git\nLimitNOFILE=65536\nWorkingDirectory=\/home\/git\nExecStart=\/home\/git\/gitea web\nKillMode=control-group\nRestartSec=60\nRestart=on-failure\n\n[Install]\nWantedBy=multi-user.target\nAlias=gitea.service<\/pre>\n<p>I will not go through the systemd stuff in much detail, just make sure you are using absolute paths and the user running gitea is a non-priv user (i.e. not root)<\/p>\n<p>Now there is one more thing to be aware of, namely the configuration file in <strong>\/home\/git\/custom\/conf\/app.ini<\/strong><\/p>\n<p>By default, if using SQLite, the data path is not an absolute path, change it, so the PATH variable is set as ABSOLUTE PATH:<\/p>\n<pre>[database]\nDB_TYPE = sqlite3\nHOST = 127.0.0.1:5432\nNAME = gitea\nUSER = gitea\nPASSWD =\nSSL_MODE = disable\nPATH = \/home\/git\/data\/gitea.db<\/pre>\n<p>Now just do the other simple stuff:<\/p>\n<pre>systemctl enable gitea\nservice gitea start<\/pre>\n<p>To check if OK<\/p>\n<pre>service gitea status\ngitea.service - Gitea. Git with a cup of tea\nLoaded: loaded (\/etc\/systemd\/system\/gitea.service; enabled)\nActive: active (running) since Tue 2018-06-19 11:38:15 UTC; 1min 11s ago\nMain PID: 26651 (gitea)\nCGroup: \/system.slice\/gitea.service\n\u2514\u250026651 \/home\/git\/gitea web\nJun 19 11:38:15 debian-512mb-nyc3-01 systemd[1]: Started Gitea. Git with a cup of tea. Jun 19 11:38:15 debian-512mb-nyc3-01 gitea[26651]: 2018\/06\/19 11:38:15 [T] AppPath: \/home\/git\/gitea Jun 19 11:38:15 debian-512mb-nyc3-01 gitea[26651]: 2018\/06\/19 11:38:15 [T] AppWorkPath: \/home\/git Jun 19 11:38:15 debian-512mb-nyc3-01 gitea[26651]: 2018\/06\/19 11:38:15 [T] Custom path: \/home\/git\/custom Jun 19 11:38:15 debian-512mb-nyc3-01 gitea[26651]: 2018\/06\/19 11:38:15 [T] Log path: \/home\/git\/log Jun 19 11:38:16 debian-512mb-nyc3-01 gitea[26651]: 2018\/06\/19 11:38:16 Serving [::]:3000 with pid 26651\n\njournalctl -u gitea\u00a0 \nJun 19 11:38:15 debian-512mb-nyc3-01 systemd[1]: Starting Gitea. Git with a cup of tea... \nJun 19 11:38:15 debian-512mb-nyc3-01 systemd[1]: Started Gitea. Git with a cup of tea. \nJun 19 11:38:15 debian-512mb-nyc3-01 gitea[26651]: 2018\/06\/19 11:38:15 [T] AppPath: \/home\/git\/gitea Jun 19 11:38:15 debian-512mb-nyc3-01 gitea[26651]: 2018\/06\/19 11:38:15 [T] AppWorkPath: \/home\/git Jun 19 11:38:15 debian-512mb-nyc3-01 gitea[26651]: 2018\/06\/19 11:38:15 [T] Custom path: \/home\/git\/custom \nJun 19 11:38:15 debian-512mb-nyc3-01 gitea[26651]: 2018\/06\/19 11:38:15 [T] Log path: \/home\/git\/log \nJun 19 11:38:16 debian-512mb-nyc3-01 gitea[26651]: 2018\/06\/19 11:38:16 Serving [::]:3000 with pid 26651<\/pre>\n<p>&nbsp;<\/p>\n<h2>The aftermath<\/h2>\n<p>I&#8217;ll poke around the new GUI and see what it brings&#8230;\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>GitHub has been recently (as of writing this article) acquired by Micro$oft. Some might like it, some might not. If [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":522,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,5,9],"tags":[49,51,59,83,89,92,100,101],"_links":{"self":[{"href":"https:\/\/spoton.cz\/index.php\/wp-json\/wp\/v2\/posts\/519"}],"collection":[{"href":"https:\/\/spoton.cz\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/spoton.cz\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/spoton.cz\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/spoton.cz\/index.php\/wp-json\/wp\/v2\/comments?post=519"}],"version-history":[{"count":0,"href":"https:\/\/spoton.cz\/index.php\/wp-json\/wp\/v2\/posts\/519\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/spoton.cz\/index.php\/wp-json\/wp\/v2\/media\/522"}],"wp:attachment":[{"href":"https:\/\/spoton.cz\/index.php\/wp-json\/wp\/v2\/media?parent=519"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/spoton.cz\/index.php\/wp-json\/wp\/v2\/categories?post=519"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/spoton.cz\/index.php\/wp-json\/wp\/v2\/tags?post=519"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}