mirror of
https://github.com/matrix-org/synapse-s3-storage-provider.git
synced 2024-10-23 07:29:40 +00:00
Merge pull request #19 from matrix-org/michaelkaye/docs_and_deprecations
Documentation and deprecation warnings
This commit is contained in:
commit
e56e98c6df
2 changed files with 16 additions and 10 deletions
24
README.md
24
README.md
|
@ -35,23 +35,29 @@ described [here](https://boto3.readthedocs.io/en/latest/guide/configuration.html
|
||||||
Regular cleanup job
|
Regular cleanup job
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
There is additionally a `s3_media_upload.py` which can be used in a regular job to
|
There is additionally a `s3_media_upload.py` which can be used in a regular job
|
||||||
upload content to s3, then delete that from local disk. This script can be used in
|
to upload content to s3, then delete that from local disk. This script can be
|
||||||
combination with configuration for the storage provider to pull media from s3, but
|
used in combination with configuration for the storage provider to pull media
|
||||||
upload it asynchronously.
|
from s3, but upload it asynchronously.
|
||||||
|
|
||||||
Once the package is installed, the script should be run somewhat like the
|
Once the package is installed, the script should be run somewhat like the
|
||||||
following. We suggest using tmux or screen as these can take a long time on larger
|
following. We suggest using tmux or screen as these can take a long time on
|
||||||
servers.
|
larger servers.
|
||||||
|
|
||||||
|
`database.yml` should contain the keys that would be passed to psycopg2 to
|
||||||
|
connect to your database. They can be found in the contents of the
|
||||||
|
`database`.`args` parameter in your homeserver.yaml.
|
||||||
|
|
||||||
More options are available in the command help.
|
More options are available in the command help.
|
||||||
|
|
||||||
```
|
```
|
||||||
> cd s3_media_upload
|
> cd s3_media_upload
|
||||||
# cache.db will be created if absent. database.yaml is required to contain PG credentials
|
# cache.db will be created if absent. database.yaml is required to
|
||||||
|
# contain PG credentials
|
||||||
> ls
|
> ls
|
||||||
cache.db database.yaml
|
cache.db database.yaml
|
||||||
# Update cache from /path/to/media/store looking for files not used within 2 months
|
# Update cache from /path/to/media/store looking for files not used
|
||||||
|
# within 2 months
|
||||||
> s3_media_upload update /path/to/media/store 2m
|
> s3_media_upload update /path/to/media/store 2m
|
||||||
Syncing files that haven't been accessed since: 2018-10-18 11:06:21.520602
|
Syncing files that haven't been accessed since: 2018-10-18 11:06:21.520602
|
||||||
Synced 0 new rows
|
Synced 0 new rows
|
||||||
|
|
|
@ -311,7 +311,7 @@ def get_postgres_conn(parser):
|
||||||
"""Attempt to get a postgres connection based on database.yaml, or exit.
|
"""Attempt to get a postgres connection based on database.yaml, or exit.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
database_yaml = yaml.load(open("database.yaml"))
|
database_yaml = yaml.safe_load(open("database.yaml"))
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
parser.error("Could not find database.yaml")
|
parser.error("Could not find database.yaml")
|
||||||
except yaml.YAMLError as e:
|
except yaml.YAMLError as e:
|
||||||
|
|
Loading…
Reference in a new issue