Running an instance
Some notes on running a production instance.
The normal Django admin can be found at
Executing the Django shell
Assuming included installation instructions were used, do the following:
sudo su - socialhome workon socialhome cd socialhome python manage.py shell_plus
Confirming user emails via the shell
You can manually confirm user emails via the shell by running the following:
from allauth.account.models import EmailAddress EmailAddress.objects.filter(email=<email>).update(verified=True)
This will allow the user to log in without clicking the confirmation email link.
To make a user an admin, log in to the shell and execute the following to set the user as superuser:
from socialhome.users.models import User User.objects.filter(username=<username>).update(is_staff=True, is_superuser=True)
Three places should be backed up from the Socialhome instance to ensure recovery in the event of a disaster.
- The database
- Local settings in
.env(assuming you are using this way to configure the application)
- The path
socialhome/media/which contains for example image uploads
- The Redis database (example instructions)
Give your instance some visibility
If you want some public visibility to your instance, consider registering it at some lists that track nodes in "The Federation". Here are a few:
Why not also contribute to the numbers of the federated social web? Turn on :ref:`configuration-statistics` to expose some activity counts.
There are two main logs where Socialhome sends information during runtime.
Circus process log
Rotated log files in
/var/log/upstart/socialhome-circus.log. The location will differ if not using an Upstart based system.
This log contains the output of all the processes required to run Socialhome, if using the recommended way of running Socialhome using Circus. Any errors for example when starting uWSGI or the worker processes will be found here.
See :ref:`config-log-target` configuration value. This log contains logging entries from the application itself. Useful for debugging federation issues or other problems with the actual code.
Deleting users and locking remote profiles
To delete users and their content, a Django management command has been provided. This command can also be used to delete local content of remote profiles and optionally lock the profile so any new content is rejected. This makes it possible to lock out spam accounts for example. For locally created content, an automatic retraction will be sent to remotes.
NOTE! Any deletion is permanent. There is no possibility to get the data back, except by restoring database and uploaded file backups. Be sure before using the command and be extra sure about the UUID's passed in!
To delete a local user, run the command as follows:
python manage.py delete_users_and_profiles --users <uuid>
To delete a remote profile, run the command as follows:
python manage.py delete_users_and_profiles --profiles <uuid>
To only delete remote profile content and then lock the profile, run as follows:
python manage.py delete_users_and_profiles --profiles <uuid> --lock-remote-profiles
uuid's can be passed in by separating them with commas. A confirmation dialog is produced for each user or profile to be deleted.
To publish the documents, open them, review the text and then change the status below the document to "published". Click Save - this version is now published. To edit in draft mode, switch the status back and the current edited revision will not show to users. You can also send email updates to users from the policy documents list. Select the policy documents you wish the send an email about, choose "Send email" from the actions list and confirm.
Published policy documents are shown to both authenticated and unauthenticated users via the navigation bar cogs menu.
Configuration mainly happens through environment variables. Those are passed to Django via the file
.env in the repository root. The following items of note can be changed.
After making changes to this file, don't forget to reload the app with
sudo service socialhome restart.
This must be set to a proper database URL, for example
Set this to
False if you want to disable signups.
Admin display name or organization name for Terms of Service, outgoing emails and server metadata.
Domain that is used for this instance. Must be set to the right domain. Note, it's not a good idea to use a sub-domain wildcard for www, ie
. as per Django docs. Federated sites work better with only one absolute domain.
Set this to the email address that emails should be sent out as.
Must be set to some real email backend if you wish to send emails. See docs for backend options and additional configuration help.
The possible email related additional settings are as follows:
Note, email is required for signing up. Users will not be able to sign up if the instance does not have working email sending.
Must be set to a long secret string. Don't expose it to anyone. See docs
Redirect all requests to HTTPS. See docs.
Setting a Sentry project DSN will make all error level exceptions be raised to Sentry. To change the level, see below.
Logging level used for Sentry reporting (see above). Possible options:
Allows to plug in additional third-party apps, string with comma-separated values, for example
Allows to use additional third-party app url-conf, string with two comma-separated values, url prefix and path to urlpatterns, for example
If you need to include urls from more than one app, this could be done by creating intermediary app which aggregates urls.
Must be set to your Socialhome instance domain. Used for example to generate outbound links.
Allows to use on main page custom view from third-party app, string with path to view, for example
Force HTTPS. There should be no reason to turn this off.
Define target for Django and application logs. Possible options:
file, logs will go to a file defined in
SOCIALHOME_LOGFILE. Note, due to multiple processes logging to the same file, this file log is only really useful for tailing or if running different processes on separate containers or machines.
syslog, logs to syslog, to the
Where to write the main application log.
URL to make signup link go to in the case that signups are closed.
Which relay instance ID to send outgoing content to. Socialhome automatically integrates with the relay system.
If this is set to a local username, that users profile will be shown when navigating to
/ as not logged in user. Logged in users will still see their own profile. Good for single user instances.
If set to
True, allows showing the server admins to users and in server metadata. The settings used are
Controls whether to expose some generic statistics about the node. This includes local user, content and reply counts. User counts include 30 day and 6 month active users.
Amount of items to keep in stream precaches, per user, per stream. Increasing this setting can radically increase Redis memory usage. If you have a lot of users, you might consider decreasing this setting. See :ref:`precaching`.
Note the amount actually stored can temporarily go over the limit. Cache trimming is done as a daily job, not every time a new item needs to be added to the cache.
Amount of days since user has logged in to be considered inactive for streams precaching. See notes about
Amount of items to keep in stream precaches, per user, per stream, for inactive and anonymous users. By default maintenance will always clear the cache for inactive and anonymous users daily. See notes about
Define the logging facility for syslog, if
SOCIALHOME_LOG_TARGET is set to
Define the logging level of syslog logging, if
SOCIALHOME_LOG_TARGET is set to
syslog. Possible options:
Define what jurisdiction (country) should be printed on the terms of service document. If not given, jurisdiction will not be included in the terms of service documents.