Difference between revisions of "Dev Maintenance"
(→Syncing code to live: Replacing instances of the "Deleting removed files" code with the snippet Dre made.) |
(transition from hg to git) |
||
Line 1: | Line 1: | ||
== Updating the Dreamwidth code == | == Updating the Dreamwidth code == | ||
− | {{Warn|text='''VERY IMPORTANT:''' If you have custom changes that you have not committed or patched out, you want to do that first! | + | {{Warn|text='''VERY IMPORTANT:''' If you have custom changes that you have not committed or patched out, you want to do that first! This is very easy. Just use <tt>git stash</tt> to save your work before you start, and recover it after you're done.}} |
− | + | ||
− | + | ||
It is best to shut your Apache instance down before doing the update process, to make sure that everything, especially scripts in cgi-bin/ are reloaded properly: | It is best to shut your Apache instance down before doing the update process, to make sure that everything, especially scripts in cgi-bin/ are reloaded properly: | ||
Line 12: | Line 10: | ||
Okay. Let's say you've been running your Dreamwidth install and you want to pull down the latest and greatest in fixes. This is pretty easy. | Okay. Let's say you've been running your Dreamwidth install and you want to pull down the latest and greatest in fixes. This is pretty easy. | ||
− | + | cd $LJHOME | |
− | If you | + | If you have any changes, first save them: |
− | + | git stash | |
− | + | Then grab updates from the development branch of Dreamwidth's repository: | |
− | + | ||
− | + | git pull dreamwidth develop | |
+ | cd ext/dw-nonfree | ||
+ | git pull dreamwidth develop | ||
− | + | Update your database: | |
− | = | + | # order of commands is important |
+ | $LJHOME/bin/upgrading/update-db.pl -r -p --innodb | ||
+ | $LJHOME/bin/upgrading/update-db.pl -r --cluster=all --innodb | ||
+ | $LJHOME/bin/upgrading/texttool.pl load | ||
− | + | Now you can restart Apache: | |
− | + | start-apache # for Dreamhacks | |
− | + | sudo /etc/init.d/apache2 start # for people running their own | |
− | + | Of course, in a production environment, this whole process is not too recommended as you never know what kind of code you're going to get. But for the most part, it's fairly straightforward. (And if you're doing development, this is generally safe.) | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
== Updating your system == | == Updating your system == | ||
Line 72: | Line 62: | ||
<source lang="bash">#!/bin/bash | <source lang="bash">#!/bin/bash | ||
− | + | oldpwd=$PWD && \ | |
− | $LJHOME | + | cd $LJHOME && \ |
− | + | git pull dreamwidth develop && \ | |
+ | cd $oldpwd | ||
+ | </source> | ||
− | Now, when you type 'dwu', this script will | + | Now, when you type 'dwu', this script will update dw-free. If you need to update dw-nonfree as well, then use this code: |
− | + | ||
− | If you need | + | |
<source lang="bash">#!/bin/bash | <source lang="bash">#!/bin/bash | ||
− | + | oldpwd=$PWD && \ | |
− | + | cd $LJHOME && \ | |
− | + | git pull dreamwidth develop && \ | |
− | + | cd $LJHOME/ext/dw-nonfree && \ | |
− | + | git pull dreamwidth develop && \ | |
− | + | cd $oldpwd | |
− | + | </source> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | $ | + | |
− | + | ||
− | |||
=== dwdb - Updating the database === | === dwdb - Updating the database === | ||
Line 108: | Line 90: | ||
This will update the database when you type 'dwdb'. | This will update the database when you type 'dwdb'. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==Cleaning up your directories== | ==Cleaning up your directories== | ||
Line 147: | Line 95: | ||
If you do any amount of work, you'll find that your directories get cluttered with .orig and .rej files everywhere. This script will clean those up: | If you do any amount of work, you'll find that your directories get cluttered with .orig and .rej files everywhere. This script will clean those up: | ||
− | <source lang="bash"> | + | <source lang="bash">git clean -f "*.rej" "*.orig"</source> |
You can run it from the command line, or put it in a file called ~/bin/tidy and make it executable with "chmod +x ~/bin/tidy". If you do that, you'll be able to just type "tidy" to clean house. | You can run it from the command line, or put it in a file called ~/bin/tidy and make it executable with "chmod +x ~/bin/tidy". If you do that, you'll be able to just type "tidy" to clean house. | ||
[[Category: Development]] | [[Category: Development]] |
Revision as of 06:49, 26 July 2012
Contents
Updating the Dreamwidth code
It is best to shut your Apache instance down before doing the update process, to make sure that everything, especially scripts in cgi-bin/ are reloaded properly:
stop-apache # for Dreamhacks sudo /etc/init.d/apache2 stop # for people running their own
Okay. Let's say you've been running your Dreamwidth install and you want to pull down the latest and greatest in fixes. This is pretty easy.
cd $LJHOME
If you have any changes, first save them:
git stash
Then grab updates from the development branch of Dreamwidth's repository:
git pull dreamwidth develop cd ext/dw-nonfree git pull dreamwidth develop
Update your database:
# order of commands is important $LJHOME/bin/upgrading/update-db.pl -r -p --innodb $LJHOME/bin/upgrading/update-db.pl -r --cluster=all --innodb $LJHOME/bin/upgrading/texttool.pl load
Now you can restart Apache:
start-apache # for Dreamhacks sudo /etc/init.d/apache2 start # for people running their own
Of course, in a production environment, this whole process is not too recommended as you never know what kind of code you're going to get. But for the most part, it's fairly straightforward. (And if you're doing development, this is generally safe.)
Updating your system
On Ubuntu, you can update the packages on your system with:
apt-get update apt-get upgrade
Or, if you want an easy command to run on your dw account in one swoop:
sudo apt-get update && sudo apt-get upgrade
(Note, you may not need to do this step if you're on a Dreamhack and Sophie or Afuna has already done it for everyone.)
Scripting
You can, of course, use scripts to make it easier for you to do most of this.
There is an "omnibus" script available at http://dw-dev.dreamwidth.org/94822.html which incorporates all the individual scripts listed here and some other functions, and includes help information.
Some simpler example scripts are given below.
dwu - Updating the repos
Put this code in a file called ~/bin/dwu and make it executable with chmod ugo+x ~/bin/dwu:
#!/bin/bash oldpwd=$PWD && \ cd $LJHOME && \ git pull dreamwidth develop && \ cd $oldpwd
Now, when you type 'dwu', this script will update dw-free. If you need to update dw-nonfree as well, then use this code:
#!/bin/bash oldpwd=$PWD && \ cd $LJHOME && \ git pull dreamwidth develop && \ cd $LJHOME/ext/dw-nonfree && \ git pull dreamwidth develop && \ cd $oldpwd
dwdb - Updating the database
Put this code in a file called ~/bin/dwdb and make it executable with chmod ugo+x ~/bin/dwdb:
#!/bin/bash $LJHOME/bin/upgrading/update-db.pl -r -p --innodb && \ $LJHOME/bin/upgrading/update-db.pl -r --cluster=all --innodb && \ $LJHOME/bin/upgrading/texttool.pl load
This will update the database when you type 'dwdb'.
Cleaning up your directories
If you do any amount of work, you'll find that your directories get cluttered with .orig and .rej files everywhere. This script will clean those up:
git clean -f "*.rej" "*.orig"
You can run it from the command line, or put it in a file called ~/bin/tidy and make it executable with "chmod +x ~/bin/tidy". If you do that, you'll be able to just type "tidy" to clean house.