mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-10-01 01:36:12 -04:00
Add domain name change instructions to docs. (#1044)
* Add domain name change instructions to docs. * Changing docker execs to docker-compose execs
This commit is contained in:
parent
dc4ac6345c
commit
e31f74c3ad
43
docs/src/administration_backup_and_restore.md
vendored
43
docs/src/administration_backup_and_restore.md
vendored
@ -9,14 +9,14 @@ When using docker or ansible, there should be a `volumes` folder, which contains
|
||||
To incrementally backup the DB to an `.sql` file, you can run:
|
||||
|
||||
```bash
|
||||
docker exec -t FOLDERNAME_postgres_1 pg_dumpall -c -U lemmy > lemmy_dump_`date +%Y-%m-%d"_"%H_%M_%S`.sql
|
||||
docker-compose exec postgres pg_dumpall -c -U lemmy > lemmy_dump_`date +%Y-%m-%d"_"%H_%M_%S`.sql
|
||||
```
|
||||
### A Sample backup script
|
||||
|
||||
```bash
|
||||
#!/bin/sh
|
||||
# DB Backup
|
||||
ssh MY_USER@MY_IP "docker exec -t FOLDERNAME_postgres_1 pg_dumpall -c -U lemmy" > ~/BACKUP_LOCATION/INSTANCE_NAME_dump_`date +%Y-%m-%d"_"%H_%M_%S`.sql
|
||||
ssh MY_USER@MY_IP "docker-compose exec postgres pg_dumpall -c -U lemmy" > ~/BACKUP_LOCATION/INSTANCE_NAME_dump_`date +%Y-%m-%d"_"%H_%M_%S`.sql
|
||||
|
||||
# Volumes folder Backup
|
||||
rsync -avP -zz --rsync-path="sudo rsync" MY_USER@MY_IP:/LEMMY_LOCATION/volumes ~/BACKUP_LOCATION/FOLDERNAME
|
||||
@ -37,6 +37,45 @@ cat db_dump.sql | docker exec -i FOLDERNAME_postgres_1 psql -U lemmy # restore
|
||||
docker exec -i FOLDERNAME_postgres_1 psql -U lemmy -c "alter user lemmy with password 'bleh'"
|
||||
```
|
||||
|
||||
### Changing your domain name
|
||||
|
||||
If you haven't federated yet, you can change your domain name in the DB. **Warning: do not do this after you've federated, or it will break federation.**
|
||||
|
||||
Get into `psql` for your docker:
|
||||
|
||||
`docker-compose exec postgres psql -U lemmy`
|
||||
|
||||
```
|
||||
-- Post
|
||||
update post set ap_id = replace (ap_id, 'old_domain', 'new_domain');
|
||||
update post set url = replace (url, 'old_domain', 'new_domain');
|
||||
update post set body = replace (body, 'old_domain', 'new_domain');
|
||||
update post set thumbnail_url = replace (thumbnail_url, 'old_domain', 'new_domain');
|
||||
|
||||
delete from post_aggregates_fast;
|
||||
insert into post_aggregates_fast select * from post_aggregates_view;
|
||||
|
||||
-- Comments
|
||||
update comment set ap_id = replace (ap_id, 'old_domain', 'new_domain');
|
||||
update comment set content = replace (content, 'old_domain', 'new_domain');
|
||||
|
||||
delete from comment_aggregates_fast;
|
||||
insert into comment_aggregates_fast select * from comment_aggregates_view;
|
||||
|
||||
-- User
|
||||
update user_ set actor_id = replace (actor_id, 'old_domain', 'new_domain');
|
||||
update user_ set avatar = replace (avatar, 'old_domain', 'new_domain');
|
||||
|
||||
delete from user_fast;
|
||||
insert into user_fast select * from user_view;
|
||||
|
||||
-- Community
|
||||
update community set actor_id = replace (actor_id, 'old_domain', 'new_domain');
|
||||
|
||||
delete from community_aggregates_fast;
|
||||
insert into community_aggregates_fast select * from community_aggregates_view;
|
||||
```
|
||||
|
||||
## More resources
|
||||
|
||||
- https://stackoverflow.com/questions/24718706/backup-restore-a-dockerized-postgresql-database
|
||||
|
Loading…
Reference in New Issue
Block a user