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_SILKY 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¶
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
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: