Etebase server

EteSync 服务器(这样您可以运行自己的服务器)。「The EteSync server (so you can run your own)」

Github stars Tracking Chart

EteSync -- 安全数据同步

一个用于运行您自己的 Etebase(etesync2.0)服务器的框架应用程序。

安装

使用预制包

从源代码安装

在安装 EteSync 服务器之前,请确保已安装 virtualenv (针对 Python 3)。

  • Arch Linux:pacman -S python-virtualenv。
  • Debian/Ubuntu:apt-get install python3-virtualenv。
  • Mac/Windows/其他Linux:安装 virtualenv 或者直接跳过提及 virtualenv 的说明。

然后克隆 git repo 并设置这个应用即可。

git clone https://github.com/etesync/server-skeleton.git
cd server-skeleton
# 设置环境和依赖
virtualenv -p python3 venv  # If doesn't work, try: virtualenv3 venv
source venv/bin/activate
pip install -r requirements.txt

配置

如果你熟悉 Django,你可以根据 Django 部署检查表来编辑设置文件,如果你不熟悉,我们也提供了一个简单的配置文件,你可以使用它来进行简单的部署。

要使用这个简单的配置文件,请将其重命名为 etesync-server.ini,并将其放置在这个仓库的根目录或者是 /etc/etesync-server 中。

一些需要编辑的特殊设置是:

  • ALLOWED_HOSTS -- 这是为应用程序提供服务的主机/域名或地址的列表。
  • DEBUG -- 方便调试,生产时设置为False
  • SECRET_KEY -- 用于各种加密签名和令牌生成目的。请看下面的项目中 SECRET_KEY 的默认配置是如何工作的。

现在你可以初始化我们的 django 应用了。

<code>./manage.py migrate
</code>

然后你就完成了! 现在你可以运行调试服务器,看看一切是否如你所愿。

./manage.py runerver 0.0.0.0:8000

不建议在生产中使用调试服务器,所以请阅读下面的章节进行正确的部署。

生产型部署

EteSync 是基于 Django 的,所以你应该参考下面的其中之一
Django 项目的说明在这里
uwsgi 的说明在这里
这里是这个 repo 中的配置示例

wiki 中有更多关于使用 uWSGI 和 Nginx 的生产设置的细节。

webserver 也应该被配置成使用 TLS 来服务 EteSync。在 wiki 中也可以找到这样做的指南。

使用方法

给自己创建一个管理员用户。

./manage.py createsuperuser

在这个阶段,你可以直接使用管理员用户,或者更好的是,去:www.your-etesync-install.com/admin,创建一个非特权用户,你可以使用。
这就是了!现在剩下的就是打开 EteSync 应用。
现在剩下的就是打开 EteSync 应用,添加一个账号,并在 "高级" 部分下设置你的自定义服务器地址。

Secret_KEY 和 secret.txt

默认配置会在项目的基础目录下创建一个 "secret.txt" 文件,作为 Django SECRET_KEY 设置的值。你可以通过删除 secret.txt 文件来撤销这个密钥,下次应用运行时,会生成一个新的密钥。确保你对 secret.txt 文件保密(不要不小心将其提交到版本控制中,也不要将其从备份中排除,等等)。如果你想换一个更安全的系统来存储秘密,请编辑 etesync_server/settings.py 并实现你自己的方法来设置 secret_KEY(删除使用 get_secret_from_file 函数的行)。阅读 Django 文档以获得更多关于 SECRET_KEY 及其用途的信息。

更新

首先,运行 git pull --rebase 更新这个版本库。然后,在 virtualenv 里面:

运行 pip install -U -r requirements.txt 更新依赖关系。
运行 python manage.py migrate 来执行数据库迁移。
现在您可以重新启动服务器了。

支持 EteSync

即使您是自我托管,也请考虑注册一个帐户,以支持 EteSync 的发展,或访问贡献以获得有关如何支持服务的更多信息。

Overview

Name With Owneretesync/server
Primary LanguagePython
Program languagePython (Language Count: 4)
PlatformLinux, Mac, Windows
License:GNU Affero General Public License v3.0
Release Count20
Last Release Name0.11.0 (Posted on 2022-12-09 09:03:17)
First Release Namev0.1.0 (Posted on 2019-04-25 14:54:38)
Created At2017-11-19 17:42:38
Pushed At2023-10-20 13:22:46
Last Commit At2023-10-20 11:49:12
Stargazers Count1.5k
Watchers Count30
Fork Count71
Commits Count550
Has Issues Enabled
Issues Count121
Issue Open Count47
Pull Requests Count45
Pull Requests Open Count2
Pull Requests Close Count8
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

A skeleton app for running your own Etebase (EteSync 2.0) server.

Installation

From source

Before installing the Etebase server make sure you install virtualenv (for Python 3):

  • Arch Linux: pacman -S python-virtualenv
  • Debian/Ubuntu: apt-get install python3-virtualenv
  • Mac/Windows/Other Linux: install virtualenv or just skip the instructions mentioning virtualenv.

Then just clone the git repo and set up this app:

git clone https://github.com/etesync/server.git etebase

cd etebase
git checkout etebase

# Set up the environment and deps
virtualenv -p python3 venv  # If doesn't work, try: virtualenv3 venv
source venv/bin/activate

pip install -r requirements.txt

Configuration

If you are familiar with Django you can just edit the settings file
according to the Django deployment checklist.
If you are not, we also provide a simple configuration file for easy deployment which you can use.
To use the easy configuration file rename it to etebase-server.ini and place it either at the root of this repository or in /etc/etebase-server.

There is also a wikipage detailing this basic setup.

Some particular settings that should be edited are:

  • ALLOWED_HOSTS
    -- this is the list of host/domain names or addresses on which the app
    will be served
  • DEBUG
    -- handy for debugging, set to False for production
  • SECRET_KEY
    -- an ephemeral secret used for various cryptographic signing and token
    generation purposes. See below for how default configuration of
    SECRET_KEY works for this project.

Now you can initialise our django app.

./manage.py migrate

And you are done! You can now run the debug server just to see everything works as expected by running:

./manage.py runserver 0.0.0.0:8000

Using the debug server in production is not recommended, so please read the following section for a proper deployment.

Production deployment

There are more details about a proper production setup using Daphne and Nginx in the wiki.

Etebase is based on Django so you should refer to one of the following

  • The instructions of the Django project here.
  • Instructions from uwsgi here.

The webserver should also be configured to serve Etebase using TLS.
A guide for doing so can be found in the wiki as well.

Usage

Create yourself an admin user:

./manage.py createsuperuser

At this stage you need to create accounts to be used with the EteSync apps. To do that, please go to:
www.your-etesync-install.com/admin and create a new user to be used with the service. Do not set
a password for the user, as Etebase uses a zero-knowledge proof for authentication.

After this user has been created, you can use any of the EteSync apps to signup (or login) with the same username and
email in order to set up the account. The password used at that point will be used to setup the account.
Don't forget to set your custom server address under "Advanced".

SECRET_KEY and secret.txt

The default configuration creates a file “secret.txt” in the project’s
base directory, which is used as the value of the Django SECRET_KEY
setting. You can revoke this key by deleting the secret.txt file and the
next time the app is run, a new one will be generated. Make sure you keep
the secret.txt file secret (don’t accidentally commit it to version
control, exclude it from your backups, etc.). If you want to change to a
more secure system for storing secrets, edit etesync_server/settings.py
and implement your own method for setting SECRET_KEY (remove the line
where it uses the get_secret_from_file function). Read the Django docs
for more information about the SECRET_KEY and its uses.

Updating

Updating from version 0.5.0 onwards

First, run git pull --rebase to update this repository.
Then, inside the virtualenv:

  1. Run pip install -U -r requirements.txt to update the dependencies.
  2. Run python manage.py migrate to perform database migrations.

You can now restart the server.

Updating from version 0.5.0 or before

The 0.5.0 release marks the change to the EteSync 2.0 protocol. EteSync 2.0 accounts are substantially different to 1.0 accounts, and require additional upgrade steps. In addition, the servers are incompatible, so 0.5.0 requires a fresh installation.

Here are the update steps:

  1. Chose any of the the migration tools and make sure the underlying apps are up to date with all of your data. So for example, if you are using the Android client, make sure to sync before commencing.
  2. Install the 0.5.0 version to a new path (you can't reuse the same database).
  3. Run the 0.5.0 account and create the appropriate users as described in the installation/upgrade steps above.
  4. Run the migration tool to migrate all of your data.
  5. Add your new EteSync 2.0 accounst to all of your devices.

Supporting Etebase

Please consider registering an account even if you self-host in order to support the development of Etebase, or visit the contribution for more information on how to support the service.

To the top