Difference between revisions of "Service/git"

From Sugar Labs
Jump to navigation Jump to search
Line 26: Line 26:
 
!scope="row" | Home
 
!scope="row" | Home
 
|{{Code|/srv/gitorious}}
 
|{{Code|/srv/gitorious}}
 +
|-
 +
!scope="row" | Daemon
 +
|{{Code|/etc/init.d/gitorious}}
 
|-
 
|-
 
!scope="row" | Logs
 
!scope="row" | Logs
 
|{{Code|/srv/gitorious/app/log}}
 
|{{Code|/srv/gitorious/app/log}}
 
|-
 
|-
!scope="row" | Main service
+
!scope="row" | Config
|{{Code|gitorious-all}}
+
|
 +
{{Code|/srv/gitorious/app/config/database.yml}}<br>
 +
{{Code|/srv/gitorious/app/config/gitorious.yml}}<br>
 +
{{Code|/etc/cron.daily/gitorious}}<br>
 +
{{Code|/etc/logrotate.d/gitorious}}<br>
 +
{{Code|/etc/httpd/conf.d/git.sugarlabs.org.conf}}
 +
|-
 +
!scope="row" | SSL certs
 +
|
 +
{{Code|/etc/ssl/private/git.sugarlabs.org.key}}<br>
 +
{{Code|/etc/ssl/certs/git.sugarlabs.org.pem}}
 +
|-
 +
!scope="row" | Sources
 +
| http://gitorious.org/~alsroot/sugarlabs-org
 
|-
 
|-
 
|}
 
|}
  
Looks like Gitorious Web UI leaks, it might grow from 200M to 1.2G during a week. Had to restart {{Code|gitorious-webui}} from daily cron.
+
=== Database tips ===
 
 
=== Database tweaks ===
 
  
 
To make runtime changes in Gitorious database, follow regular Rails workflow - run {{Code|scripts/console}}:
 
To make runtime changes in Gitorious database, follow regular Rails workflow - run {{Code|scripts/console}}:
Line 59: Line 73:
 
  # destroy object and all its dependencies
 
  # destroy object and all its dependencies
 
  user.destroy
 
  user.destroy
 
+
=== Tips ===
 
 
 
 
  # reset user password
 
  # reset user password
 
  user = User.find_by_email("user")
 
  user = User.find_by_email("user")
Line 92: Line 104:
 
  repo.name = "sat-solver"
 
  repo.name = "sat-solver"
 
  repo.save!
 
  repo.save!
 
=== Sources ===
 
 
* http://gitorious.org/~alsroot/sugarlabs-org
 
  
 
== Upgrade notes ==
 
== Upgrade notes ==
  
 
Upgrade will be triggered on every puppet session (if there is such need), vcs repository will be rebased to the HEAD commit with all related changes like database migration.
 
Upgrade will be triggered on every puppet session (if there is such need), vcs repository will be rebased to the HEAD commit with all related changes like database migration.

Revision as of 13:50, 26 April 2011

Hostnames

Hardware

Machine/housetree/jita

Administrative contact

git AT sugarlabs DOT org

Sysadmins

For non-emergency calls, preferably send email to the administrative contact.

  • Aleksey Lim
  • puppet related stuff is still in progress of settling down

Notes

Gitorious hosting.

Home /srv/gitorious
Daemon /etc/init.d/gitorious
Logs /srv/gitorious/app/log
Config

/srv/gitorious/app/config/database.yml
/srv/gitorious/app/config/gitorious.yml
/etc/cron.daily/gitorious
/etc/logrotate.d/gitorious
/etc/httpd/conf.d/git.sugarlabs.org.conf

SSL certs

/etc/ssl/private/git.sugarlabs.org.key
/etc/ssl/certs/git.sugarlabs.org.pem

Sources http://gitorious.org/~alsroot/sugarlabs-org

Database tips

To make runtime changes in Gitorious database, follow regular Rails workflow - run scripts/console:

cd /srv/gitorious/app
sudo -u gitorious RAILS_ENV=production script/console

It is regular Ruby console and all feature like TAB completion work. To tweak Gitorious data, just use its model classes, e.g.:

# search of particular object by its attributes
user = User.find_by_login("user")
project = Project.find_by_title("project")

# get object attributes
user.email

# change object attributes
project.owner = User.find_by_email("foo@bar")
project.save!

# destroy object and all its dependencies
user.destroy

# reset user password
user = User.find_by_email("user")
password_key = user.forgot_password!
Mailer.deliver_forgotten_password(user, password_key)

# add repository committer
committer = User.find_by_login("user")
repo = Repository::find_by_path("sugar/mainline")
repo.committerships.create_with_permissions!({:committer => committer}, (Committership::CAN_COMMIT))

# delete repository committer
committer = User.find_by_login("user")
repo = Repository::find_by_path("sugar/mainline")
repo.committerships = repo.committerships.select {|i| !i.members.include? committer }

# change repository owner
new_owner = User.find_by_login("user")
repo = Repository::find_by_path("sugar/mainline")
cs = repo.committerships.select {|i| i.committer == new_owner}.pop
cs.permissions = (Committership::CAN_ADMIN | Committership::CAN_COMMIT | Committership::CAN_REVIEW)
cs.save!
repo.owner = new_owner
repo.save!

# move repository to another project
new_project = Project.find_by_title('sl-tweaks')
repo = Repository::find_by_path("sat-solver/mainline")
repo.project = new_project
repo.name = "sat-solver"
repo.save!

Upgrade notes

Upgrade will be triggered on every puppet session (if there is such need), vcs repository will be rebased to the HEAD commit with all related changes like database migration.