All Projects → jaywink → social-relay

jaywink / social-relay

Licence: AGPL-3.0 license
Public post relay for the Diaspora federated social network protocol

Programming Languages

python
139335 projects - #7 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to social-relay

diaspora federation
A library that provides functionalities needed for the diaspora* federation protocol.
Stars: ✭ 97 (+259.26%)
Mutual labels:  diaspora, federation
graphql-hackathon
Repo for starter kits and samples for the GraphQL Community Hackathon
Stars: ✭ 25 (-7.41%)
Mutual labels:  relay
graphql-ts-client
Typescript DSL for GraphQL.
Stars: ✭ 124 (+359.26%)
Mutual labels:  relay
automatic-vendor-federation
Utility to enable automatic vendor sharing within bundles using Module Federation
Stars: ✭ 69 (+155.56%)
Mutual labels:  federation
ReSift
A state management library for data fetches in React
Stars: ✭ 39 (+44.44%)
Mutual labels:  relay
chpc
CHPC: Cheap Heat Pump Controller
Stars: ✭ 27 (+0%)
Mutual labels:  relay
graphql-client-example-server
A simple GraphQL server for powering examples of various GraphQL clients in various languages.
Stars: ✭ 34 (+25.93%)
Mutual labels:  relay
misskey
🌎 An interplanetary microblogging platform 🚀
Stars: ✭ 2,895 (+10622.22%)
Mutual labels:  federation
heltin
Robust client registry for individuals receiving mental healthcare services.
Stars: ✭ 18 (-33.33%)
Mutual labels:  relay
server
Serve one or more react apps! - Custom routes, HotReloading, Authenticated Apps/routes, Relay, Webpack..
Stars: ✭ 20 (-25.93%)
Mutual labels:  relay
VineRelayStore
🔥 VineRelay is Content Management Boilerplate which enables you to quickly scaffold a shop with the basic features using React, Relay and GraphQL.
Stars: ✭ 16 (-40.74%)
Mutual labels:  relay
theonionbox
Dashboard to monitor Tor node operations
Stars: ✭ 116 (+329.63%)
Mutual labels:  relay
relay-store-types-generator
Generate types for the Relay store from your GraphQL schema.
Stars: ✭ 17 (-37.04%)
Mutual labels:  relay
LinkedIn Scraper
🙋 A Selenium based automated program that scrapes profiles data,stores in CSV,follows them and saves their profile in PDF.
Stars: ✭ 25 (-7.41%)
Mutual labels:  social-networks
opcua-esp32
Embedded OPC UA Server on ESP32 based on open62541 stack
Stars: ✭ 82 (+203.7%)
Mutual labels:  relay
apollo-studio-community
🎡  GraphQL developer portal featuring an IDE (Apollo Explorer), auto-documentation, metrics reporting, and more. This repo is for issues, feature requests, and preview docs. 📬
Stars: ✭ 212 (+685.19%)
Mutual labels:  federation
awesome-search-engine-optimization
A curated list of backlink, social signal opportunities, and link building strategies and tactics to help improve search engine results and ranking.
Stars: ✭ 82 (+203.7%)
Mutual labels:  social-networks
conduit
Conduit - Open Source 0x Relayer API implemented in NodeJS
Stars: ✭ 18 (-33.33%)
Mutual labels:  relay
beep-beep
Fictional p2p protocol
Stars: ✭ 34 (+25.93%)
Mutual labels:  federation
react-relay-appsync
AppSync for Relay
Stars: ✭ 19 (-29.63%)
Mutual labels:  relay

Build Status codecov Requirements Status

issue tracker

Social-Relay

Application 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.

How does one integrate to the relay system? How do I write my own relay?

See relay design concept.

Original idea for the relay system can be found in the diaspora* project wiki.

Installation

System libraries

Depending on your database, you will probably need extra libraries installed.

For databases, PostgreSQL and MySQL/MariaDB are supported, choose one.

Python

Python 3.4+ is required.

Redis

# Debian / Ubuntu
sudo apt-get install redis-server

PostgreSQL

# Debian / Ubuntu
sudo apt-get install libpq-dev postgresql

MySQL/MariaDB

# Debian / Ubuntu
sudo apt-get install python3-dev libmysqlclient-dev 

# Red Hat / CentOS
sudo yum install python3-devel mysql-devel

Federation

The federation dependency lxml requires certain libraries present:

# Debian / Ubuntu
sudo apt-get install libxml2-dev libxslt-dev lib32z1-dev python3-dev

Python libraries

Create a Python 3.4+ virtualenv and activate it.

Ensure pip and setuptools are up to date.

pip install -U pip setuptools

For a production deployment, choose your database and install the requirements:

# PostgreSQL
pip install -r requirements/postgresql.txt

# MySQL/MariaDB
pip install -r requirements/mysql.txt

Configuring

Create local config:

cp social_relay/local_config.py.example social_relay/local_config.py

Edit the local_config.py file as instructed in the file.

Database

You can set database connection settings as environment variables or in social_relay/local_config.py - see social_relay/config.py for what to override.

The database needs an initial schema creation. Do this with:

arnold up 0

The same command should always be run when fetching new relay code. It will migrate any new schema changes.

RQ Dashboard

An RQ dashboard can be found at /rq. Enable it in social_relay/local_config.py by setting RQ_DASHBOARD = True. You must also set a username and password in the same file.

Static files

Bower is used to pull in some JavaScript libs. Install it first if needed. Then run bower install.

Statics are server under the /static path which should be server by the web server.

Running tasks and workers

Scheduled 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.

In 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.

Then, export how many RQ workers you want. If you see your receive queue build up, increase this count and restart circus.

export RQWORKER_NUM=5

To start circus, virtualenv activated in the project folder:

circusd extras/circus/circus.ini

You can daemonize circus by passing an extra --daemonize flag.

Running tasks manually (without circus)

If you don't want to use circus, run the tasks manually. Keep this running:

python -m tasks.schedule_jobs

Processing receive queue (without circus)

If you don't want to use circus, run the workers manually. Run the worker(s) as follows:

rqworker -c social_relay.config receive

Deployment

Pretty 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.

An Apache2 site example can be found here. The same folder also has examples for upstart init jobs.

Ansible (Ubuntu)

An 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.

Tested with Ubuntu 14.04 LTS.

SystemD service files

There are example systemd service files in the 'extra' directory. The examples use a specific user and utilize gunicorn. They have been tested on CentOS 7.

To use, modify as needed (user, group, and path), copy to /etc/systemd/service and start/enable as such:

systemctl start social-relay_server.service
systemctl start social-relay_tasks.service
systemctl start [email protected]
systemctl start social-relay.target

systemctl enable social-relay_server.service
systemctl enable social-relay_tasks.service
systemctl enable [email protected]
systemctl enable social-relay.target

The rqworker service file can also be used to start the optional failed queue as well.

systemctl start [email protected]

Development

Development requirements

pip install -r requirements/development.txt

Ensure also bower is installed.

npm install bower
bower install

Running a development server

This is not the recommended way for a production server. For testing and development, run the server:

python devserver.py

The app will be running at http://127.0.0.1:5000.

Running an RQ worker

rqworker -c social_relay.config receive

Running tests

Ensure there is a test database. By default the tests try to connect to PostgreSQL with db, username and password socialrelaytest.

Then run test with:

py.test

Maintaining dependencies

When changing requirements, use pip-tools.

pip install pip-tools

To compile all

./compile-requirements.sh

Author

Jason Robinson / @jaywink / https://jasonrobinson.me

Awesome contributors listed in CONTRIBUTORS file.

License

AGPLv3

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].