Difference between revisions of "Moving your Dreamwidth installation to use Github"

From Dreamwidth Notes
Jump to: navigation, search
(for dev servers (not clone sites) set up dw-nonfree)
 
(24 intermediate revisions by 6 users not shown)
Line 1: Line 1:
These instructions are for dreamhacks; those running your own instances I trust that you can modify to fit. This also assumes that you've gone through the "Set up git" instructions on https://help.github.com/articles/set-up-git
+
{{Note|text=These instructions are for dreamhacks; those running your own instances I trust that you can modify to fit.}}
 
+
= stop all workers and the server =
+
 
+
killall worker-manager
+
stop-apache
+
 
+
= move your old $LJHOME aside (don't delete it though)  =
+
 
+
mv $LJHOME $LJHOME-xx
+
  
 
= On github, fork dreamwidth's dw-free and dw-nonfree repositories =
 
= On github, fork dreamwidth's dw-free and dw-nonfree repositories =
  
These are the two Dreamwidth repositories:
+
First, create an account on Github.  Then, you will need to fork these two repositories:
  
 
* https://github.com/dreamwidth/dw-free
 
* https://github.com/dreamwidth/dw-free
 
* https://github.com/dreamwidth/dw-nonfree
 
* https://github.com/dreamwidth/dw-nonfree
  
Here's a quick overview of how the repositories work together:
+
Go to each of their pages, and click the "Fork" button. This sets up your own copy of Dreamwidth's code which use to make and submit your changes. (NoScript has been known to cause 404 errors at this point; if you're having trouble, try temporarily turning it off.)
 +
 
 +
Here's a quick overview of how the repositories will work together:
  
 
* dw-free is the main repository and goes into $LJHOME
 
* dw-free is the main repository and goes into $LJHOME
 
* other repositories will go into $LJHOME/ext
 
* other repositories will go into $LJHOME/ext
 
* personal config files go into $LJHOME/ext/local
 
* personal config files go into $LJHOME/ext/local
* Contents of $LJHOME will be live when you start the server
+
* All code from dw-free ($LJHOME) and the additional repos under $LJHOME/ext are automatically live when you start your server. There's no need to run any additional syncing steps anymore.
* Contents of $LJHOME/ext will be used automatically (no syncing)
+
  
 
Now it's time to set things up:
 
Now it's time to set things up:
  
= set up dw-free =
+
= Stop the server and all workers =
 +
 
 +
# note: it's okay if it says "no process found".
 +
# That just means there was nothing to stop
 +
stop-apache
 +
killall worker-manager   
 +
 
 +
= Move your old $LJHOME aside  =
 +
 
 +
Don't delete it!  Just move it out of the way like this:
 +
 
 +
# Make sure you are in your home directory
 +
cd ~/
 +
mv $LJHOME $LJHOME-old
 +
 
 +
This will let you access any changes you still have on the old repositories.
 +
 
 +
= Set up dw-free =
 +
 
 +
Replace the USERNAME sections of the URL with your Github username.  This will make your repository an authenticated version that can push changes back to Github, as opposed to only being able to pull them.
  
 
  # clone a copy of the repository onto your machine
 
  # clone a copy of the repository onto your machine
  git clone https://github.com/USERNAME/dw-free.git $LJHOME
+
cd ~/
 +
  git clone https://USERNAME@github.com/USERNAME/dw-free.git $LJHOME
 +
cd $LJHOME
 
   
 
   
 
  # and let's make it aware of the dreamwidth repository so we can grab updates later
 
  # and let's make it aware of the dreamwidth repository so we can grab updates later
 
  git remote add dreamwidth https://github.com/dreamwidth/dw-free
 
  git remote add dreamwidth https://github.com/dreamwidth/dw-free
 
  git fetch dreamwidth
 
  git fetch dreamwidth
 +
# we also want to sync up with the main branches
 
  git branch --set-upstream develop dreamwidth/develop  
 
  git branch --set-upstream develop dreamwidth/develop  
git branch --set-upstream master dreamwidth/master
 
 
   
 
   
 
  # now set up the folder for external repositories / modules
 
  # now set up the folder for external repositories / modules
mkdir $LJHOME/ext
 
 
  cd $LJHOME/ext
 
  cd $LJHOME/ext
 +
 +
## copy over your config files, and tell them to take priority
 +
## over config files in any of the repos
 +
mkdir -p local/etc
 +
echo "highest"  > local/.dir_scope
 +
cp $LJHOME-old/etc/config* local/etc/
  
