One advantage of running your own Diaspora pod is the fact, that you have access to the MongoDB which is used to store your Seed. This allows you to do some functions which do not yet have a UI (for example canging the E-Mail address of a user) or which is required to work around alpha hickups (deleting duplicate requests).
The mongo shell is a client to the mongodb, which can evaluate JavaScript expressions. It has some macros ("use", "show" and "help"), the other commands are typically JavaScript methods.
First you assign a Database Object to the variable "db", you can use that with "use". In the case of Diaspora, the database is named "diaspora-ENVIRONMENT". If you start mongo shell, it will start with the database "test", but you can list all existing databases, and pick one:
To change the e-mail address of a existing user you can assign the document to a variable, change the desired property and update the collection. For this we use the findOne method, which does return the first match instead of a cursor:
You need to know that db.users contains the actual users of the pod (i.e. the seeds) and db.people contains a copy of the public part of other seeds (if you received a request from them, or if you added them to an aspect).
Hope this helps you to find your way around in the object model of Diaspora. I recommend you read the MongoDB tutorial to better use the mongo shell, and check the JS API documentation for the details.
The mongo shell is a client to the mongodb, which can evaluate JavaScript expressions. It has some macros ("use", "show" and "help"), the other commands are typically JavaScript methods.
First you assign a Database Object to the variable "db", you can use that with "use". In the case of Diaspora, the database is named "diaspora-ENVIRONMENT". If you start mongo shell, it will start with the database "test", but you can list all existing databases, and pick one:
$ mongo
connecting to: test
> print('hello JavaScript!')
hello JavaScript!
> show dbs
admin
diaspora-development
local
magent
> use diaspora-development
switched to db diaspora-development
> db
diaspora-development
> show collections
aspects
comments
contacts
invitations
people
posts
requests
system.indexes
users
Note: you can specify non-existing databases and collections, they are initially empty but will be created, so do not misstype. You can use db.collection.help() to see the available methods on a collection object. find() is used to search and display documents. If you specify no parameters it will return a cursort with all documents. The first parameter can be a list of filter criterias, and the second parameters a list of properties to return. mongo shell will iterate and print the first ten entries of a cursor automatically:
> db.users.find({},{username:1,email:1})
{ "_id" : ObjectId("4cf1..02"), "username" : "bernd", "email" : "bernd-09@eckenfels.net" }
{ "_id" : ObjectId("4cf1..2d"), "username" : "mela", "email" : "mela@mela.de" }
{ "_id" : ObjectId("4cf2..3b"), "username" : null, "email" : "xx@example.com" }
Here you can see, that this pod has 3 users (seeds), two are already established, the third is a pending invite (token).To change the e-mail address of a existing user you can assign the document to a variable, change the desired property and update the collection. For this we use the findOne method, which does return the first match instead of a cursor:
> var bernd = db.users.findOne({username:"bernd"})
> print(bernd.email)
bernd-09@eckenfels.net
> bernd.email = "bernd-10@eckenfels.net"
> db.users.save(bernd)
> db.users.findOne({username:"bernd"}).email
bernd-10@eckenfels.net
The above will not create a new document, since the variable "bernd" contains the property _id, and therefore it will update the existing entry in the collection.You need to know that db.users contains the actual users of the pod (i.e. the seeds) and db.people contains a copy of the public part of other seeds (if you received a request from them, or if you added them to an aspect).
> db.requests.findOne()
{
"_id" : ObjectId("4cf1...a3"),
"sent" : true,
"from_id" : ObjectId("4cf1...03"),
"to_id" : ObjectId("4cee7...a9"),
"into_id" : ObjectId("4cf1...9d")
}
> db.people.findOne({_id:ObjectId("4cf1...03")}).diaspora_handle
bernd@pod.eckenfels.net
> db.people.findOne({_id:ObjectId("4cee7...a9")}).diaspora_handle
daniel...@joindiaspora.com
> db.aspects.findOne({_id: ObjectId("4cf1...9d")}).name
Piraten As you can see I sent a request to "Daniel", inviting him to my aspect "Piraten", but he has not yet responded.Hope this helps you to find your way around in the object model of Diaspora. I recommend you read the MongoDB tutorial to better use the mongo shell, and check the JS API documentation for the details.
Diaspora* die Software für verteilte soziale Netze wurde in einer Alpha Version veröffentlicht.
Bei Diaspora ist vorgesehen dass es keine zentrale Plattform gibt, sondern Benutzer Ihre eigenen Server - Pods genannt - betreiben. Da es aktuell auch auf dem offiziellen pod von joindiaspora.com keine Benutzer freigeschalten werden, ergibt es Sinn einen eigenen Server aufzusetzen.
Im Diaspora Wiki findet man dazu eine Anleitung. Allerdings beschreibt diese nicht, wie man in einer Produktivumgebung die Ruby Anwendung mit einem Webserver versieht, der die Anfragen auf Port 80 entgegennimmt (und statische Assets direkt ausliefert).
Ich habe dazu einen virtuellen Host mit Apache eingerichtet, die Konfiguration sieht so aus:
D.h. Diaspora ist im Verzeichnis /var/www/example.com/pod/data installiert, und der Ruby Server "thin" ist erreichbar auf dem Port 3000.
Falls es jemand testen will, mein Diaspora Seed ist damit unter bernd@pod.eckenfels.net erreichbar.
Bei Diaspora ist vorgesehen dass es keine zentrale Plattform gibt, sondern Benutzer Ihre eigenen Server - Pods genannt - betreiben. Da es aktuell auch auf dem offiziellen pod von joindiaspora.com keine Benutzer freigeschalten werden, ergibt es Sinn einen eigenen Server aufzusetzen.
Im Diaspora Wiki findet man dazu eine Anleitung. Allerdings beschreibt diese nicht, wie man in einer Produktivumgebung die Ruby Anwendung mit einem Webserver versieht, der die Anfragen auf Port 80 entgegennimmt (und statische Assets direkt ausliefert).
Ich habe dazu einen virtuellen Host mit Apache eingerichtet, die Konfiguration sieht so aus:
LoadModule proxy_module ...
LoadModule proxy_http_module...
<VirtualHost *>
ServerAdmin webmaster@example.com
DocumentRoot /var/www/example.com/pod/data/public
ServerName pod.example.com
ErrorLog /var/log/httpd/pod.example.com-error_log
CustomLog /var/log/httpd/pod.example.com-access_log combined
Alias /uploads/ "/var/www/example.com/pod/data/public/uploads/"
Alias /images/ "/var/www/example.com/pod/data/public/images/"
Alias /stylesheets/ "/var/www/example.com/pod/data/public/stylesheets/"
Alias /javascripts/ "/var/www/example.com/pod/data/public/javascripts/"
ProxyPass / http://pod.example.com:3000/
<Directory "/var/www/example.com/pod/data/public">
Options Indexes FollowSymLinks MultiViews IncludesNoExec ExecCGI
AllowOverride All
Order Allow,Deny
Allow from All
</Directory>
</VirtualHost>D.h. Diaspora ist im Verzeichnis /var/www/example.com/pod/data installiert, und der Ruby Server "thin" ist erreichbar auf dem Port 3000.
Falls es jemand testen will, mein Diaspora Seed ist damit unter bernd@pod.eckenfels.net erreichbar.
(Seite 1 von 1, insgesamt 2 Einträge)
Layout by Ricky Wilson | Serendipity Template by Carl Galloway | Login
Impressum
Bernd Eckenfels
Mörscher Str. 8
76185 Karlsruhe
bernd-2012@eckenfels.net
Read More

Kommentare