{"id":13769599,"url":"https://github.com/jaywink/social-relay","last_synced_at":"2025-05-11T02:32:57.367Z","repository":{"id":34631571,"uuid":"38581822","full_name":"jaywink/social-relay","owner":"jaywink","description":"Public post relay for the Diaspora federated social network protocol","archived":true,"fork":false,"pushed_at":"2020-03-30T20:15:59.000Z","size":207,"stargazers_count":29,"open_issues_count":15,"forks_count":9,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-11-17T05:33:18.665Z","etag":null,"topics":["diaspora","federation","relay","social-networks"],"latest_commit_sha":null,"homepage":"https://git.feneas.org/jaywink/social-relay","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jaywink.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"jaywink","patreon":"jaywink","custom":"https://liberapay.com/jaywink/"}},"created_at":"2015-07-05T19:53:57.000Z","updated_at":"2024-10-16T23:10:59.000Z","dependencies_parsed_at":"2022-07-28T18:19:50.109Z","dependency_job_id":null,"html_url":"https://github.com/jaywink/social-relay","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaywink%2Fsocial-relay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaywink%2Fsocial-relay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaywink%2Fsocial-relay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaywink%2Fsocial-relay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaywink","download_url":"https://codeload.github.com/jaywink/social-relay/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253507170,"owners_count":21919162,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["diaspora","federation","relay","social-networks"],"created_at":"2024-08-03T17:00:29.157Z","updated_at":"2025-05-11T02:32:57.067Z","avatar_url":"https://github.com/jaywink.png","language":"Python","funding_links":["https://github.com/sponsors/jaywink","https://patreon.com/jaywink","https://liberapay.com/jaywink/"],"categories":["Python","Applications"],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/jaywink/social-relay.svg?branch=master)](https://travis-ci.org/jaywink/social-relay) [![codecov](https://codecov.io/gh/jaywink/social-relay/branch/master/graph/badge.svg)](https://codecov.io/gh/jaywink/social-relay) [![Requirements Status](https://requires.io/github/jaywink/social-relay/requirements.svg?branch=master)](https://requires.io/github/jaywink/social-relay/requirements/?branch=master) \n\n[![issue tracker](https://img.shields.io/badge/issue%20tracker-gitlab-orange.svg)](https://git.feneas.org/jaywink/social-relay)\n\n# Social-Relay\n\nApplication to act as a relay for public posts using the Diaspora protocol. Keeps track of nodes and their subscription preferences, receives payloads and forwards the payloads to subscribers. The aim is to pass public posts around in an efficient way so any new node in the network can quickly subscribe to lots of public activity, without having to wait a long time to create social relationships.\n\n## How does one integrate to the relay system? How do I write my own relay?\n\nSee [relay design concept](https://git.feneas.org/jaywink/social-relay/blob/master/docs/relays.md).\n\nOriginal idea for the relay system can be found in the [diaspora* project wiki](https://wiki.diasporafoundation.org/Relay_servers_for_public_posts).\n\n## Installation\n       \n### System libraries\n\nDepending on your database, you will probably need extra libraries installed.\n\nFor databases, PostgreSQL and MySQL/MariaDB are supported, choose one.\n\n#### Python\n\nPython 3.4+ is required.\n\n#### Redis\n\n    # Debian / Ubuntu\n    sudo apt-get install redis-server\n\n#### PostgreSQL\n\n    # Debian / Ubuntu\n    sudo apt-get install libpq-dev postgresql\n    \n#### MySQL/MariaDB\n\n    # Debian / Ubuntu\n    sudo apt-get install python3-dev libmysqlclient-dev \n\n    # Red Hat / CentOS\n    sudo yum install python3-devel mysql-devel\n    \n#### Federation\n\nThe `federation` dependency `lxml` requires certain libraries present:\n \n    # Debian / Ubuntu\n    sudo apt-get install libxml2-dev libxslt-dev lib32z1-dev python3-dev\n\n### Python libraries\n\nCreate a Python 3.4+ virtualenv and activate it.\n\nEnsure `pip` and `setuptools` are up to date.\n\n    pip install -U pip setuptools\n\nFor a production deployment, choose your database and install the requirements:\n\n    # PostgreSQL\n    pip install -r requirements/postgresql.txt\n    \n    # MySQL/MariaDB\n    pip install -r requirements/mysql.txt\n\n### Configuring\n\nCreate local config:\n\n    cp social_relay/local_config.py.example social_relay/local_config.py\n\nEdit the `local_config.py` file as instructed in the file.\n\n### Database\n\nYou can set database connection settings as environment variables or in `social_relay/local_config.py` - see `social_relay/config.py` for what to override.\n\nThe database needs an initial schema creation. Do this with:\n\n    arnold up 0\n\nThe same command should always be run when fetching new relay code. It will migrate any new schema changes.\n\n### RQ Dashboard\n\nAn RQ dashboard can be found at `/rq`. Enable it in `social_relay/local_config.py` by setting `RQ_DASHBOARD = True`.\nYou must also set a username and password in the same file.\n\n### Static files\n\nBower is used to pull in some JavaScript libs. [Install it first](http://bower.io/) if needed. Then run `bower install`.\n\nStatics are server under the `/static` path which should be server by the web server.\n\n### Running tasks and workers\n\nScheduled jobs handle the polling of node lists and nodes themselves, to fetch their subscription settings. Without the scheduled jobs the server will not be able to function. RQ workers on the other hand process all the incoming payloads and distribute them onwards to subscribing nodes. At least one RQ worker must be running at all times.\n\nIn production, it's easiest to use the provided `circus` configuration. This is installed via the provided production requirements, or `pip install circus` if not using the provided requirements file.\n\nThen, export how many RQ workers you want. If you see your `receive` queue build up, increase this count and restart `circus`.\n\n    export RQWORKER_NUM=5\n\nTo start `circus`, virtualenv activated in the project folder:\n\n    circusd extras/circus/circus.ini\n    \nYou can daemonize `circus` by passing an extra `--daemonize` flag.\n\n#### Running tasks manually (without circus)\n\nIf you don't want to use `circus`, run the tasks manually.  Keep this running:\n\n    python -m tasks.schedule_jobs\n\n#### Processing receive queue (without circus)\n\nIf you don't want to use `circus`, run the workers manually. Run the worker(s) as follows:\n\n    rqworker -c social_relay.config receive\n\n## Deployment\n\nPretty much normal Python + WSGI setup, just install the requirements and serve app using WSGI and statics via the web server. See the following sections for platform specific helpers.\n\nAn Apache2 site example can be found [here](https://git.feneas.org/jaywink/social-relay/tree/master/ansible/roles/socialrelay/templates/apache.conf.j2). The same folder also has examples for upstart init jobs.\n\n### Ansible (Ubuntu)\n\nAn Ansible role written for Ubuntu is provided in `ansible` directory. The role uses PostgreSQL, uWSGI and Apache. It will run also the scheduled jobs and a worker. Everything is handled by upstart.\n\nTested with Ubuntu 14.04 LTS.\n\n### SystemD service files\n\nThere are example systemd service files in the 'extra' directory. The examples\nuse a specific user and utilize gunicorn. They have been tested on CentOS 7.\n\nTo use, modify as needed (user, group, and path), copy to `/etc/systemd/service`\nand start/enable as such:\n\n    systemctl start social-relay_server.service\n    systemctl start social-relay_tasks.service\n    systemctl start social-relay_rqworker@receive.service\n    systemctl start social-relay.target\n\n    systemctl enable social-relay_server.service\n    systemctl enable social-relay_tasks.service\n    systemctl enable social-relay_rqworker@receive.service\n    systemctl enable social-relay.target\n\nThe rqworker service file can also be used to start the optional `failed` queue as well.\n\n    systemctl start social-relay_rqworker@failed.service\n\n## Development\n\n### Development requirements\n\n    pip install -r requirements/development.txt\n    \nEnsure also `bower` is installed.\n\n    npm install bower\n    bower install\n\n### Running a development server\n\nThis is not the recommended way for a production server. For testing and development, run the server:\n\n    python devserver.py\n    \nThe app will be running at [http://127.0.0.1:5000](http://127.0.0.1:5000).\n\n### Running an RQ worker\n\n    rqworker -c social_relay.config receive\n\n### Running tests\n\nEnsure there is a test database. By default the tests try to connect to PostgreSQL with db, username and password `socialrelaytest`.\n\nThen run test with:\n\n    py.test\n\n### Maintaining dependencies\n\nWhen changing requirements, use pip-tools.\n\n    pip install pip-tools\n    \nTo compile all\n\n    ./compile-requirements.sh\n\n## Author\n\nJason Robinson / @jaywink / https://jasonrobinson.me\n\nAwesome contributors listed in `CONTRIBUTORS` file.\n\n## License\n\nAGPLv3\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaywink%2Fsocial-relay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaywink%2Fsocial-relay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaywink%2Fsocial-relay/lists"}