Skip to content

Commit 831f4c5

Browse files
committed
Add doc/standalone.md
1 parent 52f9282 commit 831f4c5

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

doc/standalone.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
2+
You don't need to install anything, to start using *cheat.sh*.
3+
The only tool that you need is *curl*, which is typically installed
4+
in every system. In the rare cases when *curl* is not installed,
5+
there should be one of its alternatives in the system: *wget*, *wget2*,
6+
*httpie*, *ftp* (with HTTP support), *fetch*, etc.
7+
8+
There are two cases, when you want to install *cheat.sh* locally:
9+
10+
1. You plan to use it off-line, without Internet access;
11+
2. You want to use your own cheat sheets (additionally, or as a replacement).
12+
13+
In this case you need to install cheat.sh locally.
14+
15+
## How to install cheat.sh locally
16+
17+
To use cheat.sh offline, you need to:
18+
19+
1. Install it,
20+
2. Fetch its data sources.
21+
22+
If you already have the cht.sh cli client locally,
23+
you can use it for the standalone installation.
24+
Otherwise it must be installed first.
25+
26+
```
27+
curl https://cht.sh/:cht.sh > ~/bin/cht.sh
28+
chmod +x ~/bin/cht.sh
29+
```
30+
31+
Now you can install cheat.sh locally:
32+
33+
```
34+
cht.sh --standalone-install
35+
```
36+
37+
During the installation process, cheat.sh and its
38+
data sources will be installed locally.
39+
40+
By default `~/.cheat.sh` is used as the installation
41+
directory.
42+
43+
![cheat.sh standalone installation](https://user-images.githubusercontent.com/3875145/57986904-ef3f1b80-7a7a-11e9-9531-ef37ec74b03a.png)
44+
45+
## Update cheat sheets
46+
47+
Cheat sheets are fetched and installed to `~/.cheat.sh/upstream`.
48+
To keep the cheat sheets up to date,
49+
run the `cheat.sh` `update-all` command on regular basis.
50+
Ideally, add it to *cron*:
51+
52+
```
53+
0 5 0 0 0 $HOME/.cheat.sh/ve/bin/python $HOME/.cheat.sh/lib/fetch.py update-all
54+
```
55+
56+
In this example, all information sources will be updated
57+
each day at 5:00 local time, on regular basis.
58+
59+
## cheat.sh server mode
60+
61+
Your local cheat.sh installation is full-fledged, and it can
62+
handle incoming HTTP/HTTPS queries.
63+
64+
To start cheat.sh in the server mode, run:
65+
66+
```
67+
$HOME/.cheat.sh/ve/bin/python $HOME/.cheat.sh/bin/srv.py
68+
```
69+
70+
You can also use `gunicorn` to start the cheat.sh server.
71+
72+
73+
## Docker
74+
75+
You can deploy cheat.sh as a docker container.
76+
Use `Dockerfile` in the source root directory, to build the Docker image:
77+
78+
```
79+
docker build .
80+
```
81+
82+
## Limitations
83+
84+
Some cheat sheets not available in the offline mode
85+
for the moment. The reason for that is that to process some queries,
86+
cheat.sh needs to access the Internet itself, because it does not have
87+
the necessary data locally. We are working on that how to overcome
88+
this limitation, but for the moment it still exists.
89+

0 commit comments

Comments
 (0)