Dreamhack Getting Started

From Dreamwidth Notes
Revision as of 07:57, 4 August 2009 by Rahaeli (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Cagtegory:Dreamhack

The Dreamhack service is a hosted development sandbox environment where you can do Dreamwidth development without having to have your own server. Dreamhack accounts are available free of charge for anyone who's interested in working on the Dreamwidth code.

When you get your Dreamhack account first created, most of the setup will be done for you. There are still a bunch of things you should do at first to make sure that your development environment is properly set up for you to work on, though. This guide is a walkthrough of all the steps you should take (in order) when you first log into your Dreamhack account.

You should also read Beginning dev checklist for more background information.

Get a SSH client

To connect to your Dreamhack and work on things, you'll need a program that will do SSH, or "secure shell". It lets you connect to the Dreamhack server and work with the files, which you can't do through your browser. If you're running Windows, download PuTTY. If you're on a Mac or a Linux distribution, you won't need a separate program; the Terminal (Applications/Utilities/Terminal on the Mac) will let you connect.

Connect to your Dreamhack

Once you have an SSH client, you can connect to Dreamhack. In PuTTY, put "hack.dreamwidth.net" for the server, and use the username and password you were given in your welcome email. In Terminal, type:

ssh dh-username@hack.dreamwidth.net

Change your password

Change your password to something you can remember. Type:

passwd

and follow the prompts.

Set the system password

Your Dreamhack installation has a user named 'system', which has all the admin privs and owns all the system styles. The system account is the first account on the server. You need to set a password so you can log into it. Type:

$LJHOME/bin/upgrading/make_system.pl

Pick something you'll remember. (If you ever forget the system password, though, you can just run make_system.pl again and re-set it.)

Edit the config files

You'll need to edit a few config files to make for easier development. Do the following:

cd $LJHOME
nano -w etc/config.pl

(Or whatever editor you prefer.)

Values you may want to change and/or set:

$USE_ACCT_CODES = 1;
# This governs invite codes. 1 = new accounts need invites; 0 = anyone can create an account.

You should also edit your config-local.pl for some other local settings:

cd $LJHOME
nano -w etc/config-local.pl

Values you may want to change and/or set:

$SITENAME = "Some LiveJournal Site";
$SITENAMESHORT = "YourSite";
$SITENAMEABBREV = "YS";
# these are all used in various places throughout the site
 
$MAIL_TO_THESCHWARTZ = 1;
# change this to 0 and/or comment it out to make your hack send email 
# without having to have TheSchwartz running

Set up TheSchwartz

TheSchwartz is a worker manager system that runs things like the importer, the private messaging function, the crossposter, and all of the event notifications. If you plan on working with any of those, you'll need to set up TheSchwartz on your Dreamhack.

The page for TheSchwartz Setup assumes that you're running your own installation, not a Dreamhack. The instructions for Dreamhacks are a little diffent. Edit your etc/config-local.pl and find the section marked @THESCHWARTZ_DBS. Edit it to look like this:

@THESCHWARTZ_DBS = (
        {
            dsn => 'dbi:mysql:dreamhack_yourusername;host=localhost',
            user => 'dh_yourusername',
            pass => $DW::PRIVATE::THESCHWARTZ_DBS{pass},
            },
        );

(Obviously, replace "yourusername" with your Dreamhack username. For instance, if your username is dh_rahaeli, you should use "dh_rahaeli" as the username.)

Then, edit your etc/config-private and find the section marked %THESCHWARTZ_DBS. Edit it to look like this:

%THESCHWARTZ_DBS = (
        pass => 'password',
);

Your password should be your database password, NOT the password you use to connect to the Dreamhack machine.

Back up your configs

For safety and paranoia's sake, it's a good idea to back up all three of your config files in case a change accidentally overwrites them:

cp $LJHOME/etc/config-local.pl $LJHOME/etc/config-local.pl.bak
cp $LJHOME/etc/config-private.pl $LJHOME/etc/config-private.pl.bak
cp $LJHOME/etc/config.pl $LJHOME/etc/config.pl.bak

Protect your configs from updates

Code updates can wind up wiping out your config files, which will cause you to get errors connecting to your database. To prevent this from happening, set all of your config files to be locally tracked:

cd $LJHOME
mkdir cvs/local cvs/local/etc cvs/local/cvs
cp etc/config-local.pl cvs/local/etc
cp etc/config.pl cvs/local/etc
cp etc/config-private.pl cvs/local/etc

Create $LJHOME/cvs/local/cvs/multicvs-private.conf and put this in it:

local .

Then, copy it to the main cvs directory:

cp $LJHOME/cvs/local/cvs/multicvs-private.conf $LJHOME/cvs/

From now on, if you want to make changes to any of your configs, do them to the versions in cvs/local/etc/. (You'll need to do this if any new features come about that involve config changes; it's a good idea to compare your local versions with the versions in Mercurial from time to time.)

Start Apache

Once all of this is done, you're ready to start Apache. Type:

start-apache

Your Dreamhack will now appear at http://yourusername.hack.dreamwidth.net.

Update your code regularly

Before you do any development work, it's a good idea to update your code to the most recent version. See Dev Maintenance for instructions.

Get familiar with version control

Read Version control and get familiar with how things work. You don't need to use Mercurial queues to manage your patches -- it's perfectly possible to just use $LJHOME/bin/cvsreport.pl every time you want to make a patch.

Hack away!

You can now start hacking! For more information, check out the Category: Development category, especially the Beginning dev checklist, Dev getting started, and Programming guidelines pages. If you run into problems, the #dw_kindergarten IRC channel and the [info]dw_dev_training community are good places to go for help.

We're looking forward to seeing your first patch!