= for dev servers (not clone sites) set up dw-nonfree =
+
= Set up dw-nonfree (optional) =
  
  git clone https://github.com/USERNAME/dw-nonfree.git
+
dw-nonfree contains Dreamwidth-specific branding and code. Do this step only if you're working on changes for dreamwidth.org.
 +
 
 +
cd $LJHOME/ext
 +
  git clone https://USERNAME@github.com/USERNAME/dw-nonfree.git
 
  cd dw-nonfree
 
  cd dw-nonfree
 
  git remote add dreamwidth https://github.com/dreamwidth/dw-nonfree
 
  git remote add dreamwidth https://github.com/dreamwidth/dw-nonfree
 
  git fetch dreamwidth
 
  git fetch dreamwidth
 
  git branch --set-upstream develop dreamwidth/develop  
 
  git branch --set-upstream develop dreamwidth/develop  
git branch --set-upstream master dreamwidth/master
 
 
  cd ..
 
  cd ..
  
## copy over your config files, and tell them to take priority
+
= Run checkconfig =
## over config files in any of the repos
+
mkdir --parents local/etc
+
echo "highest"  > local/.dir_scope
+
cp $LJHOME-xx/etc/config* local/etc/
+
 
+
= run checkconfig =
+
  
 
  cd $LJHOME
 
  cd $LJHOME
 
  bin/checkconfig.pl
 
  bin/checkconfig.pl
  
= non-dreamhack users: =
+
= Additional setup for non-dreamhack users =
  
* install .deb packages if given
+
* install .deb packages if given by bin/checkconfig.pl
* install any modules without .deb packages via cpan (theSchwartz)
+
* install any modules without .deb packages via cpan (like theSchwartz)
 
* check any personal scripts you have to make sure they aren't affected by the directory config change
 
* check any personal scripts you have to make sure they aren't affected by the directory config change
* note: you won't need to run "dw sync" / "bin/cvsreport.pl --sync --cvs/--live" or anything of the sort anymore
 
  
= start server again =
+
= Update the database =
 +
 
 +
