「Ente サーバー」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
(一部翻訳)
30行目: 30行目:
 
* {{ic|postgresql}}
 
* {{ic|postgresql}}
   
== Configuration ==
+
== 設定 ==
   
=== MinIO setup ===
+
=== MinIO のセットアップ ===
   
  +
設定ファイルを以下のように[[テキスト編集|編集]]してください:
[[textedit|Edit]] the configuration file as follows:
 
   
 
{{hc|/etc/minio/minio.conf|2=
 
{{hc|/etc/minio/minio.conf|2=
43行目: 43行目:
 
}}
 
}}
   
[[Enable/start]] {{ic|minio.service}}.
+
{{ic|minio.service}} を[[有効化/起動]]します。
   
  +
''mcli'' コマンドを使って (minio ユーザーとして) [[MinIO]] ente-server バケットを作成します:
Create [[MinIO]] ente-server bucket with the ''mcli'' command (as the minio user):
 
   
 
# cd /srv/minio/data
 
# cd /srv/minio/data

2024年5月6日 (月) 19:31時点における版

関連記事

Ente サーバー は、Ente (モバイル) クライアントに暗号化されたデータの塊を保存・提供するサーバー部分です。クライアントは暗号化されたデータを送受信し、それが Ente サーバーに届き、ローカルの MinIO オブジェクト ストレージ サービスを通じて保存・読み取りが行われます。

例えば、Ente フォト クライアントを使用すると、クライアントは写真を暗号化し、それらはサーバーに保存されます。後に、クライアントは暗号化された写真を検索し、ローカルで復号できます (エンドツーエンド暗号化)。クライアント、もしくはクライアントが写真を共有した相手のみが暗号鍵を持っているため、データを復号して実際に写真を見ることができるのはその人たちだけであり、サーバーはその鍵の情報を持っていないため見ることができません。

インストール

ente-server-gitAUR パッケージは、デフォルトで提供される Docker 化された Ente サーバーとは異なり、セルフホスティング用に設計されています。Docker 化またはホスティングソリューションが必要な場合は、ente.io を参照してください。

まず、ente-server-gitAUR パッケージをインストールしてください。

セルフホストのサーバー スペースは容量が限られていることが多いため、ente-server-gitAUR パッケージは、古くてリンクされていない Ente サーバー MinIO オブジェクトをより迅速にクリーンアップするように変更されています。デフォルトの Ente サーバーは通常 45 日ごとにオブジェクトをクリーンアップしますが、このパッケージではその期間が 5 分ごとに短縮されています。

Ente サーバーを稼働させるには、PostgreSQL データベース (Ente オブジェクトのメタデータやユーザーデータの保存用) と MinIO バケット (暗号化されたオブジェクトデータの保存用) が必要です。また、Ente サーバーにアクセスするための HTTPS プロキシとして Nginx の使用が推奨されます。最後に、ente-cli ツールを使うと、Ente サーバーのアカウントの容量制限や有効期限の更新が簡単に行えます。

これらの必要なコンポーネントをインストールするには、オプションの依存関係としてリストされているパッケージをインストールすることが推奨されます。同じホストにインストールする場合は、依存パッケージとしてインストールするのが望ましいです。例えば、これらのパッケージをインストールする際、pacman の場合は --asdeps オプションを使用し、または yayAUR でインストールすることができます。

参考までに、以下のパッケージがオプションの依存関係としてリストされています。

  • minio
  • minio-client
  • nginx
  • postgresql

設定

MinIO のセットアップ

設定ファイルを以下のように編集してください:

/etc/minio/minio.conf
MINIO_VOLUMES="/srv/minio/data"
MINIO_ROOT_USER=minio
MINIO_ROOT_PASSWORD='YOUR-STRONG-MINIO-ROOT-PASSWORD'
MINIO_OPTS="--address your_public_domain.tld:3200 --console-address 127.0.0.1:3201"

minio.service有効化/起動します。

mcli コマンドを使って (minio ユーザーとして) MinIO ente-server バケットを作成します:

# cd /srv/minio/data
[minio]$ mcli mb -p ente-server

PostgreSQL setup

Initialize the database as the postgres user:

[postgres]$ initdb --locale en_US.UTF-8 -D '/var/lib/postgres/data' --data-checksums --auth=scram-sha-256 --pwprompt

Configure to only listen on a AF_UNIX socket:

/var/lib/postgres/data/postgresql.conf
listen_addresses = '' # AF_UNIX Socket only

Restrict socket access to PostgreSQL user or group by editing postgresql.service:

/etc/systemd/system/postgresql.d/socket-access-restriction.conf
[Service]
RuntimeDirectoryMode=750

Add ente to the postgres user group, then start/enablepostgresql.service.

Create PostgreSQL database user and a database owned by this user (specify new password twice, then specify postgres password to store new account):

[postgres]$ createuser -P ente

Then specify postgres password to create new database:

[postgres]$ createdb -T template0 -O ente -E unicode ente-server

Running ente-server

Add MinIO bucket details:

/etc/ente-server/local.yaml
b2-eu-cen:
    key: minio
    secret: "YOUR-STRONG-MINIO-ROOT-PASSWORD"
    endpoint: your_public_domain.tld:3200
    region: eu-central-2
    bucket: ente-server

Add PostgreSQL details:

/etc/ente-server/local.yaml
db:
    host: /run/postgresql
    port: 5432
    name: ente-server
    user: ente
    password: "YOUR-STRONG-ENTE-DATABASE-USER-PASSWORD"

Generate new secret key values using the ente-server-gen-random-keys command and use these values as a replacement of the default values in the /etc/ente-server/local.yaml configuration file.

Edit ente-server.service to allow it to access to the IP address of your_public_domain.tld (by default the service only allows access from and to localhost):

[Service]
IPAddressAllowテンプレート:=IP_address_of_your_public_domain.tld

Enable/start ente-server.service.

Configuring Nginx proxy

Copy the example Nginx config and the accompanying HTTP(S) security header config files to the Nginx configuration directory:

# cp -v /usr/lib/ente-server/ente-server-nginx.conf /etc/nginx/
# cp -v /usr/lib/ente-server/http*security_headers.conf /etc/nginx/

Edit this example config, and replace your_public_domain.tld with your actual public domain name

Request a letsencrypt ceritifacte (or a SSL certificate from another provider) if not already done so:

# certbot certonly --email your_email --agree-tos --preferred-challenge http --webroot -w /var/lib/letsencrypt -d your_public_domain.tld

Append an include statement to the Nginx http config to include the ente-server config:

/etc/nginx/nginx.conf
http {
    include /etc/nginx/ente-server-nginx.conf
}

Fix permissions:

# chmod 644 /etc/nginx/ente-server-nginx.conf
# chmod 644 /etc/nginx/http*security_headers.conf

Restart nginx.service to apply the changes.

Configuring ente-server and ente-cli

この記事あるいはセクションで使われている用語や表現には問題が存在します。
議論: Last section to adjust. (議論: トーク:Ente サーバー#Cleanup)
  • Install ente-cli on the client:
  • Add ente-cli config on the client:
$ mkdir -p ~/.ente/export 
~/.ente/config.yaml
endpoint:
  api: "https://your_public_domain.tld" >
  • Add a user account via the photos mobile app or web app on the client, using a custom endpoint:
    • In the photos mobile app:
      • Click 7 times on the main screen to enable developers mode
      • Define your custom Ente server API endpoint:
        URL: https://your_public_domain.tld
    • In the web app on the client:
      $ git clone https://github.com/ente-io/ente.git
      cd ente/web
      git submodule update --init --recursive
      yarn install
      NEXT_PUBLIC_ENTE_ENDPOINTテンプレート:=https://your_public_domain.tld yarn dev:photos
  • Follow the photos app or web app (http://localhost:3000) instructions to create a new user
  • Obtain the OTP code:
    • Via email:
      • Configure the smtp section in /etc/ente-server/local.yaml
      • Make sure the configure SMTP server is working
      • Wait for the mail to arrive and copy the OTP code
    • Via the ente-server log:
      • # journalctl -u ente-server | grep SendEmailOTT | tail -n 1
  • Obtain the new users account ID:
 # psql -U ente ente-server -c 'select user_id from users order by user_id desc limit 1;'
  • Configure this user as the admin:
/etc/ente-server/local.yaml
internal:
     admin: [ADD_USER_ID_HERE]
  • Restart ente-server.service to activate the new admin privileges
  • Configure this admin within ente-cli on the client:
 $ ente account add
     photos
     ~/.ente/export
     email_address_of_admin_account
     password_of_admin_account

Increasing user storage and account expiry limit

  • Use ente-cli to increase storage limit with 100 TB and expiry with 100 years:
 ente admin update-subscription -u "user@domain.tld"

(Optional) Copy and apply AppArmor profile

An AppArmor profile has been provided for those that wish to limit the access the ente-server binary has using AppArmor. Copy and apply this profile as follows (assuming that AppArmor has already been installed and enabled):

 # install -Dvm600 -o root -g root /usr/lib/ente-server/usr.bin.ente-server -t /etc/apparmor.d/
 # aa-enforce /usr/bin/ente-server

(Optional) Configure Firewall

If a host firewall like iptables or nftables has been enabled and configured, make sure the following is allowed:

  • Traffic on localhost
  • Traffic from your Ente (mobile) client to TCP port 443 to reach Nginx
  • Traffic from your Ente (mobile) client to TCP port 3200 to reach the MinIO API port

Files

The ente-server-gitAUR package contains the ente-server(1) man page that lists and explains all files that are installed by this package.

See also