README.md (4014B)
1 # stagit-scripts
2
3 Please send patches or remarks to
4 [jayvii+stagit-scripts[AT]posteo[DOT]de](mailto:jayvii+stagit-scripts[AT]poste[DOT]de)
5
6 Some scripts and assets to run [src.jayvii.de](https://src.jayvii.de).
7
8 ## Structure
9
10 ```
11 |- bin/
12 | |- git_create_repo.sh Creates A bare repository and HTML viewer
13 | |- git_post_push.sh Used as post-push hook in repositories
14 | |- git_post_push_all.sh Trigger post-update hook in all repositories
15 | |- git_set_clone_url.sh Sets necessary URL to clone via http(s)
16 | |- git_update_index_html.sh Updates the repository overview HTML page
17 | |- git_update_repo_html.sh Updates the respository HTML viewer pages
18 | '- git_update_repo.sh Updates git information to clone via http(s)
19 |
20 |- assets/
21 | |- favicon.png Favicon and Logo of the page
22 | |- backicon.png Logo for the "back" button in repos
23 | |- style.css CSS for the HTML viewer
24 | '- index.css CSS for the file index viewer
25 |
26 |- 404.html 404 Page
27 |- index.html Index-Page for the Main site, redirects to /pub/
28 |- .htaccess htaccess file with defaults for security
29 '- .gitignore Files to be ignored when checking out git
30 ```
31
32 There are additional links for CSS and icon files.
33
34 ## Setup
35
36 1. Install https://www.codemadness.org/git/stagit/ on your Server
37
38 2. Use this template:
39
40 ```bash
41 git clone https://src.jayvii.de/pub/stagit-scripts.git /var/www/git.myserver.com
42 ```
43
44 3. Setup the HTML Root:
45
46 ```bash
47 mkdir -p /var/www/git.myserver.com/{pub,priv}
48 ```
49
50 4. Setup git-user:
51
52 ```bash
53 useradd -r -m -U -d /var/www/git.myserver.com -s /bin/sh -G www-data git
54 ```
55
56 ### Private Repositories
57
58 Private repositories reside within `/prv`, while your public repositories
59 are in `/pub`. Access to the private repositories is restricted via HTTP
60 [Basic Authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication).
61
62 A .htaccess file is provided within the `/prv` directory, however you also need
63 to set up a user/password for the web-access, e.g. here for the user "username":
64
65 ```bash
66 sudo htpasswd -c /etc/apache2/.htpassword username
67 ```
68
69 ### Optional Tweaks
70
71 Set your stagit server's URL via the "url" file:
72
73 ```bash
74 echo "https://src.example.com" > /var/www/src.example.com/url
75 ```
76
77 You may also setup SSH-credentials for the user or SSH-Auth keys.
78
79 You most likely want to setup a webserver (e.g. Apache2) with "/var/www/
80 git.myserver.com" (home of user "git") as its root-dir.
81
82 As long as user "git" is in the group "www-data", file permissions should
83 generally be no problem. For good measure, you may however still set up cron-job
84 that enforces file permissions every now and then. In crontab, use following
85 entries (assuming your git-folder is located in "/var/www/src.example.com"):
86
87 ```cron
88 0 0 * * * chown git:www-data -R /var/www/src.example.com
89 0 0 * * * chmod 770 -R /var/www/src.example.com
90 ```
91
92 ## Examples
93
94 You'll find a post-update hook example in the "examples/hooks/" directory.
95
96 ```
97 examples/
98 |
99 '- hooks/
100 |- post-update.sample1 Automatic packaging and deployment
101 '- post-update.sample2 REUSE linting on push
102 ```
103
104 ## Further notes
105
106 New repositories can be created via the webform in "/create_repo/index.html" or
107 via an according GET request to that PHP-script:
108
109 ```bash
110 curl https://src.example.com/create_repo/?name=test_repo&description=this%20is%20just%20a%20test%20repository&owner=me&type=pub
111 ```
112
113 The "/create_repo/" endpoint is restricted to authenticated users via htaccess
114 (just like the "/priv/" repositories). A GET request therefore has to supply the
115 authentication credentials accordingly.
116
117 ## License
118
119 stagit-scripts is licensed under AGPL-3.0-or-later.
120
121 ### Bundled Assets
122
123 favicon.png & backicon.png are modified versions of materialdesignicons and are
124 licensed under Apache-2.0.
125
126 stagit (https://www.codemadness.org/git/stagit) and some of its assets used here
127 are licensed under MIT.