Now you will want to [[Dev_Maintenance#Update_your_database|update your database]] based on instructions in [[Dev Maintenance]].
 +
 
 +
= Start the server again =
  
 
  start-apache
 
  start-apache
 +
 +
= Moving patches or changes from hg to git =
 +
 +
In this section, $OLDLJHOME is going to refer to wherever you moved the old dw directory. Example to use from above sections:
 +
 +
OLDLJHOME=~/dw-old
 +
 +
If you were working on one issue at a time, then for dw-free you can import your changes (to a topic branch would be best):
 +
 +
cd $OLDLJHOME/cvs/dw-free
 +
hg diff > ~/dw-free-changes.patch
 +
cd $LJHOME
 +
patch -p1 < ~/dw-free-changes.patch
 +
 +
And the same with dw-nonfree:
 +
 +
cd $OLDLJHOME/cvs/dw-nonfree
 +
hg diff > ~/dw-nonfree-changes.patch
 +
cd $LJHOME/ext/dw-nonfree
 +
patch -p1 < ~/dw-nonfree-changes.patch
 +
 +
If you used Mercurial Queues (if you don't know what that is, you probably didn't), you can find all your patches in:
 +
 +
$OLDLJHOME/cvs/dw-free/.hg/patches # for dw-free patches
 +
$OLDLJHOME/cvs/dw-nonfree/.hg/patches # for dw-nonfree patches
 +
 +
When you are ready to incorporate a given patch or set of related patches, make a branch in the repository you are working in (as described in [[Draft: Github development process]]).
 +
 +
For dw-free:
 +
 +
cd $LJHOME
 +
patch -p1 < $OLDLJHOME/cvs/dw-free/.hg/patches/PATCHNAME
 +
 +
For dw-nonfree:
 +
 +
cd $LJHOME/ext/dw-nonfree
 +
patch -p1 < $OLDLJHOME/cvs/dw-nonfree/.hg/patches/PATCHNAME
 +
 +
= Extras =
 +
 +
You may be interested in [[git settings]] and [[git autocomplete]] to make your life easier.
 +
 +
If you also want to view your repositories on your computer, GitHub has versions for Windows and OSX:
 +
 +
* http://mac.github.com/
 +
* http://windows.github.com/
  
 
[[Category: Development]]
 
[[Category: Development]]
 +
[[Category: Dreamhack]]
 +
[[Category: Git]]

Latest revision as of 10:43, 14 October 2014

Note: These instructions are for dreamhacks; those running your own instances I trust that you can modify to fit.

On github, fork dreamwidth's dw-free and dw-nonfree repositories

First, create an account on Github. Then, you will need to fork these two repositories:

Go to each of their pages, and click the "Fork" button. This sets up your own copy of Dreamwidth's code which use to make and submit your changes. (NoScript has been known to cause 404 errors at this point; if you're having trouble, try temporarily turning it off.)

Here's a quick overview of how the repositories will work together:

  • dw-free is the main repository and goes into $LJHOME
  • other repositories will go into $LJHOME/ext
  • personal config files go into $LJHOME/ext/local
  • All code from dw-free ($LJHOME) and the additional repos under $LJHOME/ext are automatically live when you start your server. There's no need to run any additional syncing steps anymore.

Now it's time to set things up:

Stop the server and all workers

# note: it's okay if it says "no process found".
# That just means there was nothing to stop
stop-apache
killall worker-manager     

Move your old $LJHOME aside

Don't delete it! Just move it out of the way like this:

# Make sure you are in your home directory
cd ~/
mv $LJHOME $LJHOME-old

This will let you access any changes you still have on the old repositories.

Set up dw-free

Replace the USERNAME sections of the URL with your Github username. This will make your repository an authenticated version that can push changes back to Github, as opposed to only being able to pull them.

# clone a copy of the repository onto your machine
cd ~/
git clone https://USERNAME@github.com/USERNAME/dw-free.git $LJHOME
cd $LJHOME

# and let's make it aware of the dreamwidth repository so we can grab updates later
git remote add dreamwidth https://github.com/dreamwidth/dw-free
git fetch dreamwidth
# we also want to sync up with the main branches
git branch --set-upstream develop dreamwidth/develop 

# now set up the folder for external repositories / modules
cd $LJHOME/ext

## copy over your config files, and tell them to take priority
## over config files in any of the repos
mkdir -p local/etc
echo "highest"  > local/.dir_scope
cp $LJHOME-old/etc/config* local/etc/

Set up dw-nonfree (optional)

dw-nonfree contains Dreamwidth-specific branding and code. Do this step only if you're working on changes for dreamwidth.org.

cd $LJHOME/ext
git clone https://USERNAME@github.com/USERNAME/dw-nonfree.git
cd dw-nonfree
git remote add dreamwidth https://github.com/dreamwidth/dw-nonfree
git fetch dreamwidth
git branch --set-upstream develop dreamwidth/develop 
cd ..

Run checkconfig

cd $LJHOME
bin/checkconfig.pl

Additional setup for non-dreamhack users

  • install .deb packages if given by bin/checkconfig.pl
  • install any modules without .deb packages via cpan (like theSchwartz)
  • check any personal scripts you have to make sure they aren't affected by the directory config change

Update the database

Now you will want to update your database based on instructions in Dev Maintenance.

Start the server again

start-apache

Moving patches or changes from hg to git

In this section, $OLDLJHOME is going to refer to wherever you moved the old dw directory. Example to use from above sections:

OLDLJHOME=~/dw-old

If you were working on one issue at a time, then for dw-free you can import your changes (to a topic branch would be best):

cd $OLDLJHOME/cvs/dw-free
hg diff > ~/dw-free-changes.patch
cd $LJHOME
patch -p1 < ~/dw-free-changes.patch

And the same with dw-nonfree:

cd $OLDLJHOME/cvs/dw-nonfree
hg diff > ~/dw-nonfree-changes.patch
cd $LJHOME/ext/dw-nonfree
patch -p1 < ~/dw-nonfree-changes.patch

If you used Mercurial Queues (if you don't know what that is, you probably didn't), you can find all your patches in:

$OLDLJHOME/cvs/dw-free/.hg/patches # for dw-free patches
$OLDLJHOME/cvs/dw-nonfree/.hg/patches # for dw-nonfree patches

When you are ready to incorporate a given patch or set of related patches, make a branch in the repository you are working in (as described in Draft: Github development process).

For dw-free:

cd $LJHOME
patch -p1 < $OLDLJHOME/cvs/dw-free/.hg/patches/PATCHNAME

For dw-nonfree:

cd $LJHOME/ext/dw-nonfree
patch -p1 < $OLDLJHOME/cvs/dw-nonfree/.hg/patches/PATCHNAME

Extras

You may be interested in git settings and git autocomplete to make your life easier.

If you also want to view your repositories on your computer, GitHub has versions for Windows and OSX: