Skip to content
Alex Efros edited this page Apr 22, 2015 · 1 revision

Welcome to the narada-base wiki!

How to upgrade Narada 1.x project

Upgrade process depends on location:

  • devel1 - workstation of developer who initiate project upgrade
  • devel2 - other developers workstations
  • server - production/staging sites

It should be completed first on devel1, then on server and devel2. Name of each upgrade step include locations where it should be done.

All commands should be executed in current project's root directory.

1. Stop project [devel1, devel2, server]

narada-setup-cron --clean
narada-setup-qmail --clean
narada-shutdown-services

2. Backup project [devel1, devel2, server]

rm var/backup/full.tar
narada-backup

Make a copy of current project directory somewhere outside of it:

(cd ..; cp -a THIS-PROJECT-DIR THIS-PROJECT-DIR.backup)

3. Convert Narada 1.x root dir into Narada 2.x source dir [devel1]

If you doesn't have git repo for this project…

  • then create it now:
git init
git commit --allow-empty -m empty
git tag -a -m empty 0.0.0
git remote add origin YOUR_REMOTE_HERE
git push --set-upstream origin master
  • else add into the repo empty commit with tag 0.0.0:
git checkout --orphan empty
git reset
git commit --allow-empty -m empty
git tag -a -m empty 0.0.0
git checkout -f master
git merge 0.0.0
git branch -D empty

Add and merge remotes for chosen project template and (if needed) plugins. If you have already used git for this project then you'll have to resolve merge conflicts, else you'll have to temporary delete conflicting files and restore them from backup after merge.

git remote add narada-base -t socklog -m socklog -f https://github.com/powerman/narada-base.git
git merge narada-base

# Run this if your project used "narada-mojo" plugin for Narada 1.x
git remote add narada-plugin-mojo -t master -m master -f https://github.com/powerman/narada-plugin-mojo.git
git merge narada-plugin-mojo

Remove files and directories which shouldn't exists in project's source dir and the repo, and add into migrate file operations needed to create all of these files and directories in project's deploy dir.

# add operations to initialize config files, create directories in var/, …
$EDITOR migrate

rm -rf config/
rm -rf service/*/supervise/ service/*/log/supervise/
rm -rf tmp/
rm -rf var/

Remove/update other project files if needed, for example:

# cleanup after "narada-mojo" plugin for Narada 1.x
rm doc/ChangeLog.narada-mojo
rm doc/narada-mojo.txt
rm t/.perlcriticrc t/perlcritic.t
rm t/basic.t

# update cpanfile
scan-prereqs-cpanfile --diff=cpanfile
$EDITOR cpanfile

# add .travis.yml, README.md
# update ./build, ./release and ./deploy with changes needed for this project
# update all code to use file ./VERSION instead of ./config/version
# …
# when done commit all project files:
git add .
git commit -m 'upgrade to Narada-2'

Now release next version and deploy it into _live/:

./release 0.1.0 && ./deploy

4. Install project [server]

Make sure you've made project backup outside of project directory at step 2!

cd ..
rm -rf THIS-PROJECT-DIR
mkdir  THIS-PROJECT-DIR
cd     THIS-PROJECT-DIR
mkdir  .release

Upload .release/* files from repo into just created .release/ subdirectory on server.

Install just released version.

narada-install 0.1.0

5. Install project [devel2]

Make sure you've made project backup outside of project directory at step 2!

If you doesn't have git repo for this project…

  • then clone it now:
cd ..
rm -rf THIS-PROJECT-DIR
git clone YOUR_REMOTE_HERE THIS-PROJECT-DIR
  • else update it:
git pull

# check `git status` and remove files which shouldn't be in the source dir anymore, for ex.:
rm -rf config/
rm -rf service/*/supervise/ service/*/log/supervise/
rm -rf tmp/
rm -rf var/

Now deploy current version into _live/:

./release && ./deploy

6. Update external settings [devel1, devel2]

For example, reconfigure nginx to update path to website root/project's static files (they're now in _live/).

7. Restore project's configuration and data [devel1, devel2, server]

Copy required files from ../THIS-PROJECT-DIR.backup/ into ./_live/ (devel1, devel2) or ./ (server). This usually include some files in config/ and var/.

Restart services affected by restored files.

Delete ../THIS-PROJECT-DIR.backup/.

That's it!