mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-24 23:01:20 +00:00
Add sync command for neo4j, fix configuration, add neo4j to docker-compose, fix seed
This commit is contained in:
parent
20f581f796
commit
4d336cefac
|
@ -4,3 +4,4 @@ public/system
|
||||||
public/assets
|
public/assets
|
||||||
node_modules
|
node_modules
|
||||||
storybook
|
storybook
|
||||||
|
neo4j
|
||||||
|
|
|
@ -6,6 +6,8 @@ DB_USER=postgres
|
||||||
DB_NAME=postgres
|
DB_NAME=postgres
|
||||||
DB_PASS=
|
DB_PASS=
|
||||||
DB_PORT=5432
|
DB_PORT=5432
|
||||||
|
NEO4J_HOST=neo4j
|
||||||
|
NEO4J_PORT=7474
|
||||||
|
|
||||||
# Federation
|
# Federation
|
||||||
LOCAL_DOMAIN=example.com
|
LOCAL_DOMAIN=example.com
|
||||||
|
|
|
@ -26,6 +26,10 @@ class Follow < ApplicationRecord
|
||||||
after_create :add_to_graph
|
after_create :add_to_graph
|
||||||
after_destroy :remove_from_graph
|
after_destroy :remove_from_graph
|
||||||
|
|
||||||
|
def sync!
|
||||||
|
add_to_graph
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def add_to_graph
|
def add_to_graph
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
web_app = Doorkeeper::Application.new(name: 'Web', superapp: true, redirect_uri: Doorkeeper.configuration.native_redirect_uri)
|
web_app = Doorkeeper::Application.new(name: 'Web', superapp: true, redirect_uri: Doorkeeper.configuration.native_redirect_uri)
|
||||||
web_app.save(validate: false)
|
web_app.save!
|
||||||
|
|
|
@ -4,6 +4,10 @@ services:
|
||||||
image: postgres
|
image: postgres
|
||||||
redis:
|
redis:
|
||||||
image: redis
|
image: redis
|
||||||
|
neo4j:
|
||||||
|
image: neo4j
|
||||||
|
environment:
|
||||||
|
- NEO4J_AUTH=none
|
||||||
app:
|
app:
|
||||||
build: .
|
build: .
|
||||||
env_file: .env.production
|
env_file: .env.production
|
||||||
|
@ -15,6 +19,7 @@ services:
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
- redis
|
- redis
|
||||||
|
- neo4j
|
||||||
volumes:
|
volumes:
|
||||||
- ./public/assets:/mastodon/public/assets
|
- ./public/assets:/mastodon/public/assets
|
||||||
- ./public/system:/mastodon/public/system
|
- ./public/system:/mastodon/public/system
|
||||||
|
@ -24,5 +29,6 @@ services:
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
- redis
|
- redis
|
||||||
|
- neo4j
|
||||||
volumes:
|
volumes:
|
||||||
- ./public/system:/mastodon/public/system
|
- ./public/system:/mastodon/public/system
|
||||||
|
|
|
@ -41,4 +41,11 @@ namespace :mastodon do
|
||||||
$redis.keys('feed:*').each { |key| $redis.del(key) }
|
$redis.keys('feed:*').each { |key| $redis.del(key) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
namespace :graphs do
|
||||||
|
desc 'Syncs all follow relationships to Neo4J'
|
||||||
|
task sync: :environment do
|
||||||
|
Follow.find_each(&:sync!)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue