summaryrefslogtreecommitdiff
path: root/weblate/SETUP-NOTES.md
blob: b5e11fa9e8a59921faf202e6e526310c759ed116 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
## Weblate.taler.net Setup Notes

### The purpose of this is to document how the weblate.taler.net service was built, in the event that it needs to be repaired, changed, reproduced, etc.

Always refer to https://docs.weblate.org/ if necessary, or just for a good laugh.

### Upgrading

See latest recommendations:
https://docs.weblate.org/en/latest/admin/upgrade.html?highlight=upgrade#generic-upgrade-instructions

Current process:

```
$ . ~/weblate-env/bin/activate

$ systemctl --user stop celery-weblate

$ systemctl --user stop uwsgi-weblate

$ pip install -U Weblate

$ maybe re-build settings.py from ~/weblate-env/lib/python3.8/site-packages/weblate/settings_example.py

$ weblate collectstatic --noinput

$ weblate check --deploy
```

### Basic structure:

This weblate instance runs as a python3 virtualenv under non-priv `/home/weblate`.

The generic instructions used to build the site are here, and were followed closely:
https://docs.weblate.org/en/latest/admin/install/venv-debian.html

#### Notes on general installation:

* settings document is in `~/weblate-env/lib/python3.8/site-packages/weblate/settings.py` (see symlink in ~) (backup copy in `.`)
* "data directory" or "DATA_DIR" is `~/weblate-env/lib/python3.8/site-packages/data/` (see symlink to `DATA_DIR/` in ~)
* virtualenv is invoked anytime with `. ~/weblate-env/bin/activate`.  This activates the weblate path to access weblate binaries without full paths.

### Configuration

#### `/home/weblate` shell account

  non-priv user with access via SSH key
  celery and uwsgi services run under this user (see *systemd* below)

#### postgres

 configured for `localhost` access only (ie - `$ psql`)
 no password
 Unix `weblate` user has full control over psql 'weblate' user
 Must manually create 'weblate' database
 DB Credentials added to `settings.py` "DATABASES" section

Do this:
 `psql=> CREATE EXTENSION pg_trgm;``

#### e-mail

 weblate@taler.net
  * no password
  * available via localhost using SMTP
  * info added to `settings.py` in Django format:
    `EMAIL_HOST_USER = 'weblate'`
    (`EMAIL_HOST` and `EMAIL_PORT` not required re: defaults to localhost and 25)
  * Test E-mail from `/home/weblate`:

    ```
    # telnet localhost 25
    Trying 127.0.0.1...
    Connected to localhost.
    Escape character is '^]'.
    220 gv.taler.net ESMTP Postfix
    HELO localhost
    250 gv.taler.net
    MAIL From: weblate@taler.net
    250 2.1.0 Ok
    RCPT To: weblate@gnunet.org
    250 2.1.5 Ok
    DATA
    354 End data with <CR><LF>.<CR><LF>
    hello
    .
    250 2.0.0 Ok: queued as xxxxx
    quit
    221 2.0.0 Bye
    Connection closed by foreign host.
    ```

#### Python modules

From https://docs.weblate.org/en/latest/admin/install/venv-debian.html#python-modules

All-day modules installed:

`$ pip install Weblate aeidon psycopg2-binary`

#### nginx

This root-level service can be found in the `root` repository.

#### uwsgi

uwsgi: https://docs.weblate.org/en/latest/admin/install.html?highlight=uwsgi#sample-configuration-for-nginx-and-uwsgi

See **systemd** below for customization information.

#### celery

Celery: https://docs.weblate.org/en/latest/admin/install.html#celery

See **systemd** below for customization information.

#### systemd

Our needs require running weblate under `weblate` user as a non-priv service.  This requires running celery-weblate and uwsgi-weblate services as user-level systemd services.

* See service files under `systemd-nonpriv/` in this repo.
* On server, non-priv `systemd` files live in `/home/weblate/.config/systemd/user/`
* Commands:
  `$ systemctl --user enable | disable | start | stop | status *servicename*`

#### rollbar

For error collection: https://docs.weblate.org/en/weblate-4.0.2/admin/install.html#collecting-errors

(in virtualenv): `$ pip install rollbar`



### Running Weblate

After installing and customizing, log into `weblate` shell account, and invoke virtualenv:

`$ . ~/weblate-env/bin/activate`

Now run Django static files collection (required once):
(https://docs.weblate.org/en/latest/admin/install.html?highlight=uwsgi#serving-static-files)

`$ weblate collectstatic --noinput`

Weblate server should now be set up and visible at the location specified in the nginx `weblate.site` file.  If the site is visible but looks like it's missing CSS styles, that's a problem with the static files.  Common causes:

* static files were not collected
* nginx is not pointing to the correct location
  * maybe the `/home/weblate/DATA_DIR` symlink is broken?