<a id="install"></a>

# Petunjuk konfigurasi

## Memasang Weblate

Bergantung pada pengaturan dan pengalaman Anda, pilih metode pemasangan yang tepat untuk Anda:

* [Memasang menggunakan Docker](https://docs.weblate.org/id/latest/admin/install/docker.md), direkomendasikan untuk pengaturan produksi.
* Pemasangan Virtualenv, direkomendasikan untuk pengaturan produksi:
  * [Memasang di Debian dan Ubuntu](https://docs.weblate.org/id/latest/admin/install/venv-debian.md)
  * [Memasang di SUSE dan openSUSE](https://docs.weblate.org/id/latest/admin/install/venv-suse.md)
  * [Memasang di RedHat, Fedora dan CentOS](https://docs.weblate.org/id/latest/admin/install/venv-redhat.md)
  * [Memasang di macOS](https://docs.weblate.org/id/latest/admin/install/venv-macos.md)
* [Memasang dari sumber](https://docs.weblate.org/id/latest/admin/install/source.md), direkomendasikan untuk pengembangan.
* [Memasang di OpenShift](https://docs.weblate.org/id/latest/admin/install/openshift.md)
* [Memasang di Kubernetes](https://docs.weblate.org/id/latest/admin/install/kubernetes.md)

<a id="architecture"></a>

## Ikhtisar arsitektur

Server web
: Menangani permintaan HTTP yang masuk, [Menyajikan berkas statis](#static-files).

Pekerja Celery
: [Tugas latar belakang menggunakan Celery](#celery) dieksekusi di sini.
  <br/>
  Tergantung pada beban kerja Anda, Anda mungkin ingin menyesuaikan jumlah pekerja.
  <br/>
  Gunakan simpul khusus saat menskalakan Weblate secara horizontal.

Application server
: A WSGI or ASGI server serving web pages to users.
  <br/>
  Gunakan simpul khusus saat menskalakan Weblate secara horizontal.

Basis data
: Server basis data PostgreSQL untuk menyimpan semua konten, lihat [Pengaturan basis data untuk Weblate](#database-setup).
  <br/>
  Gunakan simpul basis data khusus untuk situs dengan ratusan juta kata yang dihos.

Penyimpanan data
: Penyimpanan data kunci/nilai seperti Valkey atau server Redis untuk simpanan dan antrian tugas, lihat [Tugas latar belakang menggunakan Celery](#celery).
  <br/>
  Gunakan simpul khusus saat menskalakan Weblate secara horizontal.

Sistem berkas
: Penyimpanan sistem berkas untuk menyimpan repositori VCS dan data pengguna yang diunggah. Ini digunakan bersama oleh semua proses.
  <br/>
  Gunakan penyimpanan jaringan saat menskalakan Weblate secara horizontal.

Server surel
: Server SMTP untuk surel keluar, lihat [Mengkonfigurasikan surel keluar](#out-mail). Server ini dapat disediakan secara eksternal.

#### HINT
[Memasang menggunakan Docker](https://docs.weblate.org/id/latest/admin/install/docker.md) menyertakan PostgreSQL dan Valkey, membuat pemasangan lebih mudah.

<a id="requirements"></a>

## Persyaratan perangkat lunak

### Sistem operasi

Weblate diketahui dapat digunakan di Linux, FreeBSD, dan macOS. Sistem serupa Unix lainnya kemungkinan besar juga dapat digunakan.

Weblate tidak didukung di Windows. Namun, mungkin masih berfungsi dan patchnya diterima dengan senang hati.

#### SEE ALSO
[Ikhtisar arsitektur](#architecture) menggambarkan arsitektur Weblate secara keseluruhan dan layanan yang dibutuhkan.

<a id="python-deps"></a>

### Dependensi Python

Weblate ditulis dalam [Python](https://www.python.org/) dan mendukung Python 3.12 atau yang lebih baru. Anda dapat memasang dependensi menggunakan pip atau dari paket distribusi Anda, daftar lengkap tersedia di `requirements.txt`.

Dependensi yang paling menonjol:

Django
: [https://www.djangoproject.com/](https://www.djangoproject.com/)

Celery
: [https://docs.celeryq.dev/](https://docs.celeryq.dev/)

Translate Toolkit
: [https://toolkit.translatehouse.org/](https://toolkit.translatehouse.org/)

translation-finder
: [https://github.com/WeblateOrg/translation-finder](https://github.com/WeblateOrg/translation-finder)

Auth Sosial Python
: [https://python-social-auth.readthedocs.io/](https://python-social-auth.readthedocs.io/)

Kerangka Kerja Django REST
: [https://www.django-rest-framework.org/](https://www.django-rest-framework.org/)

<!-- Table is generated using scripts/show-extras.py -->

#### Dependensi opsional

| Penspesifikasian dependensi opsional   | Paket Python                                                                                                                                                              | Fitur Weblate                                                                                                                         |
|----------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|
| `amazon`                               | [boto3](https://pypi.org/project/boto3/)<br/><br/><br/>[django-ses](https://pypi.org/project/django-ses/)<br/><br/>                                                       | [Amazon Translate](https://docs.weblate.org/id/latest/admin/machine.md#mt-aws), AWS SES e-mail backend                                        |
| `asgi`                                 | [granian](https://pypi.org/project/granian/)<br/><br/>                                                                                                                    | ASGI server for Weblate                                                                                                               |
| `gelf`                                 | [logging-gelf](https://pypi.org/project/logging-gelf/)<br/><br/>                                                                                                          | [Pengelolaan catatan Graylog](#graylog)                                                            |
| `gerrit`                               | [git-review](https://pypi.org/project/git-review/)<br/><br/>                                                                                                              | [Gerrit review requests](https://docs.weblate.org/id/latest/admin/code-hosting.md#code-hosting-gerrit)                                             |
| `google`                               | [google-cloud-storage](https://pypi.org/project/google-cloud-storage/)<br/><br/><br/>[google-cloud-translate](https://pypi.org/project/google-cloud-translate/)<br/><br/> | [Google Cloud Translation Lanjutan](https://docs.weblate.org/id/latest/admin/machine.md#mt-google-translate-api-v3) dengan dukungan glosarium |
| `google-errors`                        | [google-cloud-error-reporting](https://pypi.org/project/google-cloud-error-reporting/)<br/><br/>                                                                          | [Mengumpulkan laporan galat dan memantau kinerja](#collecting-errors)                                        |
| `ldap`                                 | [django-auth-ldap](https://pypi.org/project/django-auth-ldap/)<br/><br/>                                                                                                  | [Autentikasi LDAP](https://docs.weblate.org/id/latest/admin/auth.md#ldap-auth)                                                             |
| `mercurial`                            | [mercurial](https://pypi.org/project/mercurial/)<br/><br/>                                                                                                                | [Mercurial](https://docs.weblate.org/id/latest/vcs.md#vcs-mercurial)                                                                |
| `oidc`                                 | [django-oauth-toolkit](https://pypi.org/project/django-oauth-toolkit/)<br/><br/>                                                                                          | [OpenID Connect identity provider](https://docs.weblate.org/id/latest/admin/auth.md#oidc-provider)                                         |
| `postgres`                             | [psycopg](https://pypi.org/project/psycopg/)<br/><br/>                                                                                                                    | PostgreSQL, lihat [Pengaturan basis data untuk Weblate](#database-setup)                                  |
| `rollbar`                              | [rollbar](https://pypi.org/project/rollbar/)<br/><br/>                                                                                                                    | [Mengumpulkan laporan galat dan memantau kinerja](#collecting-errors)                                        |
| `saml`                                 | [python3-saml](https://pypi.org/project/python3-saml/)<br/><br/><br/>[xmlsec](https://pypi.org/project/xmlsec/)<br/><br/>                                                 | [Autentikasi SAML](https://docs.weblate.org/id/latest/admin/auth.md#saml-auth)                                                             |
| `sphinx`                               | [Sphinx](https://pypi.org/project/Sphinx/)<br/><br/>                                                                                                                      | Diperlukan untuk [Perbarui berkas POT (Sphinx)](https://docs.weblate.org/id/latest/admin/addons.md#addon-weblate-gettext-sphinx)             |
| `wllegal`                              | [wllegal](https://pypi.org/project/wllegal/)<br/><br/>                                                                                                                    | Integrasi Hosted Weblate                                                                                                              |
| `wsgi`                                 | [granian](https://pypi.org/project/granian/)<br/><br/>                                                                                                                    | WSGI server for Weblate                                                                                                               |
| `zxcvbn`                               | [django-zxcvbn-password-validator](https://pypi.org/project/django-zxcvbn-password-validator/)<br/><br/>                                                                  | [Autentikasi kata sandi](https://docs.weblate.org/id/latest/admin/auth.md#password-authentication)                                         |

Saat memasang menggunakan pip, Anda dapat langsung menentukan fitur yang diinginkan saat memasang:

```sh
uv pip install "weblate[Postgres,Amazon,SAML]"
```

Atau Anda dapat memasang Weblate dengan semua fitur opsional:

```sh
uv pip install "weblate[all]"
```

Atau Anda dapat memasang Weblate tanpa fitur opsional apa pun:

```sh
uv pip install weblate
```

<a id="troubleshoot-pip-install"></a>

### Pemecahan masalah pemasangan pip

`ffi_prep_closure(): bad user_data (it seems that the version of the libffi library seen at runtime is different from the 'ffi.h' file seen at compile-time)`
: Hal ini disebabkan oleh ketidakcocokan paket biner yang didistribusikan melalui PyPI dengan distribusinya. Untuk mengatasi hal ini, Anda perlu membangun ulang paket tersebut di sistem Anda:
  <br/>
  ```sh
  uv pip install --force-reinstall --no-binary :all: cffi
  ```

`error: ‘xmlSecKeyDataFormatEngine’ undeclared (first use in this function); did you mean ‘xmlSecKeyDataFormat’?`
: Ini adalah isu yang diketahui dari paket xmlsec, silakan lihat [https://github.com/xmlsec/python-xmlsec/issues/314](https://github.com/xmlsec/python-xmlsec/issues/314).

`lxml & xmlsec libxml2 library version mismatch`
: Paket `lxml` dan `xmlsec` harus dibangun berdasarkan `libxml2` yang sama. Anda harus membangunnya secara lokal untuk menghindari isu ini:
  <br/>
  ```sh
  uv pip install --force-reinstall --no-binary xmlsec --no-binary lxml lxml xmlsec
  ```

### Persyaratan sistem lainnya

Dependensi berikut harus dipasang pada sistem:

`Git`
: [https://git-scm.com/](https://git-scm.com/)

`git-review` (opsional untuk dukungan Gerrit)
: [git-review](https://pypi.org/project/git-review/)

`git-svn` (opsional untuk dukungan Subversion)
: [https://git-scm.com/docs/git-svn](https://git-scm.com/docs/git-svn)

`tesseract` (hanya diperlukan jika **tesserocr** wheels biner tidak tersedia untuk sistem Anda)
: [https://github.com/tesseract-ocr/tesseract](https://github.com/tesseract-ocr/tesseract)

### Dependensi waktu pembangunan

Untuk membangun beberapa [Dependensi Python](#python-deps), Anda mungkin perlu memasang dependensinya. Hal ini bergantung pada cara Anda memasangnya, jadi silakan lihat paket individual untuk dokumentasi. Anda tidak akan memerlukannya jika menggunakan `Wheels` bawaan saat memasang menggunakan `pip` atau saat Anda menggunakan paket distribusi.

<a id="hardware"></a>

## Persyaratan perangkat keras

Weblate seharusnya dapat berjalan pada perangkat keras apa pun saat ini tanpa masalah, berikut ini adalah konfigurasi minimal yang diperlukan untuk menjalankan Weblate pada hos tunggal (Weblate, basis data, dan server web):

* RAM 3 GB
* 2 inti CPU
* Ruang penyimpanan 1 GB

#### NOTE
Persyaratan sebenarnya untuk pemasangan Weblate Anda sangat bervariasi berdasarkan ukuran terjemahan yang dikelola di dalamnya.

### Penggunaan memori

Semakin besar memori, semakin baik - memori tersebut digunakan untuk penyimpanan di semua tingkatan (sistem berkas, basis data, dan Weblate). Untuk ratusan komponen terjemahan, RAM minimal 4 GB direkomendasikan.

#### HINT
Untuk sistem dengan memori lebih sedikit dari yang direkomendasikan, [Pengaturan Celery proses tunggal](#minimal-celery) direkomendasikan.

### Penggunaan CPU

Banyak pengguna bersamaan meningkatkan jumlah inti CPU yang diperlukan.

Weblate 2026.8 introduced NumPy as a required dependency. On x86-64 systems,
the optimized NumPy build bundled in the Docker image requires an x86-64-v2
compatible CPU. Without the required CPU features, NumPy fails to load and
Weblate cannot start.

Before upgrading, check for the required SSE4.2 CPU feature on the Linux system
running Docker:

```sh
grep sse4_2 /proc/cpuinfo
```

Empty output indicates that a required CPU feature is unavailable. This is a
preliminary check; finding SSE4.2 does not verify all x86-64-v2 CPU features.

If Docker runs in a virtual machine, run the check inside the guest. Virtual
machines can hide CPU features supported by the host. Configure the virtual
machine to expose the required host CPU features, then reboot the guest. If
the physical CPU lacks the required features, upgrade the hardware.

### Penggunaan penyimpanan

Penggunaan penyimpanan basis data pada umumnya adalah sekitar 300 MB per 1 juta kata yang dihos.

Ruang penyimpanan yang dibutuhkan untuk repositori kloning bervariasi, tetapi Weblate mencoba menjaga ukurannya tetap minimal dengan melakukan kloning dangkal.

### Storage performance

Version control operations perform many filesystem metadata lookups. The
`vcs` subdirectory in [`DATA_DIR`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-DATA_DIR) therefore needs low read
latency; storage with slow metadata access can make operations such as
**git status** take a long time even when its bulk throughput is good.
Keep [`CACHE_DIR`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-CACHE_DIR) on low-latency local or temporary storage when
possible.

The deployment checks measure metadata lookup latency for both locations and
warn when the median latency exceeds 10 milliseconds. This is an approximate
point-in-time measurement affected by filesystem and system load. Rerun
**weblate check --deploy** before changing the storage configuration.

### Simpul

Untuk situs berukuran kecil dan menengah (jutaan kata yang dihos), semua komponen Weblate (lihat [Ikhtisar arsitektur](#architecture)) dapat dijalankan pada satu simpul.

Saat jumlah kata yang dihos mencapai ratusan juta, sebaiknya miliki simpul khusus untuk basis data (lihat [Pengaturan basis data untuk Weblate](#database-setup)).

## Verifying release artifacts

Release archives can be verified using the signatures, attestations, and SBOMs
published with GitHub release assets. See [Verifying release artifacts](https://docs.weblate.org/id/latest/security/release-artifacts.md#verify).

<a id="file-permissions"></a>

## Izin sistem berkas

Proses Weblate harus dapat membaca dan menulis ke direktori tempat data disimpan - [`DATA_DIR`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-DATA_DIR). Semua berkas di dalam direktori ini harus dimiliki dan dapat ditulis oleh pengguna yang menjalankan semua proses Weblate (biasanya WSGI dan Celery, lihat [Menjalankan server](#server) dan [Tugas latar belakang menggunakan Celery](#celery)).

Konfigurasi bawaan menempatkannya di pohon yang sama dengan sumber Weblate, namun Anda mungkin lebih suka memindahkannya ke lokasi yang lebih baik seperti: `/var/lib/weblate`.

Weblate mencoba membuat direktori ini secara otomatis, tetapi akan gagal jika tidak memiliki izin untuk melakukannya.

The configured [`CACHE_DIR`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-CACHE_DIR) also has to be writable by the Weblate
process and has to allow executing generated helper files. Do not mount
[`CACHE_DIR`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-CACHE_DIR) with the `noexec` option.

Anda juga harus berhati-hati saat menjalankan [Perintah pengelolaan](https://docs.weblate.org/id/latest/admin/management.md#manage), karena file tersebut harus dijalankan di bawah pengguna yang sama dengan tempat Weblate itu berjalan, jika tidak, izin pada beberapa berkas mungkin salah.

Dalam kontainer Docker, semua berkas dalam volume `/app/data` harus dimiliki oleh pengguna `weblate` di dalam kontainer (UID 1000).

#### SEE ALSO
[Menyajikan berkas statis](#static-files)

<a id="database-setup"></a>

## Pengaturan basis data untuk Weblate

Disarankan untuk menjalankan Weblate dengan server basis data PostgreSQL.

PostgreSQL 13 dan yang lebih baru didukung. PostgreSQL 15 atau yang lebih baru direkomendasikan.

#### SEE ALSO
* [Gunakan mesin basis data yang kuat](#production-database)
* [Basisdata](https://docs.djangoproject.com/id/stable/ref/databases/)
* [Memigrasikan dari basis data lain ke PostgreSQL](https://docs.weblate.org/id/latest/admin/upgrade.md#database-migration)

<a id="db-connections"></a>

### Sambungan basis data

Dalam konfigurasi bawaan, setiap proses Weblate menyimpan sambungan persisten ke basis data. Sambungan persisten meningkatkan respons Weblate, tetapi mungkin memerlukan lebih banyak sumber daya untuk server basis data. Silakan lihat [`CONN_MAX_AGE`](https://docs.djangoproject.com/id/stable/ref/settings/#std-setting-CONN_MAX_AGE) dan [Hubungan tetap](https://docs.djangoproject.com/id/stable/ref/databases/#persistent-database-connections) untuk info selengkapnya.

Weblate memerlukan setidaknya sejumlah sambungan berikut:

* $(4 \times \mathit{nCPUs}) + 2$ untuk proses Celery
* $\mathit{nCPUs} + 1$ untuk pekerja WSGI

Hal ini berlaku untuk konfigurasi bawaan kontainer Docker dan contoh yang disediakan dalam dokumentasi ini, tetapi jumlahnya akan berubah setelah Anda menyesuaikan jumlah pekerja WSGI atau menyesuaikan paralelisme Celery.

The actual limit for the number of database connections needs to be higher to
account for the following situations:

* [Perintah pengelolaan](https://docs.weblate.org/id/latest/admin/management.md#manage) memerlukan sambungannya juga.
* If a process is killed (for example by OOM killer), it might block the existing connection until timeout.

#### SEE ALSO
[Tugas latar belakang menggunakan Celery](#celery),
[Contoh konfigurasi untuk NGINX dan uWSGI](#uwsgi),
[`WEBLATE_WORKERS`](https://docs.weblate.org/id/latest/admin/install/docker.md#envvar-WEBLATE_WORKERS)

<a id="postgresql"></a>

### PostgreSQL

PostgreSQL biasanya merupakan pilihan terbaik untuk situs berbasis Django. Ini adalah basis data referensi yang digunakan untuk mengimplementasikan lapisan basis data Django.

#### NOTE
Weblate menggunakan ekstensi trigram yang terkadang harus dipasang secara terpisah. Cari `postgresql-contrib` atau paket dengan nama serupa.

#### SEE ALSO
[Catatan PostgreSQL](https://docs.djangoproject.com/id/stable/ref/databases/#postgresql-notes)

<a id="dbsetup-postgres"></a>

#### Membuat basis data di PostgreSQL

Biasanya merupakan ide yang bagus untuk menjalankan Weblate dalam basis data terpisah, dan akun pengguna terpisah:

```sh
# If PostgreSQL was not installed before, set the main password
sudo -u postgres psql postgres -c "\password postgres"

# Create a database user called "weblate"
sudo -u postgres createuser --superuser --pwprompt weblate

# Create the database "weblate" owned by "weblate"
sudo -u postgres createdb -E UTF8 -O weblate weblate
```

#### HINT
Jika Anda tidak ingin menjadikan pengguna Weblate sebagai pengguna super di PostgreSQL, Anda dapat menghilangkannya. Dalam hal ini, Anda harus melakukan beberapa langkah migrasi secara manual karena pengguna super PostgreSQL dalam skema Weblate akan menggunakan:

```postgres
CREATE EXTENSION IF NOT EXISTS pg_trgm;
CREATE EXTENSION IF NOT EXISTS btree_gin;
CREATE EXTENSION IF NOT EXISTS btree_gist;
```

<a id="config-postgresql"></a>

#### Mengkonfigurasikan Weblate untuk menggunakan PostgreSQL

Cuplikan `settings.py` untuk PostgreSQL:

```python
DATABASES = {
    "default": {
        # Database engine
        "ENGINE": "django.db.backends.postgresql",
        # Database name
        "NAME": "weblate",
        # Database user
        "USER": "weblate",
        # Configures name of the PostgreSQL role to alter during the database migration
        # "ALTER_ROLE": "weblate",
        # Database password
        "PASSWORD": "password",
        # Set to empty string for localhost
        "HOST": "database.example.com",
        # Set to empty string for default
        "PORT": "",
        # Persistent connections
        "CONN_MAX_AGE": None,
        "CONN_HEALTH_CHECKS": True,
    }
}
```

Migrasi basis data melakukan [ALTER ROLE](https://www.postgresql.org/docs/16/sql-alterrole.html) pada peran basis data yang digunakan oleh Weblate. Umumnya, nama peran sama dengan nama pengguna. Pada pengaturan yang lebih kompleks, nama peran berbeda dari nama pengguna, dan Anda akan mendapatkan pesan galat tentang peran yang tidak ada selama migrasi basis data (`psycopg2.errors.UndefinedObject: role "weblate@hostname" does not exist`). Hal ini diketahui terjadi pada Azure Database for PostgreSQL, tetapi tidak terbatas pada lingkungan ini. Silakan atur `ALTER_ROLE` untuk mengubah nama peran yang harus diubah Weblate selama migrasi basis data.

#### SEE ALSO
[Sambungan basis data](#db-connections)

## Konfigurasi lainnya

<a id="out-mail"></a>

### Mengkonfigurasikan surel keluar

Weblate mengirimkan surel pada berbagai kesempatan - untuk aktivasi akun dan berbagai notifikasi yang dikonfigurasi oleh pengguna. Untuk itu, Weblate memerlukan akses ke server SMTP.

Pengaturan server surat dikonfigurasikan menggunakan pengaturan berikut: [`EMAIL_HOST`](https://docs.djangoproject.com/id/stable/ref/settings/#std-setting-EMAIL_HOST), [`EMAIL_HOST_PASSWORD`](https://docs.djangoproject.com/id/stable/ref/settings/#std-setting-EMAIL_HOST_PASSWORD), [`EMAIL_USE_TLS`](https://docs.djangoproject.com/id/stable/ref/settings/#std-setting-EMAIL_USE_TLS), [`EMAIL_USE_SSL`](https://docs.djangoproject.com/id/stable/ref/settings/#std-setting-EMAIL_USE_SSL), [`EMAIL_HOST_USER`](https://docs.djangoproject.com/id/stable/ref/settings/#std-setting-EMAIL_HOST_USER), dan [`EMAIL_PORT`](https://docs.djangoproject.com/id/stable/ref/settings/#std-setting-EMAIL_PORT). Namanya cukup jelas, tetapi Anda dapat menemukan informasi lebih lanjut dalam dokumentasi Django.

#### HINT
Jika Anda mendapatkan galat tentang autentikasi yang tidak didukung (misalnya `SMTP AUTH extension not supported by server`), kemungkinan besar hal ini disebabkan oleh penggunaan sambungan yang tidak aman dan server menolak untuk mengautentikasikan dengan cara ini. Coba aktifkan [`EMAIL_USE_TLS`](https://docs.djangoproject.com/id/stable/ref/settings/#std-setting-EMAIL_USE_TLS) untuk kasus tersebut.

#### SEE ALSO
* [Tidak menerima surel dari Weblate](https://docs.weblate.org/id/latest/contributing/debugging.md#debug-mails)
* [Mengkonfigurasikan surel keluar di kontainer Docker](https://docs.weblate.org/id/latest/admin/install/docker.md#docker-mail)

<a id="reverse-proxy"></a>

### Berjalan di belakang proksi terbalik

Beberapa fitur di Weblate bergantung pada kepala HTTP yang benar yang diteruskan ke Weblate. Saat menggunakan proksi terbalik, pastikan informasi yang diperlukan diteruskan dengan benar.

Untuk mengawakutu konfigurasi ini, Anda dapat melihat Lingkungan HTTP di [Laporan kinerja](https://docs.weblate.org/id/latest/admin/admin.md#manage-performance).

Alamat IP klien
: Ini diperlukan untuk [Pembatasan akses](https://docs.weblate.org/id/latest/admin/optionals.md#rate-limit) atau [Aktivitas](https://docs.weblate.org/id/latest/user/profile.md#audit-log).
  <br/>
  Weblate mengurai alamat IP dari `REMOTE_ADDR`, yang diatur oleh pengendali WSGI. Alamat ini mungkin kosong (ketika menggunakan soket untuk WSGI) atau berisi alamat proksi terbalik, sehingga Weblate memerlukan kepala HTTP tambahan dengan alamat IP klien.
  <br/>
  Mengaktifkan [`IP_BEHIND_REVERSE_PROXY`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-IP_BEHIND_REVERSE_PROXY) seharusnya cukup untuk pengaturan paling umum, tetapi Anda mungkin perlu menyesuaikan [`IP_PROXY_HEADER`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-IP_PROXY_HEADER) dan [`IP_PROXY_OFFSET`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-IP_PROXY_OFFSET) juga (gunakan [`WEBLATE_IP_PROXY_HEADER`](https://docs.weblate.org/id/latest/admin/install/docker.md#envvar-WEBLATE_IP_PROXY_HEADER) dan [`WEBLATE_IP_PROXY_OFFSET`](https://docs.weblate.org/id/latest/admin/install/docker.md#envvar-WEBLATE_IP_PROXY_OFFSET) dalam kontainer Docker).
  <br/>
  The reverse proxy which connects to Weblate must overwrite the configured
  header or append a verified peer address at the position selected by
  [`IP_PROXY_OFFSET`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-IP_PROXY_OFFSET). Do not select a client-supplied address, and do
  not expose the application server through a path which bypasses the trusted
  proxy.
  <br/>
  When using `X-Forwarded-For` with the Docker container, configure
  [`WEBLATE_TRUSTED_PROXY_ADDRESSES`](https://docs.weblate.org/id/latest/admin/install/docker.md#envvar-WEBLATE_TRUSTED_PROXY_ADDRESSES) with the reverse proxies allowed
  to supply client addresses.
  <br/>
  #### HINT
  Konfigurasi ini tidak dapat diaktifkan secara bawaan, karena akan memungkinkan pemalsuan alamat IP pada pemasangan yang tidak memiliki proksi terbalik yang dikonfigurasi dengan benar.

Nama hos server
: Kepala [Host](https://www.rfc-editor.org/info/rfc7230#section-5.4) harus sesuai dengan konfigurasi yang didefinisikan sebagai [`SITE_DOMAIN`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-SITE_DOMAIN). Konfigurasi tambahan mungkin diperlukan di proksi terbalik Anda (misalnya, gunakan `ProxyPreserveHost On` untuk Apache atau `proxy_set_header Host $host;` dengan nginx).
  <br/>
  #### HINT
  Galat verifikasi CSRF yang gagal sering kali disebabkan oleh ketidakcocokan antara kepala [Host](https://www.rfc-editor.org/info/rfc7230#section-5.4) dan [`SITE_DOMAIN`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-SITE_DOMAIN) yang dikonfigurasikan.

Protokol klien
: Tidak melewati protokol yang benar dapat menyebabkan Weblate terjebak dalam loop pengalihan saat mencoba meningkatkan klien ke HTTPS. Pastikan protokol tersebut diekspos dengan benar oleh proksi terbalik sebagai *X-Forwarded-Proto*.
  <br/>
  Kepala ini kemudian perlu dikonfigurasikan dalam [`SECURE_PROXY_SSL_HEADER`](https://docs.djangoproject.com/id/stable/ref/settings/#std-setting-SECURE_PROXY_SSL_HEADER) (`settings.py`) atau [`WEBLATE_SECURE_PROXY_SSL_HEADER`](https://docs.weblate.org/id/latest/admin/install/docker.md#envvar-WEBLATE_SECURE_PROXY_SSL_HEADER) (lingkungan Docker).
  <br/>
  #### IMPORTANT
  Nilai kepala peka huruf kapital dalam konfigurasi, jadi `WEBLATE_SECURE_PROXY_SSL_HEADER=HTTP_X_FORWARDED_PROTO,https` dan `WEBLATE_SECURE_PROXY_SSL_HEADER=HTTP_X_FORWARDED_PROTO,HTTPS` tidak dapat dipertukarkan.
  <br/>
  #### HINT
  Jika Anda mendapatkan galat "Terlalu banyak pengalihan" dari peramban, kemungkinan besar ini disebabkan oleh ketidakcocokan antara protokol aktual (HTTPS) dan apa yang diamati oleh Weblate.
  <br/>
  #### Versionchanged
  Berubah pada versi 5.13: Kepala proksi protokol secara otomatis ditangani oleh **gunicorn** dalam konfigurasi bawaan, tetapi server WSGI lainnya memiliki konfigurasi yang lebih aman dan memerlukan pengaturan eksplisit ini.
  <br/>
  Sejak Weblate 5.13 kontainer Docker menggunakan **granian** dan sekarang memerlukan konfigurasi eksplisit [`WEBLATE_SECURE_PROXY_SSL_HEADER`](https://docs.weblate.org/id/latest/admin/install/docker.md#envvar-WEBLATE_SECURE_PROXY_SSL_HEADER).

#### SEE ALSO
* [Proksi penghentian SSL](https://docs.weblate.org/id/latest/admin/install/docker.md#docker-ssl-proxy)
* [Pembatasan akses](https://docs.weblate.org/id/latest/admin/optionals.md#rate-limit)
* [Aktivitas](https://docs.weblate.org/id/latest/user/profile.md#audit-log)
* [Contoh konfigurasi untuk NGINX dan Granian](#nginx-granian)
* [Contoh konfigurasi untuk NGINX dan Gunicorn](#nginx-gunicorn)
* [Contoh konfigurasi untuk NGINX dan uWSGI](#uwsgi)
* [Contoh konfigurasi untuk Apache](#apache)
* [Contoh konfigurasi untuk Apache dan Gunicorn](#apache-gunicorn)
* [`IP_BEHIND_REVERSE_PROXY`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-IP_BEHIND_REVERSE_PROXY)
* [`IP_PROXY_HEADER`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-IP_PROXY_HEADER)
* [`IP_PROXY_OFFSET`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-IP_PROXY_OFFSET)
* [`SECURE_PROXY_SSL_HEADER`](https://docs.djangoproject.com/id/stable/ref/settings/#std-setting-SECURE_PROXY_SSL_HEADER)
* [`WEBLATE_IP_PROXY_HEADER`](https://docs.weblate.org/id/latest/admin/install/docker.md#envvar-WEBLATE_IP_PROXY_HEADER)
* [`WEBLATE_TRUSTED_PROXY_ADDRESSES`](https://docs.weblate.org/id/latest/admin/install/docker.md#envvar-WEBLATE_TRUSTED_PROXY_ADDRESSES)
* [`WEBLATE_IP_PROXY_OFFSET`](https://docs.weblate.org/id/latest/admin/install/docker.md#envvar-WEBLATE_IP_PROXY_OFFSET)

<a id="http-proxy"></a>

### Proksi HTTP

Weblate supports per-protocol HTTP proxy configuration for outbound HTTP
requests and Git repositories. Define the proxy environment variables in
`settings.py`:

```python
import os

os.environ["http_proxy"] = "http://proxy.example.com:8080"
os.environ["https_proxy"] = "http://proxy.example.com:8080"
```

Only `http_proxy` and `https_proxy` are supported. Generic and bypass
variables such as `all_proxy` and `no_proxy`, operating-system proxy
configuration, and VCS-specific proxy configuration are not supported.

#### SEE ALSO
[Proxy environment variables](https://everything.curl.dev/usingcurl/proxies/env.html)

<a id="configuration"></a>

## Menyesuaikan konfigurasi

#### SEE ALSO
[Contoh konfigurasi](https://docs.weblate.org/id/latest/admin/sample.md#sample-configuration)

Salin `weblate/settings_example.py` ke `weblate/settings.py` dan sesuaikan agar sesuai dengan pengaturan Anda. Mungkin Anda ingin menyesuaikan opsi berikut:

<a id="std-setting-ADMINS"></a>

`ADMINS`

> Daftar administrator situs yang menerima notifikasi saat terjadi kesalahan, misalnya notifikasi tentang penggabungan yang gagal, atau galat Django.

> Formulir kontak juga mengirimkan surel pada ini kecuali [`ADMINS_CONTACT`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-ADMINS_CONTACT) dikonfigurasikan.

> #### SEE ALSO
> * [`ADMINS`](https://docs.djangoproject.com/id/stable/ref/settings/#std-setting-ADMINS)
> * [`ADMINS_CONTACT`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-ADMINS_CONTACT)
> * [Konfigurasikan admin dengan benar](#production-admins)

<a id="std-setting-ALLOWED_HOSTS"></a>

`ALLOWED_HOSTS`

> Anda perlu mengatur ini agar mencantumkan hos yang seharusnya dilayani oleh situs Anda. Misalnya:

> ```python
> ALLOWED_HOSTS = ["demo.weblate.org"]
> ```

> Alternatifnya Anda dapat menyertakan wildcard:

> ```python
> ALLOWED_HOSTS = ["*"]
> ```

> #### SEE ALSO
> * [`ALLOWED_HOSTS`](https://docs.djangoproject.com/id/stable/ref/settings/#std-setting-ALLOWED_HOSTS)
> * [`WEBLATE_ALLOWED_HOSTS`](https://docs.weblate.org/id/latest/admin/install/docker.md#envvar-WEBLATE_ALLOWED_HOSTS)
> * [Pengaturan hos yang diizinkan](#production-hosts)

<a id="std-setting-SESSION_ENGINE"></a>

`SESSION_ENGINE`

> Konfigurasikan cara penyimpanan sesi Anda. Jika Anda tetap menggunakan mesin backend basis data bawaan, Anda harus menjadwalkan: **weblate clearsessions** untuk menghapus data sesi yang lawas dari basis data.

> Jika Anda menggunakan Valkey atau Redis sebagai simpanan (lihat [Konfigurasi simpanan](#production-cache)) disarankan untuk menggunakannya untuk sesi juga:

> ```python
> SESSION_ENGINE = "django.contrib.sessions.backends.cache"
> ```

> #### SEE ALSO
> * [Konfigurasi mesin sesi](https://docs.djangoproject.com/id/stable/topics/http/sessions/#configuring-sessions)
> * [`SESSION_ENGINE`](https://docs.djangoproject.com/id/stable/ref/settings/#std-setting-SESSION_ENGINE)

<a id="std-setting-DATABASES"></a>

`DATABASES`

> Konektivitas ke server basis data, silakan periksa dokumentasi Django untuk rincian lebih lanjut.

> #### SEE ALSO
> * [Pengaturan basis data untuk Weblate](#database-setup)
> * [`DATABASES`](https://docs.djangoproject.com/id/stable/ref/settings/#std-setting-DATABASES)
> * [Basisdata](https://docs.djangoproject.com/id/stable/ref/databases/)

<a id="std-setting-DEBUG"></a>

`DEBUG`

> Nonaktifkan ini untuk semua server produksi. Dengan mode awakutu diaktifkan, Django akan menampilkan backtrace jika terjadi galat kepada pengguna. Saat Anda menonaktifkannya, galat akan dikirim melalui surel ke `ADMIN` (lihat di atas).

> Mode awakutu juga memperlambat Weblate, karena Django menyimpan lebih banyak informasi secara internal dalam kasus ini.

> #### SEE ALSO
> * [`DEBUG`](https://docs.djangoproject.com/id/stable/ref/settings/#std-setting-DEBUG)
> * [Nonaktifkan mode awakutu](#production-debug)

<a id="std-setting-DEFAULT_FROM_EMAIL"></a>

`DEFAULT_FROM_EMAIL`

> Alamat pengirim surel untuk surel keluar, misalnya surel pendaftaran.

> #### SEE ALSO
> [`DEFAULT_FROM_EMAIL`](https://docs.djangoproject.com/id/stable/ref/settings/#std-setting-DEFAULT_FROM_EMAIL)

<a id="std-setting-SECRET_KEY"></a>

`SECRET_KEY`

> Kunci yang digunakan oleh Django untuk menandatangani beberapa info dalam kuki, lihat [Kunci rahasia Django](#production-secret) untuk info lebih lanjut.

> #### SEE ALSO
> [`SECRET_KEY`](https://docs.djangoproject.com/id/stable/ref/settings/#std-setting-SECRET_KEY)

<a id="std-setting-SERVER_EMAIL"></a>

`SERVER_EMAIL`

> Surel digunakan sebagai alamat pengirim untuk mengirim surel ke administrator, misalnya notifikasi tentang penggabungan yang gagal.

> #### SEE ALSO
> [`SERVER_EMAIL`](https://docs.djangoproject.com/id/stable/ref/settings/#std-setting-SERVER_EMAIL)

<a id="tables-setup"></a>

## Mengisi basis data

Setelah konfigurasi Anda siap, Anda dapat menjalankan [`migrate`](https://docs.weblate.org/id/latest/admin/management.md#weblate-admin-migrate) untuk membuat struktur basis data. Sekarang Anda seharusnya dapat membuat proyek terjemahan menggunakan antarmuka admin.

Setelah selesai, Anda juga harus memeriksa Laporan kinerja di antarmuka admin, yang akan memberi Anda petunjuk tentang potensi konfigurasi yang tidak optimal di situs Anda.

#### SEE ALSO
* [Konfigurasi](https://docs.weblate.org/id/latest/admin/config.md#config)
* [Daftar hak akses](https://docs.weblate.org/id/latest/admin/access.md#privileges)

<a id="production"></a>

## Pengaturan produksi

Untuk pengaturan produksi, Anda harus melakukan penyesuaian yang dijelaskan di bagian berikut. Pengaturan paling kritis akan memicu peringatan yang ditunjukkan dengan tanda seru di bilah atas jika masuk sebagai pengguna super:

![image](screenshots/admin-wrench.webp)

Disarankan juga untuk memeriksa pemeriksaan yang dipicu oleh Django (meskipun Anda mungkin tidak perlu memperbaiki semuanya):

```sh
weblate check --deploy
```

Anda juga dapat meninjau daftar periksa yang sama di [Laporan kinerja](https://docs.weblate.org/id/latest/admin/admin.md#manage-performance) di [Antarmuka pengelolaan](https://docs.weblate.org/id/latest/admin/admin.md#management-interface).

#### SEE ALSO
[Daftar centang penyebaran](https://docs.djangoproject.com/id/stable/howto/deployment/checklist/)

<a id="production-debug"></a>

### Nonaktifkan mode awakutu

Nonaktifkan mode awakutu Django ([`DEBUG`](#std-setting-DEBUG)) dengan:

```python
DEBUG = False
```

Dengan mode awakutu aktif, Django menyimpan semua kueri yang dieksekusi dan menunjukkan kepada pengguna jejak balik galat, yang tidak diinginkan dalam pengaturan produksi.

#### SEE ALSO
[Menyesuaikan konfigurasi](#configuration)

<a id="production-admins"></a>

### Konfigurasikan admin dengan benar

Set the correct admin addresses to the [`ADMINS`](#std-setting-ADMINS) setting to define who will receive
e-mails in case something goes wrong on the server, for example:

```python
ADMINS = ("Your Name <your_email@example.com>",)
```

#### SEE ALSO
[Menyesuaikan konfigurasi](#configuration)

<a id="production-site"></a>

### Atur domain situs yang benar

Sesuaikan nama situs dan domain di antarmuka admin. Jika tidak, tautan di RSS atau surel pendaftaran tidak akan berfungsi. Konfigurasi ini menggunakan [`SITE_DOMAIN`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-SITE_DOMAIN) yang seharusnya berisi nama domain situs.

#### Versionchanged
Berubah pada versi 4.2: Sebelum rilis 4.2 kerangka kerja situs Django digunakan sebagai gantinya, silakan lihat [Kerangka kerja "sites"](https://docs.djangoproject.com/id/stable/ref/contrib/sites/).

#### SEE ALSO
* [Pengaturan hos yang diizinkan](#production-hosts)
* [Konfigurasikan HTTPS dengan benar](#production-ssl)
* [`SITE_DOMAIN`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-SITE_DOMAIN)
* [`WEBLATE_SITE_DOMAIN`](https://docs.weblate.org/id/latest/admin/install/docker.md#envvar-WEBLATE_SITE_DOMAIN)
* [`ENABLE_HTTPS`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-ENABLE_HTTPS)

<a id="production-ssl"></a>

### Konfigurasikan HTTPS dengan benar

Sangat disarankan untuk menjalankan Weblate menggunakan protokol HTTPS terenkripsi. Setelah mengaktifkannya, Anda harus mengatur [`ENABLE_HTTPS`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-ENABLE_HTTPS) di pengaturan:

```python
ENABLE_HTTPS = True
```

#### HINT
Anda mungkin ingin menyiapkan HSTS juga, lihat [SSL/HTTPS](https://docs.djangoproject.com/id/stable/topics/security/#security-recommendation-ssl) untuk rincian lebih lanjut.

#### SEE ALSO
* [`ENABLE_HTTPS`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-ENABLE_HTTPS)
* [Pengaturan hos yang diizinkan](#production-hosts)
* [Atur domain situs yang benar](#production-site)

### Atur SECURE_HSTS_SECONDS dengan benar

Jika situs Anda dilayani melalui SSL, pertimbangkan untuk mengatur nilai untuk [`SECURE_HSTS_SECONDS`](https://docs.djangoproject.com/id/stable/ref/settings/#std-setting-SECURE_HSTS_SECONDS) di `settings.py` untuk mengaktifkan Keamanan Transportasi Ketat HTTP. Secara bawaan, nilai tersebut diatur ke 0 seperti yang ditunjukkan di bawah ini.

```python
SECURE_HSTS_SECONDS = 0
```

Jika diatur ke nilai integer non-nol, [`django.middleware.security.SecurityMiddleware`](https://docs.djangoproject.com/id/stable/ref/middleware/#django.middleware.security.SecurityMiddleware) akan mengatur header [HTTP Strict Transport Security](https://docs.djangoproject.com/id/stable/ref/middleware/#http-strict-transport-security) pada semua respons yang belum memilikinya.

#### WARNING
Pengaturan yang salah dapat merusak situs Anda secara permanen (untuk sementara waktu). Baca dokumentasi [HTTP Strict Transport Security](https://docs.djangoproject.com/id/stable/ref/middleware/#http-strict-transport-security) terlebih dahulu.

<a id="production-database"></a>

### Gunakan mesin basis data yang kuat

* Silakan gunakan PostgreSQL untuk lingkungan produksi, lihat [Pengaturan basis data untuk Weblate](#database-setup) untuk info lebih lanjut.
* Gunakan lokasi yang berdekatan untuk menjalankan server basis data, jika tidak, kinerja atau keandalan jaringan dapat merusak pengalaman Weblate Anda.
* Periksa kinerja server basis data atau ubah konfigurasinya, misalnya menggunakan [PGTune](https://pgtune.leopard.in.ua/).
* Weblate deployment checks report non-finite PostgreSQL relation statistics.
  Run `ANALYZE` on the reported relations to rebuild corrupted statistics.

#### SEE ALSO
* [Pengaturan basis data untuk Weblate](#database-setup)
* [Memigrasikan dari basis data lain ke PostgreSQL](https://docs.weblate.org/id/latest/admin/upgrade.md#database-migration)
* [Menyesuaikan konfigurasi](#configuration)
* [Basisdata](https://docs.djangoproject.com/id/stable/ref/databases/)

<a id="production-cache"></a>

### Konfigurasi simpanan

Jika memungkinkan, gunakan Valkey atau Redis dari Django dengan menyesuaikan variabel konfigurasi `CACHES`, misalnya:

```python
CACHES = {
    "default": {
        "BACKEND": "django_redis.cache.RedisCache",
        "LOCATION": "redis://127.0.0.1:6379/0",
        # If redis is running on same host as Weblate, you might
        # want to use unix sockets instead:
        # 'LOCATION': 'unix:///var/run/redis/redis.sock?db=0',
        "OPTIONS": {
            "CLIENT_CLASS": "django_redis.client.DefaultClient",
            "PARSER_CLASS": "redis.connection.HiredisParser",
        },
    }
}
```

#### HINT
Jika Anda mengubah pengaturan untuk simpanan, Anda mungkin perlu menyesuaikannya untuk Celery juga, lihat [Tugas latar belakang menggunakan Celery](#celery).

#### SEE ALSO
* [Simpanan avatar](#production-cache-avatar)
* [Kerangka kerja penyimpanan Django](https://docs.djangoproject.com/id/stable/topics/cache/)

<a id="production-cache-avatar"></a>

### Simpanan avatar

Selain melakukan menyimpan Django, Weblate juga melakukan menyimpan avatar. Disarankan untuk menggunakan simpanan terpisah yang didukung berkas untuk tujuan ini:

```python
CACHES = {
    "default": {
        # Default caching backend setup, see above
        "BACKEND": "django_redis.cache.RedisCache",
        "LOCATION": "unix:///var/run/redis/redis.sock?db=0",
        "OPTIONS": {
            "CLIENT_CLASS": "django_redis.client.DefaultClient",
            "PARSER_CLASS": "redis.connection.HiredisParser",
        },
    },
    "avatar": {
        "BACKEND": "django.core.cache.backends.filebased.FileBasedCache",
        "LOCATION": os.path.join(DATA_DIR, "avatar-cache"),
        "TIMEOUT": 604800,
        "OPTIONS": {
            "MAX_ENTRIES": 1000,
        },
    },
}
```

#### SEE ALSO
* [`ENABLE_AVATARS`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-ENABLE_AVATARS)
* [`AVATAR_URL_PREFIX`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-AVATAR_URL_PREFIX)
* [Avatar](https://docs.weblate.org/id/latest/admin/optionals.md#avatars)
* [Konfigurasi simpanan](#production-cache)
* [Kerangka kerja penyimpanan Django](https://docs.djangoproject.com/id/stable/topics/cache/)

<a id="production-email"></a>

### Konfigurasikan pengiriman surel

Weblate perlu mengirimkan surel beberapa kali, dan surel ini harus memiliki alamat pengirim yang benar, silakan konfigurasikan [`SERVER_EMAIL`](#std-setting-SERVER_EMAIL) dan [`DEFAULT_FROM_EMAIL`](#std-setting-DEFAULT_FROM_EMAIL) agar cocok dengan lingkungan Anda, misalnya:

```python
SERVER_EMAIL = "admin@example.org"
DEFAULT_FROM_EMAIL = "weblate@example.org"
```

#### NOTE
Untuk menonaktifkan pengiriman surel melalui Weblate, atur [`EMAIL_BACKEND`](https://docs.djangoproject.com/id/stable/ref/settings/#std-setting-EMAIL_BACKEND) ke `django.core.mail.backends.dummy.EmailBackend`.

Ini akan menonaktifkan *semua* pengiriman surel termasuk surel pendaftaran atau pengaturan ulang kata sandi.

#### SEE ALSO
* [Menyesuaikan konfigurasi](#configuration)
* [Mengkonfigurasikan surel keluar](#out-mail)
* [`EMAIL_BACKEND`](https://docs.djangoproject.com/id/stable/ref/settings/#std-setting-EMAIL_BACKEND)
* [`DEFAULT_FROM_EMAIL`](https://docs.djangoproject.com/id/stable/ref/settings/#std-setting-DEFAULT_FROM_EMAIL)
* [`SERVER_EMAIL`](https://docs.djangoproject.com/id/stable/ref/settings/#std-setting-SERVER_EMAIL)

<a id="production-hosts"></a>

### Pengaturan hos yang diizinkan

Django memerlukan [`ALLOWED_HOSTS`](#std-setting-ALLOWED_HOSTS) untuk menampung daftar nama domain yang boleh dilayani oleh situs Anda, membiarkannya kosong akan memblokir permintaan apa pun.

Jika ini tidak dikonfigurasikan untuk mencocokkan server HTTP, Anda akan mendapatkan galat seperti `Invalid HTTP_HOST header: '1.1.1.1'. You may need to add '1.1.1.1' to ALLOWED_HOSTS.`

#### HINT
Pada kontainer Docker, ini tersedia sebagai [`WEBLATE_ALLOWED_HOSTS`](https://docs.weblate.org/id/latest/admin/install/docker.md#envvar-WEBLATE_ALLOWED_HOSTS).

#### SEE ALSO
* [`ALLOWED_HOSTS`](#std-setting-ALLOWED_HOSTS)
* [`WEBLATE_ALLOWED_HOSTS`](https://docs.weblate.org/id/latest/admin/install/docker.md#envvar-WEBLATE_ALLOWED_HOSTS)
* [Atur domain situs yang benar](#production-site)

<a id="production-secret"></a>

### Kunci rahasia Django

Pengaturan [`SECRET_KEY`](#std-setting-SECRET_KEY) digunakan oleh Django untuk menandatangani kuki, dan Anda sebaiknya benar-benar menghasilkan nilai Anda sendiri daripada menggunakan nilai yang ada pada contoh pengaturan.

Anda dapat menghasilkan kunci baru menggunakan **weblate-generate-secret-key** yang dikirimkan dengan Weblate.

#### SEE ALSO
[`SECRET_KEY`](#std-setting-SECRET_KEY)

<a id="production-cron"></a>

### Menjalankan tugas pemeliharaan

Untuk kinerja optimal, sebaiknya jalankan beberapa tugas pemeliharaan di latar belakang. Tugas ini dilakukan secara otomatis oleh [Tugas latar belakang menggunakan Celery](#celery) dan mencakup tugas berikut:

* Pemeriksaan kesehatan konfigurasi (setiap jam).
* Mengkomit perubahan yang tertunda (setiap jam), lihat [Komit malas](https://docs.weblate.org/id/latest/admin/continuous.md#lazy-commit) dan [`commit_pending`](https://docs.weblate.org/id/latest/admin/management.md#weblate-admin-commit_pending).
* Memperbarui peringatan komponen (harian).
* Perbarui cabang jarak jauh (setiap malam), lihat [`AUTO_UPDATE`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-AUTO_UPDATE).
* Pencadangan memori terjemahan ke JSON (harian), lihat [`dump_memory`](https://docs.weblate.org/id/latest/admin/management.md#weblate-admin-dump_memory).
* Tugas pemeliharaan teks lengkap dan basis data (tugas harian dan mingguan), lihat [`cleanuptrans`](https://docs.weblate.org/id/latest/admin/management.md#weblate-admin-cleanuptrans).

<a id="production-encoding"></a>

### Lokalisasi dan pengenkodean sistem

Lokalisasi sistem harus dikonfigurasikan agar mendukung UTF-8. Pada sebagian besar distribusi Linux, ini adalah pengaturan bawaan. Jika tidak demikian pada sistem Anda, silakan ubah lokalisasi ke varian UTF-8.

Misalnya dengan menyunting `/etc/default/locale` dan mengaturnya `LANG="C.UTF-8"`.

Dalam beberapa kasus, layanan individual memiliki konfigurasi terpisah untuk lokalisasi. Hal ini bervariasi antara distribusi dan server web, jadi periksa dokumentasi paket server web Anda untuk itu.

Apache di Ubuntu menggunakan `/etc/apache2/envvars`:

```sh
export LANG='en_US.UTF-8'
export LC_ALL='en_US.UTF-8'
```

Apache di CentOS menggunakan `/etc/sysconfig/httpd` (atau `/opt/rh/httpd24/root/etc/sysconfig/httpd`):

```sh
LANG='en_US.UTF-8'
```

<a id="production-certs"></a>

### Menggunakan otoritas sertifikat kustom

Weblate verifies SSL certificates during HTTP requests. Requests made using
HTTPX2 use the system certificate store, so install custom certificate
authorities there.

Check your distribution documentation for more details. For example, on Debian
this can be done by placing the CA certificate into
`/usr/local/share/ca-certificates/` and running
**update-ca-certificates**.

#### HINT
Kontainer Weblate tidak menyertakannya di jalur pencarian, Anda perlu menentukan jalur lengkap untuk menjalankannya. Misalnya:

```sh
docker compose exec -u root weblate /usr/sbin/update-ca-certificates
```

Once this is done, Weblate HTTPX2 requests and system tools, including Git, will
trust the certificate.

Some integrations, including OAuth and OpenID Connect authentication, use
Requests, which does not use the system certificate store by default. When
these integrations communicate with services using the custom certificate
authority, configure Requests to use the system CA bundle by adding the
following to `settings.py` (the path is Debian-specific):

```python
import os

os.environ["REQUESTS_CA_BUNDLE"] = "/etc/ssl/certs/ca-certificates.crt"
```

<a id="server"></a>

## Menjalankan server

#### HINT
Jika Anda tidak berpengalaman dengan layanan yang dijelaskan di bawah ini, Anda mungkin ingin mencoba [Memasang menggunakan Docker](https://docs.weblate.org/id/latest/admin/install/docker.md).

Anda akan memerlukan beberapa layanan untuk menjalankan Weblate, pengaturan yang direkomendasikan terdiri dari:

* Server basis data (lihat [Pengaturan basis data untuk Weblate](#database-setup))
* Server simpanan (lihat [Konfigurasi simpanan](#production-cache))
* Server web frontend untuk berkas statis dan penghentian SSL (lihat [Menyajikan berkas statis](#static-files))
* Server WSGI untuk konten dinamis (lihat [Contoh konfigurasi untuk NGINX dan uWSGI](#uwsgi))
* Celery untuk menjalankan tugas latar belakang (lihat [Tugas latar belakang menggunakan Celery](#celery))

#### NOTE
Ada beberapa ketergantungan antara layanan, misalnya simpanan dan basis data harus dijalankan saat memulai proses Celery atau uwsgi.

Umumnya, Anda akan menjalankan semua layanan pada satu server (virtual), tetapi jika pemasangan Anda sangat padat, Anda dapat membagi layanan tersebut. Satu-satunya batasannya adalah server Celery dan Wsgi memerlukan akses ke [`DATA_DIR`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-DATA_DIR).

#### NOTE
Proses WSGI harus dijalankan di bawah pengguna yang sama dengan proses Celery, jika tidak, berkas dalam [`DATA_DIR`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-DATA_DIR) akan disimpan dengan kepemilikan campuran, yang akan menyebabkan isu runtime.

Lihat juga [Izin sistem berkas](#file-permissions) dan [Tugas latar belakang menggunakan Celery](#celery).

### Menjalankan server web

Menjalankan Weblate tidak berbeda dengan menjalankan program berbasis Django lainnya. Django biasanya dijalankan sebagai WSGI atau fcgi (lihat contoh untuk berbagai webserver di bawah).

#### NOTE
The sample configuration files shown below are maintained in the Weblate
source tree under `weblate/examples/`. They are included in source
distributions and in this documentation, but Python wheels only install
runtime files. When installing Weblate from PyPI, get the matching source
distribution or source checkout before copying these examples.

Untuk tujuan pengujian, Anda dapat menggunakan server web bawaan di Django:

```sh
weblate runserver
```

#### WARNING
JANGAN GUNAKAN SERVER INI DALAM PENGATURAN PRODUKSI. Server ini belum melalui audit keamanan atau uji kinerja. Lihat juga dokumentasi Django tentang [`runserver`](https://docs.djangoproject.com/id/stable/ref/django-admin/#django-admin-runserver).

#### HINT
Server bawaan Django hanya menyajikan berkas statis dengan [`DEBUG`](#std-setting-DEBUG) diaktifkan karena ditujukan hanya untuk pengembangan. Untuk penggunaan produksi, silakan lihat pengaturan WSGI:

* [Contoh konfigurasi untuk NGINX dan Granian](#nginx-granian)
* [Contoh konfigurasi untuk NGINX dan Gunicorn](#nginx-gunicorn)
* [Contoh konfigurasi untuk NGINX dan uWSGI](#uwsgi)
* [Contoh konfigurasi untuk Apache](#apache)
* [Contoh konfigurasi untuk Apache dan Gunicorn](#apache-gunicorn)
* [Menyajikan berkas statis](#static-files)

<a id="static-files"></a>

### Menyajikan berkas statis

#### Versionchanged
Berubah pada versi 5.15.2: `/media/` tidak lagi digunakan untuk menyajikan tangkapan layar.

Django needs to collect its static files in a single directory. To do so,
execute `weblate collectstatic --noinput`. This will copy the static
files into a directory specified by the [`STATIC_ROOT`](https://docs.djangoproject.com/id/stable/ref/settings/#std-setting-STATIC_ROOT) setting (this defaults to
a `static` directory inside [`CACHE_DIR`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-CACHE_DIR)). Production installations
use content hashes in collected filenames so that updated assets do not reuse
stale browser or proxy caches.

Disarankan untuk menyajikan berkas statis langsung dari server web Anda, Anda harus menggunakannya untuk jalur berikut:

`/static/`
: Menyajikan berkas statis untuk Weblate dan antarmuka admin (dari yang didefinisikan oleh [`STATIC_ROOT`](https://docs.djangoproject.com/id/stable/ref/settings/#std-setting-STATIC_ROOT)).

`/favicon.ico`
: Should be rewritten to serve `/static/favicon.ico`.

#### SEE ALSO
* [Contoh konfigurasi untuk NGINX dan Granian](#nginx-granian)
* [Contoh konfigurasi untuk NGINX dan Gunicorn](#nginx-gunicorn)
* [Contoh konfigurasi untuk NGINX dan uWSGI](#uwsgi)
* [Contoh konfigurasi untuk Apache](#apache)
* [Contoh konfigurasi untuk Apache dan Gunicorn](#apache-gunicorn)
* [Bagaimana menyebarkan Django](https://docs.djangoproject.com/id/stable/howto/deployment/)
* [Bagaimana menyebarkan berkas tetap](https://docs.djangoproject.com/id/stable/howto/static-files/deployment/)

<a id="csp"></a>

### Kebijakan keamanan konten

Konfigurasi Weblate bawaan mengaktifkan alat tengah `weblate.middleware.SecurityMiddleware` yang mengatur kepala HTTP terkait keamanan seperti *Content-Security-Policy* atau *X-XSS-Protection*. Kepala HTTP ini secara bawaan dikonfigurasikan untuk bekerja dengan Weblate dan konfigurasinya, tetapi mungkin perlu disesuaikan dengan lingkungan Anda.

#### SEE ALSO
* [`CSP_SCRIPT_SRC`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-CSP_SCRIPT_SRC)
* [`CSP_IMG_SRC`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-CSP_IMG_SRC)
* [`CSP_CONNECT_SRC`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-CSP_CONNECT_SRC)
* [`CSP_STYLE_SRC`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-CSP_STYLE_SRC)
* [`CSP_FONT_SRC`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-CSP_FONT_SRC)
* [`CSP_FORM_SRC`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-CSP_FORM_SRC)

<a id="nginx-granian"></a>

### Contoh konfigurasi untuk NGINX dan Granian

The following configuration runs Weblate using Granian with the NGINX webserver:

```nginx
#
# nginx configuration for Weblate
#
# You will want to change:
#
# - server_name
# - change /home/weblate/weblate-env to location where Weblate Python environment is placed
# - change /home/weblate/data to match your DATA_DIR
# - change /home/weblate/data/cache to match your CACHE_DIR
# - change python3.12 to match your Python version
# - change weblate user to match your Weblate user
#
server {
    listen 80;
    server_name weblate;
    # Not used
    root /var/www/html;

    location ~ ^/favicon.ico$ {
        # CACHE_DIR/static/favicon.ico
        alias /home/weblate/data/cache/static/favicon.ico;
        expires 30d;
    }

    location /static/ {
        # CACHE_DIR/static/
        alias /home/weblate/data/cache/static/;
        expires 30d;
    }

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $http_host;
        proxy_pass http://127.0.0.1:8888;
        proxy_read_timeout 3600;
    }
}
```

#### SEE ALSO
* [Contoh konfigurasi untuk memulai Granian](#running-granian)
* [https://github.com/emmett-framework/granian](https://github.com/emmett-framework/granian)
* [Bagaimana menyebarkan dengan WSGI](https://docs.djangoproject.com/id/stable/howto/deployment/wsgi/)

<a id="nginx-gunicorn"></a>

### Contoh konfigurasi untuk NGINX dan Gunicorn

The following configuration runs Weblate using Gunicorn under the NGINX webserver
(`weblate/examples/weblate.nginx.gunicorn.conf` in the source tree):

```nginx
#
# nginx configuration for Weblate
#
# You will want to change:
#
# - server_name
# - change /home/weblate/weblate-env to location where Weblate Python environment is placed
# - change /home/weblate/data to match your DATA_DIR
# - change /home/weblate/data/cache to match your CACHE_DIR
# - change python3.12 to match your Python version
# - change weblate user to match your Weblate user
#
server {
    listen 80;
    server_name weblate;
    # Not used
    root /var/www/html;

    location ~ ^/favicon.ico$ {
        # CACHE_DIR/static/favicon.ico
        alias /home/weblate/data/cache/static/favicon.ico;
        expires 30d;
    }

    location /static/ {
        # CACHE_DIR/static/
        alias /home/weblate/data/cache/static/;
        expires 30d;
    }

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $http_host;
        proxy_pass http://unix:/run/gunicorn.sock;
        proxy_read_timeout 3600;
    }
}
```

#### SEE ALSO
* [Contoh konfigurasi untuk memulai Gunicorn](#running-gunicorn)
* [Bagaimana menggunakan Django dengan Gunicorn](https://docs.djangoproject.com/id/stable/howto/deployment/wsgi/gunicorn/)

<a id="uwsgi"></a>

### Contoh konfigurasi untuk NGINX dan uWSGI

To run production webserver, use the WSGI wrapper installed with Weblate (when
using a Python environment it is installed as
`~/weblate-env/lib/python3.14/site-packages/weblate/wsgi.py`). Don't
forget to set the Python search path to your Python environment as well (for
example using `virtualenv = /home/user/weblate-env` in uWSGI).

Konfigurasi berikut menjalankan Weblate sebagai uWSGI di bawah server web NGINX.

Configuration for NGINX (`weblate/examples/weblate.nginx.conf` in the source tree):

```nginx
#
# nginx configuration for Weblate
#
# You will want to change:
#
# - server_name
# - change /home/weblate/weblate-env to location where Weblate Python environment is placed
# - change /home/weblate/data to match your DATA_DIR
# - change /home/weblate/data/cache to match your CACHE_DIR
# - change python3.12 to match your Python version
# - change weblate user to match your Weblate user
#
server {
    listen 80;
    server_name weblate;
    # Not used
    root /var/www/html;

    location ~ ^/favicon.ico$ {
        # CACHE_DIR/static/favicon.ico
        alias /home/weblate/data/cache/static/favicon.ico;
        expires 30d;
    }

    location /static/ {
        # CACHE_DIR/static/
        alias /home/weblate/data/cache/static/;
        expires 30d;
    }

    location / {
        include uwsgi_params;
        # Needed for long running operations in admin interface
        uwsgi_read_timeout 3600;
        # Adjust based to uwsgi configuration:
        uwsgi_pass unix:///run/uwsgi/app/weblate/socket;
        # uwsgi_pass 127.0.0.1:8080;
    }
}
```

Configuration for uWSGI (`weblate/examples/weblate.uwsgi.ini` in the source tree):

```ini
#
# uWSGI configuration for Weblate
#
# You will want to change:
#
# - change /home/weblate/weblate-env to location where Weblate Python environment is placed
# - change /home/weblate/data to match your DATA_DIR
# - change python3.12 to match your Python version
# - change weblate user to match your Weblate user
#
[uwsgi]
plugins       = python3
master        = true
protocol      = uwsgi
socket        = 127.0.0.1:8080
wsgi-file     = /home/weblate/weblate-env/lib/python3.12/site-packages/weblate/wsgi.py

# Add path to Weblate checkout if you did not install
# Weblate by pip
# python-path   = /path/to/weblate

# Path to the Python environment
virtualenv = /home/weblate/weblate-env

# Set sys.executable so Python helpers run with the virtual environment's Python
py-executable = /home/weblate/weblate-env/bin/python

# Needed for OAuth/OpenID
buffer-size   = 8192

# Reload when consuming too much of memory
reload-on-rss = 250

# Increase number of workers for heavily loaded sites
workers       = 8

# Enable threads for Sentry error submission
enable-threads = true

# Child processes do not need file descriptors
close-on-exec = true

# Avoid default 0000 umask
umask = 0022

# Run as weblate user
uid = weblate
gid = weblate

# Enable harakiri mode (kill requests after some time)
# harakiri = 3600
# harakiri-verbose = true

# Enable uWSGI stats server
# stats = :1717
# stats-http = true

# Do not log some errors caused by client disconnects
ignore-sigpipe = true
ignore-write-errors = true
disable-write-exception = true
```

Set `py-executable` to the absolute path of `bin/python` inside the
environment configured by `virtualenv`. Weblate uses Python's
`sys.executable` to launch helper processes, including the SSH connection
proxy used for Git repositories. uWSGI can otherwise set this value to its own
executable, causing repository operations to fail with an error such as
`/usr/bin/uwsgi-core: invalid option -- 'I'`. Setting `virtualenv` alone does
not ensure that `sys.executable` points to Python. Restart uWSGI after updating
the configuration.

#### SEE ALSO
[Bagaimana menggunakan Django dengan uWSGI](https://docs.djangoproject.com/id/stable/howto/deployment/wsgi/uwsgi/)

<a id="apache"></a>

### Contoh konfigurasi untuk Apache

Disarankan untuk menggunakan prefork MPM saat menggunakan WSGI dengan Weblate.

The following configuration runs Weblate as WSGI, you need to have enabled
`mod_wsgi` (`weblate/examples/apache.conf` in the source tree):

```apache
#
# VirtualHost for Weblate
#
# You will want to change:
#
# - ServerAdmin and ServerName
# - change /home/weblate/weblate-env to location where Weblate Python environment is placed
# - change /home/weblate/data to match your DATA_DIR
# - change /home/weblate/data/cache to match your CACHE_DIR
# - change python3.12 to match Python version mod-wsgi is compiled for
# - change weblate user to match your Weblate user
#
<VirtualHost *:80>
    ServerAdmin admin@weblate.example.org
    ServerName weblate.example.org

    # CACHE_DIR/static/favicon.ico
    Alias /favicon.ico /home/weblate/data/cache/static/favicon.ico

    # CACHE_DIR/static/
    Alias /static/ /home/weblate/data/cache/static/
    <Directory /home/weblate/data/cache/static/>
        Require all granted
    </Directory>

    # Path to your Weblate Python environment
    WSGIDaemonProcess weblate python-home=/home/weblate/weblate-env user=weblate request-timeout=600
    WSGIProcessGroup weblate
    WSGIApplicationGroup %{GLOBAL}

    WSGIScriptAlias / /home/weblate/weblate-env/lib/python3.12/site-packages/weblate/wsgi.py process-group=weblate
    WSGIPassAuthorization On

    <Directory /home/weblate/weblate-env/lib/python3.12/site-packages/weblate/>
        <Files wsgi.py>
        Require all granted
        </Files>
    </Directory>

</VirtualHost>
```

#### NOTE
Weblate membutuhkan Python 3, jadi pastikan Anda menjalankan varian Python 3 dari modwsgi. Biasanya tersedia sebagai paket terpisah, misalnya `libapache2-mod-wsgi-py3`.

Gunakan versi Python yang cocok untuk memasang Weblate.

#### SEE ALSO
* [Lokalisasi dan pengenkodean sistem](#production-encoding)
* [Bagaimana menggunakan Django dengan Apache dan mod_wsgi](https://docs.djangoproject.com/id/stable/howto/deployment/wsgi/modwsgi/)

<a id="apache-gunicorn"></a>

### Contoh konfigurasi untuk Apache dan Gunicorn

The following configuration runs Weblate in Gunicorn and Apache 2.4
(`weblate/examples/apache.gunicorn.conf` in the source tree):

```apache
#
# VirtualHost for Weblate using gunicorn on localhost:8000
#
# You will want to change:
#
# - ServerAdmin and ServerName
# - change /home/weblate/weblate-env to location where Weblate Python environment is placed
# - change /home/weblate/data to match your DATA_DIR
# - change /home/weblate/data/cache to match your CACHE_DIR
# - change weblate user to match your Weblate user
#
<VirtualHost *:443>
    ServerAdmin admin@weblate.example.org
    ServerName weblate.example.org

    # CACHE_DIR/static/favicon.ico
    Alias /favicon.ico /home/weblate/data/cache/static/favicon.ico

    # CACHE_DIR/static/
    Alias /static/ /home/weblate/data/cache/static/
    <Directory /home/weblate/data/cache/static/>
        Require all granted
    </Directory>

    SSLEngine on
    SSLCertificateFile /etc/apache2/ssl/https_cert.cert
    SSLCertificateKeyFile /etc/apache2/ssl/https_key.pem
    SSLProxyEngine On

    ProxyPass /favicon.ico !
    ProxyPass /static/ !

    ProxyPass / http://localhost:8000/
    ProxyPassReverse / http://localhost:8000/
    ProxyPreserveHost On
</VirtualHost>
```

#### SEE ALSO
* [Contoh konfigurasi untuk memulai Gunicorn](#running-gunicorn)
* [Bagaimana menggunakan Django dengan Gunicorn](https://docs.djangoproject.com/id/stable/howto/deployment/wsgi/gunicorn/)

<a id="running-granian"></a>

### Contoh konfigurasi untuk memulai Granian

Weblate memiliki dependensi opsional wsgi (lihat [Dependensi Python](#python-deps)) yang akan memasang semua yang Anda butuhkan untuk menjalankan Granian. Saat memasang Weblate, Anda dapat menentukannya sebagai berikut:

```shell
uv pip install Weblate[all,wsgi]
```

Setelah Granian terpasang, Anda dapat menjalankannya. Proses ini biasanya dilakukan di tingkat sistem. Contoh berikut menunjukkan cara memulai melalui systemd:

```ini
[Unit]
Description=granian daemon
After=network.target

[Service]
User=weblate
Group=weblate
WorkingDirectory=/home/weblate/weblate-env/
Environment="DJANGO_SETTINGS_MODULE=weblate.settings"
RuntimeDirectory=granian
ExecStart=/home/weblate/weblate-env/bin/granian \
    --no-ws \
    --workers-max-rss 450 \
    --interface wsgi \
    --workers 2 \
    --blocking-threads 8 \
    --backlog 128 \
    --backpressure 16 \
    --runtime-mode mt \
    --port 8888 \
    weblate.wsgi:application

[Install]
WantedBy=multi-user.target
```

Granian uses worker processes for parallel Python execution, blocking threads
for concurrent WSGI requests, and runtime threads for network I/O. The sample
uses two workers with eight blocking threads each, limits each worker to 16
concurrent connections, and leaves the runtime threads at Granian's default.
Adjust the workers and blocking threads to the available memory, CPU cores, and
database connection limit. Keep the backpressure equal to or higher than the
number of blocking threads.

#### SEE ALSO
* [Sample configuration to start Granian with ASGI](#running-granian-asgi)
* [https://github.com/emmett-framework/granian](https://github.com/emmett-framework/granian)
* [Bagaimana menyebarkan dengan WSGI](https://docs.djangoproject.com/id/stable/howto/deployment/wsgi/)

<a id="running-granian-asgi"></a>

### Sample configuration to start Granian with ASGI

#### Versionadded
Added in version 2026.8.

ASGI deployment is available as an opt-in alternative to WSGI. Install the
`asgi` optional dependency:

```shell
uv pip install Weblate[all,asgi]
```

The following systemd unit runs the Django ASGI application:

```ini
[Unit]
Description=granian ASGI daemon
After=network.target

[Service]
User=weblate
Group=weblate
WorkingDirectory=/home/weblate/weblate-env/
Environment="DJANGO_SETTINGS_MODULE=weblate.settings"
RuntimeDirectory=granian
ExecStart=/home/weblate/weblate-env/bin/granian \
    --no-ws \
    --workers-max-rss 450 \
    --interface asginl \
    --workers 2 \
    --backlog 128 \
    --backpressure 16 \
    --runtime-mode mt \
    --port 8888 \
    weblate.asgi:application

[Install]
WantedBy=multi-user.target
```

The sample uses Granian's ASGI interface without lifespan or WebSocket support,
because Weblate currently exposes HTTP only. Weblate's middleware supports both
deployment modes and uses thread-sensitive adapters where it still relies on
synchronous Django APIs. The health check is asynchronous, but most Weblate
views remain synchronous, and CPU-intensive or long-running work should still
be handled by [Tugas latar belakang menggunakan Celery](#celery).

WSGI remains the default deployment mode. Docker images can opt in to ASGI by
setting [`WEBLATE_ASGI`](https://docs.weblate.org/id/latest/admin/install/docker.md#envvar-WEBLATE_ASGI) to `1`. Adjust the worker count and
backpressure to the available memory, CPU cores, and database connection limit.

#### SEE ALSO
* [Contoh konfigurasi untuk memulai Granian](#running-granian)
* [https://github.com/emmett-framework/granian](https://github.com/emmett-framework/granian)
* [Bagaimana mengembangkan dengan ASGI](https://docs.djangoproject.com/id/stable/howto/deployment/asgi/)

<a id="running-gunicorn"></a>

### Contoh konfigurasi untuk memulai Gunicorn

Gunicorn harus dipasang secara terpisah:

```shell
uv pip install gunicorn
```

Setelah Gunicorn terpasang, Anda dapat menjalankannya. Proses ini biasanya dilakukan di tingkat sistem. Contoh berikut menunjukkan proses memulai melalui systemd:

```ini
[Unit]
Description=gunicorn socket

[Socket]
ListenStream=/run/gunicorn.sock

[Install]
WantedBy=sockets.target
```

```ini
[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target

[Service]
User=weblate
Group=weblate
WorkingDirectory=/home/weblate/weblate-env/
Environment="DJANGO_SETTINGS_MODULE=weblate.settings"
ExecStart=/home/weblate/weblate-env/bin/gunicorn \
    --preload \
    --timeout 3600 \
    --graceful-timeout 3600 \
    --worker-class=gthread \
    --workers=2 \
    --threads=16 \
    --bind unix:/run/gunicorn.sock \
    weblate.wsgi:application

[Install]
WantedBy=multi-user.target
```

#### SEE ALSO
[Bagaimana menggunakan Django dengan Gunicorn](https://docs.djangoproject.com/id/stable/howto/deployment/wsgi/gunicorn/)

### Menjalankan Weblate di bawah jalur

Disarankan untuk menggunakan prefork MPM saat menggunakan WSGI dengan Weblate.

A sample Apache configuration to serve Weblate under `/weblate`. Again using
`mod_wsgi` (`weblate/examples/apache-path.conf` in the source tree):

```apache
#
# VirtualHost for Weblate, running under /weblate path
#
# You will want to change:
#
# - ServerAdmin and ServerName
# - change /home/weblate/weblate-env to location where Weblate Python environment is placed
# - change /home/weblate/data to match your DATA_DIR
# - change /home/weblate/data/cache to match your CACHE_DIR
# - change python3.12 to match Python version mod-wsgi is compiled for
# - change weblate user to match your Weblate user
#
<VirtualHost *:80>
    ServerAdmin admin@weblate.example.org
    ServerName weblate.example.org

    # CACHE_DIR/static/favicon.ico
    Alias /weblate/favicon.ico /home/weblate/data/cache/static/favicon.ico

    # CACHE_DIR/static/
    Alias /weblate/static/ /home/weblate/data/cache/static/
    <Directory /home/weblate/data/cache/static/>
        Require all granted
    </Directory>

    # Path to your Weblate Python environment
    WSGIDaemonProcess weblate python-home=/home/weblate/weblate-env user=weblate request-timeout=600
    WSGIProcessGroup weblate
    WSGIApplicationGroup %{GLOBAL}

    WSGIScriptAlias /weblate /home/weblate/weblate-env/lib/python3.12/site-packages/weblate/wsgi.py process-group=weblate
    WSGIPassAuthorization On

    <Directory /home/weblate/weblate-env/lib/python3.12/site-packages/weblate/>
        <Files wsgi.py>
        Require all granted
        </Files>
    </Directory>

</VirtualHost>
```

Selain itu, Anda harus menyesuaikan `weblate/settings.py`:

```python
URL_PREFIX = "/weblate"
```

<a id="celery"></a>

## Tugas latar belakang menggunakan Celery

Weblate menggunakan Celery untuk menjalankan tugas reguler dan latar belakang. Anda seharusnya menjalankan layanan Celery yang akan menjalankan tugas ini. Misalnya, layanan ini bertanggung jawab untuk menangani operasi berikut (daftar ini belum lengkap):

* Menerima kait web dari layanan eksternal (lihat [Pengait notifikasi](https://docs.weblate.org/id/latest/api.md#hooks)).
* Menjalankan tugas pemeliharaan rutin seperti pencadangan, pembersihan, pengaya harian, atau pembaruan (lihat [Mencadangkan dan memindahkan Weblate](https://docs.weblate.org/id/latest/admin/backup.md#backup), [`BACKGROUND_TASKS`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-BACKGROUND_TASKS), [Pengaya](https://docs.weblate.org/id/latest/admin/addons.md#addons)).
* Menjalankan [Terjemahan otomatis](https://docs.weblate.org/id/latest/user/translating.md#auto-translation).
* Mengirim notifikasi intisari.
* Memindahkan operasi mahal dari proses WSGI.
* Mengkomit perubahan yang tertunda (lihat [Komit malas](https://docs.weblate.org/id/latest/admin/continuous.md#lazy-commit)).

Pengaturan umum menggunakan Valkey atau Redis sebagai backend terlihat seperti ini:

```python
CELERY_TASK_ALWAYS_EAGER = False
CELERY_BROKER_URL = "redis://localhost:6379"
CELERY_RESULT_BACKEND = CELERY_BROKER_URL
```

#### SEE ALSO
[Konfigurasi broker Redis di Celery](https://docs.celeryq.dev/en/stable/getting-started/backends-and-brokers/redis.html#broker-redis-configuration)

You should also start the Celery worker to process the tasks and start scheduled
tasks. For debugging or development, this can be done directly on the
command-line:

```sh
celery --app=weblate.utils worker --beat \
    --queues=celery,notify,memory,translate,backup \
    --prefetch-multiplier=1
```

Running all queues in one prefork worker shares the initial application memory
between its child processes while retaining parallel task execution. Celery
determines the concurrency from the number of available CPUs by default; use
`--concurrency` to adjust it for your workload and available memory.

To reduce startup memory usage, Celery workers do not repeat the Django system
checks. The Weblate container runs the more comprehensive
**weblate check --deploy** automatically during container startup. For
other installation methods, run the command after installation, upgrades, or
configuration changes. The checks are also available in the
[management interface](https://docs.weblate.org/id/latest/admin/admin.md#manage-performance).

#### NOTE
Proses Celery harus dijalankan di bawah pengguna yang sama dengan proses WSGI, jika tidak, berkas dalam [`DATA_DIR`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-DATA_DIR) akan disimpan dengan kepemilikan campuran, yang akan menyebabkan isu runtime.

Lihat juga [Izin sistem berkas](#file-permissions) dan [Menjalankan server](#server).

### Menjalankan tugas Celery di WSGI menggunakan mode eager

#### NOTE
Hal ini akan berdampak parah pada kinerja antarmuka web dan akan merusak fitur yang bergantung pada pemicu reguler (misalnya melakukan perubahan yang tertunda, notifikasi intisari, atau pencadangan).

Untuk pengembangan, Anda mungkin ingin menggunakan konfigurasi eager, yang memproses semua tugas di tempatnya:

```python
CELERY_TASK_ALWAYS_EAGER = True
CELERY_BROKER_URL = "memory://"
CELERY_TASK_EAGER_PROPAGATES = True
```

### Menjalankan Celery sebagai layanan sistem

Most likely you will want to run Celery as a daemon and that is covered by
[Daemonization](https://docs.celeryq.dev/en/stable/userguide/daemonizing.html). For the most common Linux setup using
systemd, adapt the example files listed below. These examples are maintained in
the Weblate source tree under `weblate/examples/`; Python wheels do not
install these deployment samples.

Unit Systemd akan ditempatkan sebagai `/etc/systemd/system/celery-weblate.service`:

```ini
[Unit]
Description=Celery Service (Weblate)
After=network.target

[Service]
Type=forking
User=weblate
Group=weblate
EnvironmentFile=/etc/default/celery-weblate
WorkingDirectory=/home/weblate
RuntimeDirectory=celery
RuntimeDirectoryPreserve=restart
LogsDirectory=celery
ExecStart=/bin/sh -c '${CELERY_BIN} multi start ${CELERYD_NODES} \
  -A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} \
  --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}'
ExecStop=/bin/sh -c '${CELERY_BIN} multi stopwait ${CELERYD_NODES} \
  --pidfile=${CELERYD_PID_FILE}'
ExecReload=/bin/sh -c '${CELERY_BIN} multi restart ${CELERYD_NODES} \
  -A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} \
  --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}'

[Install]
WantedBy=multi-user.target
```

Konfigurasi lingkungan akan ditempatkan sebagai `/etc/default/celery-weblate`:

```sh
# Name of nodes to start
CELERYD_NODES="combined"

# Absolute or relative path to the 'celery' command:
CELERY_BIN="/home/weblate/weblate-env/bin/celery"

# App instance to use
# comment out this line if you don't use an app
CELERY_APP="weblate.utils"

# Extra command-line arguments to the worker. Celery determines concurrency
# from the number of available CPUs by default. You might need to customize it
# depending on the available resources and Weblate usage. Increase concurrency
# if you get weblate.E019 error, decrease it on a low-resource system.
# Command-line values override corresponding Celery settings in settings.py.
CELERYD_OPTS="--beat:combined --queues:combined=celery,notify,memory,translate,backup --prefetch-multiplier:combined=1"

# Logging configuration
# - %n will be replaced with the first part of the nodename.
# - %I will be replaced with the current child process index
#   and is important when using the prefork pool to avoid race conditions.
CELERYD_PID_FILE="/run/celery/weblate-%n.pid"
CELERYD_LOG_FILE="/var/log/celery/weblate-%n%I.log"
CELERYD_LOG_LEVEL="INFO"
```

Konfigurasi tambahan untuk memutar catatan Celery menggunakan **logrotate** untuk ditempatkan sebagai `/etc/logrotate.d/celery`:

```text
/var/log/celery/*.log {
        weekly
        missingok
        rotate 12
        compress
        notifempty
}
```

### Tugas berkala menggunakan Celery beat

Weblate dilengkapi dengan pengaturan bawaan untuk tugas terjadwal. Jadwal tugas disimpan dalam basis data dan tugas dieksekusi oleh daemon Celery beat.

#### HINT
Anda dapat mendefinisikan tugas tambahan di `settings.py`, misalnya lihat [Komit malas](https://docs.weblate.org/id/latest/admin/continuous.md#lazy-commit).

<a id="monitoring-celery"></a>

### Memantau status Celery

Anda dapat menemukan panjang antrian tugas Celery saat ini di [Antarmuka pengelolaan](https://docs.weblate.org/id/latest/admin/admin.md#management-interface) atau menggunakan [`celery_queues`](https://docs.weblate.org/id/latest/admin/management.md#weblate-admin-celery_queues) di baris perintah. Jika antrian terlalu panjang, Anda juga akan mendapatkan galat konfigurasi di antarmuka admin.

#### WARNING
Galat Celery secara bawaan hanya dicatat ke dalam catatan Celery dan tidak terlihat oleh pengguna. Jika Anda ingin melihat ikhtisar kegagalan tersebut, disarankan untuk mengkonfigurasikan [Mengumpulkan laporan galat dan memantau kinerja](#collecting-errors).

#### SEE ALSO
* [Pemantauan Weblate](#monitoring)
* [Bagaimana saya dapat memeriksa apakah Weblate saya telah diatur dengan benar?](https://docs.weblate.org/id/latest/faq.md#faq-monitoring)
* [Configuration and defaults](https://docs.celeryq.dev/en/stable/userguide/configuration.html)
* [Workers Guide](https://docs.celeryq.dev/en/stable/userguide/workers.html)
* [Daemonization](https://docs.celeryq.dev/en/stable/userguide/daemonizing.html)
* [Monitoring and Management Guide](https://docs.celeryq.dev/en/stable/userguide/monitoring.html)
* [Tugas latar belakang internal](https://docs.weblate.org/id/latest/contributing/internals.md#background-tasks-internals)
* [`celery_queues`](https://docs.weblate.org/id/latest/admin/management.md#weblate-admin-celery_queues)

<a id="minimal-celery"></a>

### Pengaturan Celery proses tunggal

Jika memori Anda sangat terbatas, Anda mungkin ingin mengurangi jumlah proses Weblate. Semua tugas Celery dapat dieksekusi dalam satu proses menggunakan:

```sh
celery --app=weblate.utils worker --beat --queues=celery,notify,memory,translate,backup --pool=solo
```

An installation using Docker can be configured to use a single-process Celery
setup by setting `CELERY_WORKER_MODE=single`. See
[`CELERY_WORKER_MODE`](https://docs.weblate.org/id/latest/admin/install/docker.md#envvar-CELERY_WORKER_MODE).

#### WARNING
Ini akan memiliki dampak kinerja yang nyata pada Weblate.

<a id="monitoring"></a>

## Pemantauan Weblate

Weblate menyediakan URL `/healthz/` untuk digunakan dalam pemeriksaan kesehatan sederhana, misalnya menggunakan Kubernetes. Kontainer Docker memiliki pemeriksaan kesehatan bawaan menggunakan URL ini.

For monitoring metrics of Weblate you can use the [`GET /api/metrics/`](https://docs.weblate.org/id/latest/api.md#get--api-metrics-) API
endpoint. Monitoring tools running locally can retrieve the same metrics using
the [`metrics`](https://docs.weblate.org/id/latest/admin/management.md#weblate-admin-metrics) command.

#### SEE ALSO
* [Bagaimana saya dapat memeriksa apakah Weblate saya telah diatur dengan benar?](https://docs.weblate.org/id/latest/faq.md#faq-monitoring)
* [Memantau status Celery](#monitoring-celery)
* [Pengaya Weblate untuk Munin](https://github.com/WeblateOrg/munin)

<a id="collecting-errors"></a>

## Mengumpulkan laporan galat dan memantau kinerja

Weblate, seperti perangkat lunak lainnya, dapat gagal. Untuk mengumpulkan status kegagalan yang bermanfaat, kami sarankan untuk menggunakan layanan pihak ketiga untuk mengumpulkan informasi tersebut. Ini sangat berguna jika terjadi kegagalan tugas Celery, yang jika tidak, hanya akan melaporkan galat ke log dan Anda tidak akan mendapatkan notifikasi. Weblate mendukung layanan berikut:

### Surel

Konfigurasi Weblate bawaan menginstrumentasikan Django untuk mengirim surel saat galat server melalui [`django.utils.log.AdminEmailHandler`](https://docs.djangoproject.com/id/stable/ref/logging/#django.utils.log.AdminEmailHandler). Ini adalah pengaturan yang paling mudah, tetapi Anda harus mempertimbangkan opsi lain karena alasan privasi, karena surel galat mungkin berisi data sensitif. Anda dapat membaca lebih lanjut tentang hal itu di [Implikasi keamanan](https://docs.djangoproject.com/id/stable/topics/logging/#logging-security-implications).

Untuk menonaktifkan perilaku ini, hapus `mail_admins` dari [`LOGGING`](https://docs.djangoproject.com/id/stable/ref/settings/#std-setting-LOGGING) di pengaturan Weblate, atau nonaktifkan [`WEBLATE_ADMIN_NOTIFY_ERROR`](https://docs.weblate.org/id/latest/admin/install/docker.md#envvar-WEBLATE_ADMIN_NOTIFY_ERROR) di lingkungan Docker.

### Sentry

Weblate memiliki dukungan bawaan untuk [Sentry](https://sentry.io/). Untuk menggunakannya, cukup atur [`SENTRY_DSN`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-SENTRY_DSN) di `settings.py`:

```python
SENTRY_DSN = "https://id@your.sentry.example.com/"
```

Sentry juga dapat digunakan untuk memantau kinerja Weblate dengan mengumpulkan jejak dan profil untuk persentase operasi yang ditentukan. Hal ini dapat dikonfigurasikan menggunakan [`SENTRY_TRACES_SAMPLE_RATE`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-SENTRY_TRACES_SAMPLE_RATE) dan [`SENTRY_PROFILES_SAMPLE_RATE`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-SENTRY_PROFILES_SAMPLE_RATE).

#### SEE ALSO
* [Pemantauan Kinerja Sentry](https://docs.sentry.io/product/sentry-basics/performance-monitoring/)
* [Sentry Profiling](https://docs.sentry.io/product/profiling/)

### Google Cloud Error Reporting

Weblate can report handled server errors to [Google Cloud Error Reporting](https://docs.cloud.google.com/error-reporting/docs/grouping-errors).
Install Weblate with the `google-errors` extra and configure
[`GOOGLE_CLOUD_ERROR_REPORTING`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-GOOGLE_CLOUD_ERROR_REPORTING) in `settings.py`:

```python
GOOGLE_CLOUD_ERROR_REPORTING = {
    "project": "your-google-cloud-project",
}
```

Weblate automatically reports errors under the `weblate` service and uses the
current Weblate version or Git revision as the reported version. These values
can be overridden by setting `service` or `version` in
[`GOOGLE_CLOUD_ERROR_REPORTING`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-GOOGLE_CLOUD_ERROR_REPORTING).

### OpenTelemetry

Weblate can export backend traces using [OpenTelemetry](https://opentelemetry.io/).
It uses OTLP over HTTP and can send traces to an OpenTelemetry Collector or a
compatible vendor endpoint.

```python
OPENTELEMETRY_ENABLED = True
OPENTELEMETRY_EXPORTER_OTLP_ENDPOINT = "https://collector.example.com/v1/traces"
OPENTELEMETRY_TRACES_SAMPLE_RATE = 0.1
```

The integration traces Django requests, Celery tasks, Redis, outgoing HTTP
requests, database calls, and Weblate-specific spans. Configure it using
[`OPENTELEMETRY_ENABLED`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-OPENTELEMETRY_ENABLED),
[`OPENTELEMETRY_EXPORTER_OTLP_ENDPOINT`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-OPENTELEMETRY_EXPORTER_OTLP_ENDPOINT), and
[`OPENTELEMETRY_TRACES_SAMPLE_RATE`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-OPENTELEMETRY_TRACES_SAMPLE_RATE).

<a id="rollbar-errors"></a>

### Rollbar

Weblate memiliki dukungan bawaan untuk [Rollbar](https://rollbar.com/). Untuk menggunakannya, cukup ikuti petunjuk untuk [Rollbar pemberitahu untuk Python](https://docs.rollbar.com/docs/python/).

Singkatnya, Anda perlu menyesuaikan `settings.py`:

```python
# Add rollbar as last middleware:
MIDDLEWARE = [
    # … other middleware classes …
    "rollbar.contrib.django.middleware.RollbarNotifierMiddleware",
]

# Configure client access
ROLLBAR = {
    "access_token": "POST_SERVER_ITEM_ACCESS_TOKEN",
    "environment": "development" if DEBUG else "production",
    "branch": "main",
    "root": "/absolute/path/to/code/root",
}
```

Segala sesuatu lainnya terintegrasi secara otomatis, Anda sekarang akan mengumpulkan galat sisi server dan klien.

#### NOTE
Pencatatan galat juga mencakup pengecualian yang ditangani dengan baik, tetapi mungkin menunjukkan adanya masalah - seperti kegagalan penguraian berkas yang diunggah.

<a id="graylog"></a>

### Pengelolaan catatan Graylog

#### Versionadded
Added in version 5.9.

Weblate dapat dikonfigurasikan untuk melakukan pencatatan menggunakan protokol TCP GELF. Ini dikembangkan untuk integrasi Graylog, tetapi dapat digunakan dengan platform pencatatan apa pun yang kompatibel.

Boilerplate konfigurasi disertakan dalam [Contoh konfigurasi](https://docs.weblate.org/id/latest/admin/sample.md#sample-configuration), untuk Docker ini dapat dikonfigurasikan menggunakan [`WEBLATE_LOG_GELF_HOST`](https://docs.weblate.org/id/latest/admin/install/docker.md#envvar-WEBLATE_LOG_GELF_HOST).

## Memigrasikan Weblate ke server lain

Memigrasikan Weblate ke server lain seharusnya cukup mudah, tetapi data disimpan di beberapa lokasi yang perlu Anda migrasikan dengan hati-hati. Pendekatan terbaik adalah menghentikan Weblate untuk migrasi.

### Memigrasikan basis data

The most straightforward approach is to use database native tools, as they are
usually the most effective (e.g. **pg_dump**). Alternatively you can use
replication if your database supports it.

#### SEE ALSO
Memigrasikan antar basis data dijelaskan dalam [Memigrasikan dari basis data lain ke PostgreSQL](https://docs.weblate.org/id/latest/admin/upgrade.md#database-migration).

### Memigrasikan repositori VCS

Repositori VCS yang disimpan di bawah [`DATA_DIR`](https://docs.weblate.org/id/latest/admin/config.md#std-setting-DATA_DIR) juga perlu dimigrasikan. Anda cukup menyalinnya atau menggunakan **rsync** untuk melakukan migrasi dengan lebih efektif.

### Catatan lainnya

Jangan lupa untuk memindahkan layanan lain yang mungkin digunakan Weblate seperti Valkey, Redis, pekerjaan Cron atau backend autentikasi kustom.
