Difference between revisions of "User talk:Jeshyr"

From Dreamwidth Notes
Jump to: navigation, search
m (Foxfirefey moved page User talk:Rb to User talk:Jeshyr: Automatically moved page while renaming the user "Rb" to "Jeshyr")
 
(14 intermediate revisions by one other user not shown)
Line 1: Line 1:
[[Category: Development]]
+
= Introduction =
 +
<strong>The instructions below are not complete, and are not enough to get the Dreamwidth code up and running</strong>.
  
** NOTE: Test version of this rewrite is being stored at http://wiki.dwscoalition.org/notes/User_talk:Rb for now **
+
Below are some notes on getting the environment setup on OS X 10.7 Lion. Some of these may be applicable to older versions too, but I've no way of testing. This is a supplementary document, for setting up the environment only. For instructions on actually running the DW code, see [[Dev_Getting_Started]].
  
This documents the contents of the $LJHOME development folder as checked out by <code>bootstrap.pl</code> and present on all Dreamhacks.
+
I'm assuming that you want all of these to be placed in /usr/local/bin instead of overwriting your system files. All instructions below should leave your system files intact.
  
 +
When you see stuff like this:
 +
  $ commandname parameters
  
= bin =
+
The $ is a Terminal prompt. You should type the rest of the line as is into your Terminal (e.g., "commandname parameters", no "$" and no quotation marks). Lines not preceded by a "$" are output.
  
Backend utilities for maintaining and upgrading the site.
+
== Note about OS Versions ==
  
 +
These notes are ''specifically'' about OS X Lion which already has 64-bit versions of all of its programs which simplifies this process quite a lot. If you are trying this on a version prior to 10.7 Lion, you need to see [[Running Dreamwidth on a Mac OS X system]].
  
= cgi-bin =
 
  
Code libraries that power the site.  This directory is the base of the library path--that is <code>use Net::OpenID::Consumer;</code> refers to the code in <code>cgi-bin/Net/OpenID/Consumer.pm</code>. It contains all the custom Perl libraries and functions that the code references including the <code>LJ::*</code> and <code>DW::*</code> libraries. Code in <code>*.pl</code> files in this directory are also library files but in an older style ([http://bugs.dwscoalition.org/show_bug.cgi?id=1726 bug 1726] refers to these updates).
+
= XCode =
  
 +
Install XCode from the App Store - this what used to be called Dev Tools. You can search for "XCode" from within the Mac App Store and that will get you the XCode installer.
  
= cvs =
+
Once the installer has downloaded you need to run it - doubleclick on 'Install Xcode' in your Applications folder. You can delete the installer once the installation is finished, if you like.
  
Local version of the [http://hg.dwscoalition.org Mercurial repositories]. Information about use of these repositories can be found in the [[http://wiki.dwscoalition.org/notes/Dev_Initial_Programming_Notes Developers' Initial Programming Notes]].
 
  
The two Mercurial source branches you'll be using most often are <code>dw-free</code> [http://hg.dwscoalition.org/dw-free/ dw-free] and <code>dw-nonfree</code> [http://hg.dwscoalition.org/dw-nonfree/ dw-nonfree]. (When viewing the Mercurial page for each repo, the 'Manifest' link in the top menu bar will allow you to browse the source tree.)
+
= MySQL =
  
 +
== Obtaining the binary ==
 +
You can download the binary from here:
  
= doc =
+
  http://dev.mysql.com/downloads/mysql/
  
Unedited versions of some configuration files are stored here.
+
You need the 64 bit version.
  
== raw ==
+
Once downloaded, unzip the contents into /usr/local:
  
Docbook formatted source for the old and very much out of date docbook code for the LiveJournal server. LiveJournal's version is visible at <code>http://livejournal.com/doc/server/</code> but Dreamwidth has not generated a user-visible copy.
+
  $ sudo tar xvfz mysql-5.5.16-osx10.6-x86_64.tar.gz -C /usr/local
  
 +
Then create a symbolic link to make the rest of everything easier:
  
= etc =
+
    $ cd /usr/local
 +
    $ sudo ln -s mysql-5.5.16-osx10.6-x86_64/ mysql # use whatever directory corresponds to your MySQL download
  
Various configuration files specific to the local site, such as <code>ljconfig.pl</code>. These files are not copied to the Mercurial repositories so they can be updated without affecting other running installations.
+
Now you can refer to your install directory as <code>/usr/local/mysql</code> which is easier to remember.
  
 +
== Setting up the mysql user ==
 +
   
 +
The /usr/local/mysql/INSTALL-BINARY installation instructions will '''not''' work on OS X. Use these instead:
  
= htdocs =
+
  $ sudo dscl . -create /Groups/mysql # same as groupadd mysql
 +
  $ sudo dscl . -create /Users/mysql  # same as useradd mysql
 +
  $ sudo dscl . -append /Groups/mysql GroupMembership mysql
  
User-facing [[BML]] pages, with the directory structure used on the main website. That is to say, anything that appears at <code>http://www.dreamwidth.org/filename.bml</code> will be here, as <code>htdocs/filename.bml</code>; anything at <code>http://www.dreamwidth.org/directory/filename.bml</code> will be here as <code>htdocs/directory/filename.bml</code>, etc.
+
== Setting up folder permissions ==
 +
 
 +
  $ cd /usr/local/mysql
 +
  $ sudo chown -R mysql .
 +
  $ sudo chgrp -R mysql .
 +
  $ sudo scripts/mysql_install_db --user=mysql
 +
  $ sudo chown -R root .
 +
  $ sudo chown -R mysql data
  
 +
== Starting up mysql ==
  
= logs =
+
There should be a way to start up mysql on system startup. If you don't do that, you will need to run this command every time you want to get the mysql database up and running:
 +
  $ sudo bin/mysqld_safe --user=mysql &
  
TODO: Is this directory even used?
+
(You'll need to leave the terminal window open after this or you'll terminate the mysql process).
  
  
= schemes =
+
= Mercurial =
  
[[Template Toolkit]] (<code>*.tt</code>) files for generating the site schemes used on Dreamwidth.
+
== Obtaining it ==
  
 +
Binary packages for OS X are available here:
 +
    http://mercurial.berkwood.com/
  
= src =
+
Download the most recent one available for your OS version - I used <code>Mercurial 1.9.2 for OS X 10.7</code> for this.
  
TODO: Check this
+
This build of Mercurial comes with a standard Mac-style installer so double-click on the package in the Finder to unzip it, then double-click on the installer and go with all the default options.
Source code for some of the packages the code uses.  Perhaps this is the folder that comes with the distribution and <code>cvs</code> is checked out from the other repositories?  Does not contain all of the ones in <code>cvs</code> though.
+
  
 +
== Create a shortcut ==
 +
The DW bootstrap.pl expects Mercurial to be installed in /usr/bin, whereas the binary installs it in /usr/local/bin. So we shall put in a symbolic link:
  
= ssldocs =
+
  $ sudo ln -s /usr/local/bin/hg /usr/bin/hg
  
[[BML]] pages that are transmitted over SSL instead of being unencrypted (regular files live in <code>htdocs</code>). This includes the shop and the admin tools, amongst other things.
 
  
 +
= GD =
  
= t =
+
GD is a C library for making graphics and graphs which can be found here:
 +
    http://www.boutell.com/gd/
  
Tests that use the testing framework in main/test.  See [[Dev Testing]] for how to use them.
+
I'm not installing this yet
  
  
= temp =
+
= GMP =
  
TODO: Probably used for temporary file storage, but what temporary files?
+
GMP is another C library for arbitrary-precision math.
  
 +
It's available here:
 +
    http://gmplib.org/
  
= test =
+
Not installing this yet either, it does claim to build on OS X though.
  
TODO: What's this?
 
  
 +
= GPG =
  
= [[Main development folder/views|views]] =
+
GnuPG is available pre-built for Mac OS X at:
 +
   
 +
    http://www.gpgtools.org/
  
[[Template Toolkit]] files which are gradually replacing the BML files. The controllers for the templates are in <tt>cgi-bin/DW/Controller/</tt>.
+
Simply download and install this package, it's standard Mac style.
 +
 
 +
 
 +
= Image Magick =
 +
 
 +
You can download a binary distribution of Image Magic from here:
 +
  http://www.imagemagick.org/script/binary-releases.php#macosx
 +
 
 +
I recommend unzipping this into /usr/local the same way we did with mysql:
 +
    $ cd /usr/local
 +
    $ sudo tar -xvzf ~/Downloads/ImageMagick-x86_64-apple-darwin11.1.0.tar.gz
 +
 
 +
Then you have to set some variables in your .profile file. Add these lines (adapted depending on your directory names):
 +
 
 +
<source>
 +
export MAGICK_HOME="/usr/local/ImageMagick-6.7.2"
 +
export PATH="$MAGICK_HOME/bin:$PATH"
 +
export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib/"
 +
</source>
 +
 
 +
Then reread this file before continuing:
 +
    $ source ~/.profile
 +
 
 +
 
 +
= Perl Modules =
 +
 
 +
== CPAN ==
 +
First set up CPAN which simplifies installation of all the other modules:
 +
 
 +
    $ sudo CPAN
 +
 
 +
You can answer "yes" to it's autoconfiguration question:
 +
 
 +
    Would you like me to configure as much as possible automatically? [yes]
 +
 
 +
I was able to accept defaults for the other questions it asked. When it's installed it will dump you into the CPAN shell:
 +
 
 +
    cpan[1]>
 +
 
 +
The first thing to do is reinstall CPAN to make sure you're up to date.
 +
 
 +
    cpan[1]> install Bundle::CPAN
 +
 
 +
This installed a ''lot'' of other support modules and took quite a while, it spams the screen with tons of results while it's doing it and it stopped a few times to ask me questions, I just accepted any default it offered! When it's done, reload your CPAN shell:
 +
 
 +
    cpan[2]> reload cpan
 +
 
 +
== Perl Modules ==
 +
 
 +
You now have a really really long list of packages to install. Some of these will install prerequisites automatically, others will ask if they should - just accept all defaults.
 +
 
 +
I have copied this list mostly from the [[Dreamwidth Scratch Installation]] page and make no claims about it being complete OR about any of these modules being necessary :)
 +
 
 +
You'll need to run CPAN as root to make package installs work:
 +
  $ sudo CPAN
 +
 
 +
I suggest you copy and paste these one at a time - some modules will prompt you mid-installation. Many of these are probably already installed and up to date, that's fine.
 +
 
 +
<source>
 +
install Captcha::reCAPTCHA
 +
install Unicode::CheckUTF8
 +
install DateTime
 +
install MIME::Lite
 +
install HTML::Template
 +
install Net::DNS
 +
install XML::Simple
 +
install Class::Accessor
 +
install Class::Data::Inheritable
 +
install Class::Trigger
 +
install URI
 +
#install Math::BigInt::GMP # requires libgmp first, leaving this for now
 +
install Crypt::DH
 +
install URI::Fetch
 +
install HTML::Template
 +
install MIME::Lite
 +
install GnuPG::Interface # requires GPG first
 +
install Mail::GnuPG # requires GPG first
 +
install Proc::ProcessTable
 +
install SOAP::Lite
 +
install RPC::XML
 +
install String::CRC32
 +
install Text::vCard
 +
install XML::Atom
 +
install XML::RSS
 +
install Image::Size
 +
install Unicode::MapUTF8
 +
install Net::OpenID::Consumer
 +
install Net::OpenID::Server
 +
install YAML
 +
install CAPTCHA::ReCAPTCHA
 +
install DBD::SQLite3
 +
install Test::Simple
 +
install Test::SimpleUnit
 +
install Template
 +
install Term::ReadKey
 +
install Test::Most
 +
install Business::CreditCard
 +
install ExtUtils::CBuilder
 +
install Image::Magick #requires ImageMagick installed, also failed via CPAN currently not working
 +
install LWP
 +
#install GD #wait until GD installed
 +
#install GD::Graph #wait until GD installed
 +
</source>
 +
 
 +
 
 +
= Postfix =
 +
 
 +
If you want your DW installation to be able to deliver mail you'll need Postfix set up. By default, Lion comes with Postfix installed but not configured.
 +
 
 +
Possibly relevant info:
 +
    * https://discussions.apple.com/thread/3247974?start=0&tstart=0
 +
 
 +
= Getting the bootstrap =
 +
 
 +
Instead of wget, curl should do the trick:
 +
 
 +
  $ curl -O  http://hg.dwscoalition.org/dw-free/raw-file/tip/bin/bootstrap.pl
 +
 
 +
You can also install wget using [http://www.finkproject.org/ Fink] or [http://krypted.com/mac-os-x/howto-install-wget-for-mac-os-x/ build it from source] if you prefer.
 +
 
 +
[[Category: Dreamwidth Installation]]

Latest revision as of 02:31, 6 April 2013

Introduction

The instructions below are not complete, and are not enough to get the Dreamwidth code up and running.

Below are some notes on getting the environment setup on OS X 10.7 Lion. Some of these may be applicable to older versions too, but I've no way of testing. This is a supplementary document, for setting up the environment only. For instructions on actually running the DW code, see Dev_Getting_Started.

I'm assuming that you want all of these to be placed in /usr/local/bin instead of overwriting your system files. All instructions below should leave your system files intact.

When you see stuff like this:

 $ commandname parameters

The $ is a Terminal prompt. You should type the rest of the line as is into your Terminal (e.g., "commandname parameters", no "$" and no quotation marks). Lines not preceded by a "$" are output.

Note about OS Versions

These notes are specifically about OS X Lion which already has 64-bit versions of all of its programs which simplifies this process quite a lot. If you are trying this on a version prior to 10.7 Lion, you need to see Running Dreamwidth on a Mac OS X system.


XCode

Install XCode from the App Store - this what used to be called Dev Tools. You can search for "XCode" from within the Mac App Store and that will get you the XCode installer.

Once the installer has downloaded you need to run it - doubleclick on 'Install Xcode' in your Applications folder. You can delete the installer once the installation is finished, if you like.


MySQL

Obtaining the binary

You can download the binary from here:

 http://dev.mysql.com/downloads/mysql/

You need the 64 bit version.

Once downloaded, unzip the contents into /usr/local:

 $ sudo tar xvfz mysql-5.5.16-osx10.6-x86_64.tar.gz -C /usr/local

Then create a symbolic link to make the rest of everything easier:

   $ cd /usr/local
   $ sudo ln -s mysql-5.5.16-osx10.6-x86_64/ mysql # use whatever directory corresponds to your MySQL download

Now you can refer to your install directory as /usr/local/mysql which is easier to remember.

Setting up the mysql user

The /usr/local/mysql/INSTALL-BINARY installation instructions will not work on OS X. Use these instead:

 $ sudo dscl . -create /Groups/mysql # same as groupadd mysql
 $ sudo dscl . -create /Users/mysql  # same as useradd mysql
 $ sudo dscl . -append /Groups/mysql GroupMembership mysql

Setting up folder permissions

 $ cd /usr/local/mysql
 $ sudo chown -R mysql .
 $ sudo chgrp -R mysql .
 $ sudo scripts/mysql_install_db --user=mysql
 $ sudo chown -R root .
 $ sudo chown -R mysql data

Starting up mysql

There should be a way to start up mysql on system startup. If you don't do that, you will need to run this command every time you want to get the mysql database up and running:

 $ sudo bin/mysqld_safe --user=mysql &

(You'll need to leave the terminal window open after this or you'll terminate the mysql process).


Mercurial

Obtaining it

Binary packages for OS X are available here:

   http://mercurial.berkwood.com/

Download the most recent one available for your OS version - I used Mercurial 1.9.2 for OS X 10.7 for this.

This build of Mercurial comes with a standard Mac-style installer so double-click on the package in the Finder to unzip it, then double-click on the installer and go with all the default options.

Create a shortcut

The DW bootstrap.pl expects Mercurial to be installed in /usr/bin, whereas the binary installs it in /usr/local/bin. So we shall put in a symbolic link:

 $ sudo ln -s /usr/local/bin/hg /usr/bin/hg


GD

GD is a C library for making graphics and graphs which can be found here:

   http://www.boutell.com/gd/

I'm not installing this yet


GMP

GMP is another C library for arbitrary-precision math.

It's available here:

   http://gmplib.org/

Not installing this yet either, it does claim to build on OS X though.


GPG

GnuPG is available pre-built for Mac OS X at:

   http://www.gpgtools.org/

Simply download and install this package, it's standard Mac style.


Image Magick

You can download a binary distribution of Image Magic from here:

  http://www.imagemagick.org/script/binary-releases.php#macosx

I recommend unzipping this into /usr/local the same way we did with mysql:

   $ cd /usr/local
   $ sudo tar -xvzf ~/Downloads/ImageMagick-x86_64-apple-darwin11.1.0.tar.gz

Then you have to set some variables in your .profile file. Add these lines (adapted depending on your directory names):

Invalid language.

You need to specify a language like this: <source lang="html4strict">...</source>

Supported languages for syntax highlighting:

4cs, 6502acme, 6502kickass, 6502tasm, 68000devpac, abap, actionscript, actionscript3, ada, algol68, apache, applescript, apt_sources, arm, asm, asp, asymptote, autoconf, autohotkey, autoit, avisynth, awk, bascomavr, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, c_loadrunner, c_mac, caddcl, cadlisp, cfdg, cfm, chaiscript, cil, clojure, cmake, cobol, coffeescript, cpp, cpp-qt, csharp, css, cuesheet, d, dcl, dcpu16, dcs, delphi, diff, div, dos, dot, e, ecmascript, eiffel, email, epc, erlang, euphoria, f1, falcon, fo, fortran, freebasic, freeswitch, fsharp, gambas, gdb, genero, genie, gettext, glsl, gml, gnuplot, go, groovy, gwbasic, haskell, haxe, hicest, hq9plus, html4strict, html5, icon, idl, ini, inno, intercal, io, j, java, java5, javascript, jquery, kixtart, klonec, klonecpp, latex, lb, ldif, lisp, llvm, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, magiksf, make, mapbasic, matlab, mirc, mmix, modula2, modula3, mpasm, mxml, mysql, nagios, netrexx, newlisp, nsis, oberon2, objc, objeck, ocaml, ocaml-brief, octave, oobas, oorexx, oracle11, oracle8, oxygene, oz, parasail, parigp, pascal, pcre, per, perl, perl6, pf, php, php-brief, pic16, pike, pixelbender, pli, plsql, postgresql, povray, powerbuilder, powershell, proftpd, progress, prolog, properties, providex, purebasic, pycon, pys60, python, q, qbasic, rails, rebol, reg, rexx, robots, rpmspec, rsplus, ruby, s2, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, spark, sparql, sql, stonescript, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, unicon, upc, urbi, uscript, vala, vb, vbnet, vedit, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xbasic, xml, xorg_conf, xpp, yaml, z80, zxbasic


export MAGICK_HOME="/usr/local/ImageMagick-6.7.2"
export PATH="$MAGICK_HOME/bin:$PATH"
export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib/"

Then reread this file before continuing:

   $ source ~/.profile


Perl Modules

CPAN

First set up CPAN which simplifies installation of all the other modules:

   $ sudo CPAN

You can answer "yes" to it's autoconfiguration question:

   Would you like me to configure as much as possible automatically? [yes] 

I was able to accept defaults for the other questions it asked. When it's installed it will dump you into the CPAN shell:

   cpan[1]> 

The first thing to do is reinstall CPAN to make sure you're up to date.

   cpan[1]> install Bundle::CPAN

This installed a lot of other support modules and took quite a while, it spams the screen with tons of results while it's doing it and it stopped a few times to ask me questions, I just accepted any default it offered! When it's done, reload your CPAN shell:

   cpan[2]> reload cpan

Perl Modules

You now have a really really long list of packages to install. Some of these will install prerequisites automatically, others will ask if they should - just accept all defaults.

I have copied this list mostly from the Dreamwidth Scratch Installation page and make no claims about it being complete OR about any of these modules being necessary :)

You'll need to run CPAN as root to make package installs work:

  $ sudo CPAN

I suggest you copy and paste these one at a time - some modules will prompt you mid-installation. Many of these are probably already installed and up to date, that's fine.

Invalid language.

You need to specify a language like this: <source lang="html4strict">...</source>

Supported languages for syntax highlighting:

4cs, 6502acme, 6502kickass, 6502tasm, 68000devpac, abap, actionscript, actionscript3, ada, algol68, apache, applescript, apt_sources, arm, asm, asp, asymptote, autoconf, autohotkey, autoit, avisynth, awk, bascomavr, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, c_loadrunner, c_mac, caddcl, cadlisp, cfdg, cfm, chaiscript, cil, clojure, cmake, cobol, coffeescript, cpp, cpp-qt, csharp, css, cuesheet, d, dcl, dcpu16, dcs, delphi, diff, div, dos, dot, e, ecmascript, eiffel, email, epc, erlang, euphoria, f1, falcon, fo, fortran, freebasic, freeswitch, fsharp, gambas, gdb, genero, genie, gettext, glsl, gml, gnuplot, go, groovy, gwbasic, haskell, haxe, hicest, hq9plus, html4strict, html5, icon, idl, ini, inno, intercal, io, j, java, java5, javascript, jquery, kixtart, klonec, klonecpp, latex, lb, ldif, lisp, llvm, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, magiksf, make, mapbasic, matlab, mirc, mmix, modula2, modula3, mpasm, mxml, mysql, nagios, netrexx, newlisp, nsis, oberon2, objc, objeck, ocaml, ocaml-brief, octave, oobas, oorexx, oracle11, oracle8, oxygene, oz, parasail, parigp, pascal, pcre, per, perl, perl6, pf, php, php-brief, pic16, pike, pixelbender, pli, plsql, postgresql, povray, powerbuilder, powershell, proftpd, progress, prolog, properties, providex, purebasic, pycon, pys60, python, q, qbasic, rails, rebol, reg, rexx, robots, rpmspec, rsplus, ruby, s2, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, spark, sparql, sql, stonescript, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, unicon, upc, urbi, uscript, vala, vb, vbnet, vedit, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xbasic, xml, xorg_conf, xpp, yaml, z80, zxbasic


install Captcha::reCAPTCHA
install Unicode::CheckUTF8
install DateTime
install MIME::Lite
install HTML::Template
install Net::DNS
install XML::Simple
install Class::Accessor
install Class::Data::Inheritable
install Class::Trigger
install URI
#install Math::BigInt::GMP # requires libgmp first, leaving this for now
install Crypt::DH
install URI::Fetch
install HTML::Template
install MIME::Lite
install GnuPG::Interface # requires GPG first
install Mail::GnuPG # requires GPG first
install Proc::ProcessTable
install SOAP::Lite
install RPC::XML
install String::CRC32
install Text::vCard
install XML::Atom
install XML::RSS
install Image::Size
install Unicode::MapUTF8
install Net::OpenID::Consumer
install Net::OpenID::Server
install YAML
install CAPTCHA::ReCAPTCHA
install DBD::SQLite3
install Test::Simple
install Test::SimpleUnit
install Template
install Term::ReadKey
install Test::Most
install Business::CreditCard
install ExtUtils::CBuilder
install Image::Magick #requires ImageMagick installed, also failed via CPAN currently not working
install LWP
#install GD #wait until GD installed
#install GD::Graph #wait until GD installed


Postfix

If you want your DW installation to be able to deliver mail you'll need Postfix set up. By default, Lion comes with Postfix installed but not configured.

Possibly relevant info:

   * https://discussions.apple.com/thread/3247974?start=0&tstart=0

Getting the bootstrap

Instead of wget, curl should do the trick:

  $ curl -O  http://hg.dwscoalition.org/dw-free/raw-file/tip/bin/bootstrap.pl

You can also install wget using Fink or build it from source if you prefer.