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 SOCIALHOME_SHOW_ADMINS 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 SOCIALHOME_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¶
Currently users cannot delete their own account (coming soon, sorry!). Thus 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 GUID’s passed in!
To delete a local user, run the command as follows:
python manage.py delete_users_and_profiles --users <guid>
To delete a remote profile, run the command as follows:
python manage.py delete_users_and_profiles --profiles <guid>
To only delete remote profile content and then lock the profile, run as follows:
python manage.py delete_users_and_profiles --profiles <guid> --lock-remote-profiles
guid’s can be passed in by separating them with commas. A confirmation dialog is produced for each user or profile to be deleted.
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 email for example for outgoing emails and providing a feedback channel for users.
Admin display name for example for outgoing emails.
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
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: