2 @documentencoding UTF-8
6 Copyright @copyright{} 2019 @email{stargrave@@stargrave.org, Sergey Matveev}
12 GoCheese is Python private package repository and caching proxy.
14 It serves two purposes:
17 @item proxying and caching of missing packages from upstream
18 @url{https://pypi.org/, PyPI}, conforming to
19 @url{https://www.python.org/dev/peps/pep-0503/, PEP-0503}
20 (Simple Repository API)
21 @item hosting of private locally uploaded packages, conforming to
22 @url{https://warehouse.pypa.io/api-reference/legacy/, Warehouse Legacy API}
25 Why could you like it and how it can be better to fit your needs?
28 @item No database required. Only filesystem storage with few simple
29 files per package. Package deletion, renaming, making it uploadable
30 (private) is done with simple @command{mkdir}, @command{touch}, etc
32 @item Just single statically compiled Go binary
33 @item No configuration file, but several simple command line arguments
34 @item Consistency (because of atomic synced operations) and integrity
35 (because of SHA256 checksums stored nearby)
38 Initially it was created as a fork of
39 @url{https://github.com/c4s4/cheeseshop, cheeseshop},
40 but nearly all the code was rewritten. It has huge differences:
43 @item Proxying and caching of missing packages, including GPG signatures
44 @item @url{https://pythonwheels.com/, Wheel} uploading support
45 @item Integrity check of proxied packages: MD5, SHA256, SHA512, BLAKE2b-256
46 @item SHA256 checksums for stored packages
47 @item Verifying of SHA256 checksum for uploaded packages
48 @item Storing of uploaded GPG signatures
49 @item Secure Argon2i (or SHA256) stored passwords hashing
50 @item No YAML configuration, just command-line arguments
51 @item No package overwriting ability (as PyPI does too)
52 @item Graceful HTTP-server shutdown
53 @item Atomic packages store on filesystem
56 Also it contains @file{pyshop2packages.sh} migration script for
57 converting @url{https://pypi.org/project/pyshop/, Pyshop} database into
58 GoCheese one, including private packages.
60 GoCheese is free software, licenced under
61 @url{https://www.gnu.org/licenses/gpl-3.0.html, GNU GPLv3}:
62 see the file COPYING for copying conditions.
64 Please send questions, bug reports and patches to @url{gocheese@@cypherpunks.ru}.
71 * Password authentication: Passwords.
73 * Storage format: Storage.
81 To use it for download purposes, just configure your @file{pip.conf}:
85 index-url = http://gocheese.host:8080/simple/
88 @option{-refresh} URL (@code{/simple/} by default) automatically
89 refreshes metainformation (available versions and their checksums)
90 from the upstream, when queried for package directory listing.
91 @option{-norefresh} prevents upstream queries.
93 @option{-gpgupdate} is useful mainly for migrated for Pyshop migrated
94 repositories. It forces GPG signature files downloading for all existing
97 You can upload packages to it with @url{https://pypi.org/project/twine/, twine}:
101 --repository-url http://gocheese.host:8080/simple/ \
103 --password foo dist/tarball.tar.gz
106 Or you can store it permanently in @file{.pypirc}:
110 repository: https://gocheese.host/simple/
115 If @command{twine} sends SHA256 checksum in the request, then uploaded
116 file is checked against it.
118 Pay attention that you have to manually create corresponding private
119 package directory! You are not allowed to upload anything explicitly
120 flagged as internal package.
123 @unnumbered Password authentication
125 Password authentication is required for packages uploading.
126 You have to store your authentication data in @option{-passwd} file in
130 username:hashed-password
133 Empty lines and having @verb{|#|} at the beginning are skipped.
135 Supported hashing algorithms are:
139 @item @url{https://www.argon2i.com/, Argon2i} (recommended one!)
140 To get Argon2i hashed-password you can use any of following tools:
142 @item @url{https://github.com/balakhonova/argon2i,
143 go get github.com/balakhonova/argon2i} (Go)
144 @item @url{https://github.com/p-h-c/phc-winner-argon2} (C)
146 Example user @code{foo} with password @code{bar} can have the
147 following password file entry:
150 foo:$argon2i$v=19$m=32768,t=3,p=4$OGU5MTM3YjVlYzQwZjhkZA$rVn53v6Ckpf7WH0676ZQLr9Hbm6VH3YnL6I9ONJcIIU
154 You can use your operating system tools:
158 $ echo -n "password" | sha256
160 # GNU/Linux-based systems
161 $ echo -n "password" | sha256sum
164 Example user @code{foo} with password @code{bar} will have the
165 following password file entry:
168 foo:$sha256$fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9
173 You can refresh passwords by sending @code{SIGHUP} signal to the working daemon:
176 $ pkill -HUP gocheese
177 $ kill -HUP `pidof gocheese`
180 Before refreshing it's recommended to check @option{-passwd} file with
181 @option{-passwd-check} option to prevent daemon failure.
184 @unnumbered TLS support
186 You can enable TLS support by specifying PEM-encoded X.509 certificate
187 and private key files. Go's TLS implementation supports TLS 1.3, HTTP/2
188 negotiation, Keep-Alives, modern ciphersuites and ECC.
190 For example generate some self-signed certificate using GnuTLS toolset:
193 $ certtool --generate-privkey --ecc --outfile prv.pem
194 $ cert_template=`mktemp`
195 $ echo cn=gocheese.host > $cert_template
197 --generate-self-signed \
198 --load-privkey=prv.pem \
199 --template $cert_template \
202 $ gocheese -tls-cert cert.pem -tls-key prv.pem [...]
206 @unnumbered Storage format
208 Root directory has the following hierarchy:
213 | +- public-package-0.1.tar.gz.md5
214 | +- public-package-0.1.tar.gz.blake2_256
215 | +- public-package-0.1.1.tar.gz.blake2_256
216 | +- public-package-0.2.tar.gz
217 | +- public-package-0.2.tar.gz.asc
218 | +- public-package-0.2.tar.gz.sha256
221 | +- private-package-0.1.tar.gz
222 | +- private-package-0.1.tar.gz.asc
223 | +- private-package-0.1.tar.gz.sha256
227 Each directory is a normalized package name. When you try to list non
228 existent directory contents (you are downloading package you have not
229 seen before), then GoCheese will download information about package's
230 versions with checksums and write them in corresponding
231 @file{.sha256}, @file{.blake2_256}, @file{.sha512}, @file{.md5} files.
232 However no package package tarball is downloaded.
234 When you request for particular package version, then its tarball is
235 downloaded and verified against the stored checksum. But SHA256 is
236 forced to be stored and used later.
238 For example @file{public-package} has @code{0.1} version, downloaded a
239 long time ago with MD5 checksum. @code{0.1.1} version is downloaded more
240 recently with BLAKE2b-256 checksum, also storing that checksum for
241 @code{0.1}. @code{0.2} version is downloaded tarball, having forced
242 SHA256 recalculated checksum. Also upstream has corresponding
243 @file{.asc} signature file.
245 @file{private-package} is private package, because it contains
246 @file{.internal} file. It can be uploaded and queries to it are not
247 proxied to upstream PyPI. You have to create it manually. If you upload
248 GPG signature, then it will be also stored.