Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Tuesday, October 16, 2012

Setting up Dreamweaver CS6 with SVN + SSH

I have a customer that has website source code (mostly php) in svn. There is a tidy deployment process whereby commits to trunk are automatically deployed to the test server and tags (with a certain prefix) are automatically deployed to production. This is done using post-commit hooks.

Up until this point they have been using Eclipse to edit the website source files and commit/tag to svn. Eclipse is what we programmers are most familiar with and it worked for this website for years. However, the new web manager wanted to use Dreamweaver instead. Eclipse can be foreign and uncomfortable to a non-programmer and Dreamweaver has extra tools that she was used to. She initially started sneakily working in Dreamweaver and copying files back over to the machine where her Eclipse workspace was in order to commit and tag. That won't do at all, so I started doing research and found that Dreamweaver has svn integration built in. Great!

Except it wasn't so great. If you Google around a little you will find more than a little rumbling about the challenges that face anyone who dreams of using this feature. My problem was that despite following the official instructions to the letter, it just wasn't working. The error message, "Server and project are not accessible! (Can't create tunnel: The system cannot find the file specified.)" didn't tell me much. (Which file? Specified where?) To make matters worse, for whatever reason we only had access to CS6 on Windows. That meant working with svn and ssh on windoze, oh no!

Here are the pieces that we had installed on the windows machine:
FWIW, this machine happens to be running Windows Server edition 2008 R2.

First I wanted to get ssh working, so I tried using PuTTY. I could ssh to our svn server if I provided a password. That's a good start. I already had ssh keys set up on the svn server and so would my customer, so I wanted to figure out how to get the existing key to work on Windows. It turns out that you have to convert the key. To do this:

  1. Run PuTTYgen. 
  2. Click the "Load" button to lead an existing private key file. Enter your passphrase as needed. 
  3. Click "Save private key" to save your key as a PuTTY format private key (I called mine private.ppk)
Then you have to register this key so that you can ssh without a password. To do that, you need to run Pageant. 
  1. Run Pageant if it isn't already running. When it is running you will see it in the bottom right tray area. It looks like a little computer wearing a black hat(?) 
  2. Right click and select "View Keys".
  3. If you don't see your key there (and you won't the first time) then click the "Add Key" button. Navigate to your private.ppk key and add it.
At this point you should be able to ssh via PuTTY without having to enter your password.

At this point we thought that we might be able to connect to svn from Dreamweaver, but all attempts failed. I didn't initially get it from the official instructions that anything else is needed. But,  you need to have a SVN client installed, so we got TortiseSVN. 
One more step: Edit this file
C:\Users\[[Your User Name]]\AppData\Roaming\Subversion\config. 

In the [tunnels] section, specify where ssh client exists. This location depends on where you installed it. Open the file and enter the following within the tunnels section (underneath [tunnels])To use key-based authentication, add -i PathToKey. E.g.

ssh = $SVN_SSH C:/PathToSSHClient/tortoiseplink.exe -i PathToKey

Once you get that installed and you can checkout from svn outside of dreamweaver you are very close.

The final trick was the actual settings in Dreamweaver when setting up version control. This was the magic combination that worked:

Protocol: SVN+SSH
Server address: svn+ssh://[[Your SVN User Name]]@svn.server.domain
Repository Path: /the/path/to/your/project/in/svn/trunk

The piece that I was missing at first was the user name in the server address field. For us, it didn't work without that.

So, there you have it. Now we can checkout, check in from Dreamweaver! No more sneaking files around just to be able to use the right tool for the job.

Thursday, May 20, 2010

Setting up Alfresco 3.3 Community Edition Standalone Deployment Receiver for WCM

I'm trying out the latest edition of the Alfresco content management system community edition. This is a free, open-source content management system that can do both document and web content management (and much more). What my company wants to use it for is web content management (managing html, php, css, images etc. for our many websites).

We like open source software so we are trying to use the completely unsupported, not guaranteed OS version instead of the fully supported and tested enterprise version. Without support or thorough documentation I am on my own (with the help of generous community members) to get this thing installed, configured and up and running and to keep it that way.

One aspect of getting this project off the ground that was especially tricky was getting a Standalone Deployment Receiver working so that I could deploy content (again, html files, css, php) from my Alfresco repository on one machine to a folder on my web server. Here is how I did it:

Before I started I already had a Web Project in alfresco with some dummy content in it (index.html, and a directory with another html file in it).
  1. Downloaded Linux Installer for Standalone Deployment Receiver, Alfresco-DeploymentCommunity-3.3-Linux-x86-Install, from http://wiki.alfresco.com/wiki/Community_Edition_file_list_3.3
  2. Ran the installer (requires gui environment, expects to be able to pop up a window to walk you through installation)
  3. Accepted all defaults, including port numbers
  4. Started it up(start.sh)

Then I went to my web project in alfresco, and edited the web project settings and added a deployment receiver.  (My Web Project -> Actions -> Edit Web Project Settings -> Next -> Add Deployment Receiver) I added my remote machine as a test server.

Then I should be able to click My Sandbox -> More Actions -> Deploy, choose my test server and the content as it exists in my sandbox should be copied over to the remote server, but it didn't work.


Could not connect to remote service [rmi://144.118.94.157:44100/deployment]; nested exception is java.rmi.ConnectException: Connection refused to host: 127.0.1.1; nested exception is: java.net.ConnectException: Connection refused

I did some googling around and found several people mention that you need to do two things: add a setting to JAVA_OPTS for your alfresco tomcat and set up /etc/hosts in a certain way. I tried a bunch of different things that were suggested, but here is what I did that actually resulted in a successful deployment:

1. Made sure that my remote server had the 44100 port open
2. Made sure the deployment receiver was running on my remote server
3. Added to catalina.sh (/tomcat/bin/catalina.sh) the following line near the top before the first time JAVA_OPTS is used:

JAVA_OPTS="$JAVA_OPTS -Djava.rmi.server.hostname=144.118.68.94"

4. Modify /etc/hosts on the alfresco server to include a mapping from its IP address to the domain name like this:

xxx.xxx.xx.xx mydomainname.com

xxx.xxx.xx.xx is not my real IP address, obviously. On the remote server I did the same thing, mapping its IP to its domain name and mapping the alfresco server's IP to the alfresco server domain name, although I'm not sure that was necessary.

5. Restarted alfresco and the remote server (and started the FSR on the remote server again)

Finally! I am able to deploy snapshots from my sandbox to a test server. By repeating the process and setting the second machine as a "Live Server" in the web project settings I am able to deploy snapshots of approved committed content from all users to another remote server. On the remote servers you can do whatever you want, like deploy your web content to a directory that an apache instance serves up and voila! you have a website.

FYI, here are some of the sources I used to piece together this soution: