Skip to content

Commit

Permalink
update doc and etc
Browse files Browse the repository at this point in the history
  • Loading branch information
mein Name committed Dec 27, 2024
1 parent a5d3843 commit e836d7d
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 162 deletions.
4 changes: 0 additions & 4 deletions boofilsic/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@
NEODB_EMAIL_URL=(str, ""),
# EMAIL FROM
NEODB_EMAIL_FROM=(str, "🧩 NeoDB <[email protected]>"),
# ADMIN_USERS
NEODB_ADMIN_USERNAMES=(list, []),
# List of available proxies for proxy downloader, in format of http://server1?url=__URL__,http://s2?url=__URL__,...
NEODB_DOWNLOADER_PROXY_LIST=(list, []),
# Timeout of downloader requests, in seconds
Expand Down Expand Up @@ -216,8 +214,6 @@
# "cdn_url": "https://fastly.jsdelivr.net",
}

SETUP_ADMIN_USERNAMES = env("NEODB_ADMIN_USERNAMES")

INVITE_ONLY = env("NEODB_INVITE_ONLY")

# By default, NeoDB will relay with relay.neodb.net so that public user ratings/etc can be shared across instances
Expand Down
14 changes: 0 additions & 14 deletions common/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,6 @@ def sync_site_config(self):
defaults={"json": icon},
)

def sync_admin_user(self):
users = User.objects.filter(username__in=settings.SETUP_ADMIN_USERNAMES)
for user in users:
if user.is_superuser:
logger.debug(f"User {user.username} is already admin")
else:
user.is_superuser = True
user.save(update_fields=["is_superuser"])
TakaheUser.objects.filter(email=f"@{user.username}").update(admin=True)
logger.info(f"Updated user {user.username} as admin")

def sync_relay(self):
relay = TakaheRelay.objects.filter(
state__in=["new", "subscribing", "subscribed"],
Expand Down Expand Up @@ -131,9 +120,6 @@ def run(self):
# Update site name if changed
self.sync_site_config()

# Create/update admin user if configured in env
self.sync_admin_user()

# Subscribe to default relay if enabled
self.sync_relay()

Expand Down
1 change: 0 additions & 1 deletion compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ x-shared:
NEODB_SITE_DESCRIPTION:
NEODB_ALTERNATIVE_DOMAINS:
NEODB_PREFERRED_LANGUAGES:
NEODB_ADMIN_USERNAMES:
NEODB_INVITE_ONLY:
NEODB_LOGIN_MASTODON_WHITELIST:
NEODB_MASTODON_CLIENT_SCOPE:
Expand Down
34 changes: 33 additions & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ if you are doing debug or development:
- `NEODB_INVITE_ONLY` - `False` by default, set to `True` to require invite code(generated by `neodb-manage invite --create`) to register
- `NEODB_ENABLE_LOCAL_ONLY` - `False` by default, set to `True` to allow user to post marks as "local public"
- `NEODB_LOGIN_MASTODON_WHITELIST` - a list of Mastodon instances to allow login from, comma separated
- `NEODB_ADMIN_USERNAMES` - a list of usernames to be admin, comma separated, server restart is required to apply this setting after these users are registered.
- `NEODB_EMAIL_FROM` - the email address to send email from
- `NEODB_EMAIL_URL` - email sender configuration, e.g.
- `smtp://<username>:<password>@<host>:<port>`
Expand Down Expand Up @@ -68,6 +67,39 @@ Add alias to your shell for easier access
alias neodb-manage='docker-compose --profile production run shell neodb-manage'
```

Toggle user's active, staff and super user status

```
neodb-manage user active <username>
neodb-manage user staff <username>
neodb-manage user super <username>
```

Create an invite link

```
neo-manage invite --create
```

Manage user tasks and cron jobs

```
neodb-manage task --list
neodb-manage cron --list
```

Manage search index
```
neo-manage index --reindex
```

Crawl links
```
neodb-manage cat [--save] <url> # parse / save a supported link
neodb-manage crawl <url> # crawl all recognizable links from a page
```


## Run without Docker

It's currently possible but quite cumbersome to run without Docker, hence not recommended. However it's possible to only use docker to run neodb server but reuse existing PostgresQL/Redis/Typesense servers with `compose.override.yml`, an example for reference:
Expand Down
18 changes: 2 additions & 16 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,24 +81,10 @@ You should see the same JSON response as above, and the site is now accessible t

## Register an account and make it admin

If you have email sender properly configured, use this command to create an admin with a verified email (use any password as it won't be saved)
Open `https://yourdomain.tld` in your browser and register an account, assuming username `admin`, run the following command to make it super user

```
docker compose --profile production run --rm shell neodb-manage createsuperuser
```

Now open `https://yourdomain.tld` in your browser and register an account, assuming username `admin`

add the following line to `.env` to make it an admin account:

```
NEODB_ADMIN_USERS=admin
```

now restart the cluster to make it effective:

```bash
docker compose --profile production up -d
docker compose --profile production run --rm shell neodb-manage user --super admin
```

Now your instance should be ready to serve. More tweaks are available, see [configuration](configuration.md) for options.
3 changes: 0 additions & 3 deletions neodb.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ NEODB_SITE_LINKS=@NiceDB=https://donotban.com/@testie,@NeoDB=https://mastodon.so
# Path to store db/media/cache/etc, must be writable
# NEODB_DATA=/var/lib/neodb

# Users with these names will be promoted to admin during next boot/migration
# NEODB_ADMIN_USERNAMES = eggplant,aubergine

# Scaling parameters
# NEODB_WEB_WORKER_NUM=32
# NEODB_API_WORKER_NUM=16
Expand Down
20 changes: 0 additions & 20 deletions users/management/commands/disable_user.py

This file was deleted.

77 changes: 0 additions & 77 deletions users/management/commands/generate_usernames.py

This file was deleted.

26 changes: 0 additions & 26 deletions users/management/commands/import_tasks.py

This file was deleted.

File renamed without changes.

0 comments on commit e836d7d

Please sign in to comment.