Topic: two computer dev enviornment setup for personal home use

I don't know much programming. But I am interested in learning it. I have some kowledge of Java, Linux, MySQL, Ant and SVN. But I am NOT an expert in anything.

Here is my situation:

I have two computers. From all the books I've read, the general recommendation is that build-environment should be separate from the development environment. I want to use one computer exclusively as my build environment or production environment. And one computer for development. I have also read in the books that a "source control" is very important. Something like SVN. So, I need help in setting up my build-environment.

Currently, when I write some code, I write it in Eclipse and then save it. I keep making back-up copies and renaming old versions. And I don't use version-control(like SVN). And I do everything on just 1 computer. For example, if I am writing a calculator program. I keep renaming my directory as calculator_001 , calculator_002. This works for me without any problems.

But I just want to be a little more professional and set-up an enviornment like used by professional companies.

In the end: I want to develop in my development machine, and then check-in the code into build-machine, and then run it on build-machine as well and see it from browser. That's all. I will be mainly developing JSP based web applications. I will also like to use "Ruby on Rails" with "MySQL".

Can someone guide me through the process? I am NOT asking for handholding. I will do all the techncial work. I do NOT need instructions on how to install linux, or how to install java. I just need some help in putting this all together and making a professional enviornment for myself.

Thanks!

Re: two computer dev enviornment setup for personal home use

Hello,

good idea to have two computers if possible. Use one only for playing around with your development enwironment and configure the other one exactly as you imagine your target environment.

I would suggest to install TortoiseSVN if you are developing under Windows. With this program which integrates into your explorer you can easily install and maintain an svn-repository into a directory on your computer. This repository can also be used by the Subclipse or Subversive plugin in your Eclipse IDE. Next time you make an release of your project, just make a new tag in Subversion so you don't have to play around with different directory names. There is the Subversion book for free at tigris.org.

Make your build on your development machine and bundle a deployable version from your software which you then install on your 'production' machine. This is used to make sure that your configurations, which you normally alter several times during development, are really working in a clean environment. If the program is working on your target machine, don't forget to run all your system test on the target machine.

Between these steps we normally include a build server. But this servers main purpose is to make a complete build from the subversion repository and run all available automatic tests on the build. If you like you can try to run a build server on your development machine. You can have a look at Apache Continuum or Hudson at dev.java.net.

I hope I could help you with my suggestions.

D.

Re: two computer dev enviornment setup for personal home use

Hi !

Thanks for your message. Although I understood everything you said, I am looking for slightly more micro-level instructions. For example, something along these lines:
Step 1: Install Linux on your build machine
Step 2: Install Ruby at /user/bin
Step 3: Install Torotoise SVN at /usr/bin and configure user/repository as your repodirectory.
Step 3a. Create users for TorotoiseSVN
Step 4: Install and run SSH-d on your build-server
and so on ? ( I know I missed a lot of steps, and they are probably not in correct order).

I'd appreciate your suggestions.

Re: two computer dev enviornment setup for personal home use

[I am developing an application which has its configuration control on rubyforge]

I use a simple two system environment.
1 - My development machine is Linux (Ubuntu) with MySQL, Ruby and Ruby on Rails as well as the svn client (and server just in case I want a local repository) software.

2 - I develop my code in vi and emacs because I have been developing software for 30 years in many languages and on a number of different systems and I never got into IDEs.  Whenever I have a significant change complete I commit it to the svn repository.

3 - I test on my development system.

4 - When it seems to work correctly and pass all of my tests I package it up like it will be in the Rubyforge repository.

5 - I then take the package over to my XP machine and install it on InstantRails there and test it on that machine.  If it passes all of the testing I install it on the Ruby Forge repository.

For Ruby on Rails there really isn't such a thing as "build".  Initially I created a svn repository on my development system and used the repository there in the same manner as I now use the Ruby Forge one.  It works the same except I now have some protection in case my computer fails etc.

YMMV
Norm

Re: two computer dev enviornment setup for personal home use

Thanks, norm. Since you've been developing softwares for over 30 years and have experience in developing in multiple languages over multiple platforms - can you help me with my question? I mean, can you give me a little more specific set-of-steps to accomplish what I am trying to accomplish? That is, to create a separate exclusive build-enviornment. I wont be using just Ruby on Rails, but also J2EE (JSP, Servlets), MySQL, and quite possibly PHP as well.

At the moment, there is only a 1-person development taking place and so I don't really need a set-up like that. It doesn't interfere with my build currently and so on.

But the major reason for doing this are:
1. Learning:

a. I want to understand how a build-machine is configured, and what are it's uses. While setting-up one myself, I will get a taste of what it's like.

b. While setting-up, I will also learn best-practices. For example, I will learn what are best practices when it comes to configuring Tomcat in terms of : where should it be installed? what privileges (should root install it, or a user?), what configuration is best. And why is something done the way it's done. Similarly, I will learn about the whole process of "checking-in" and then "checking out" in correct locations (where should the repository be?, how does Ant checkout code from svn, and how does it do the build?). I will also learn how to install mysql and how to configue it (which port should it be, should I create mysql users, if yes, then what access rights will these users have. Should I have one user that can read/write on db. Or should I have two separate users - one can read only, one can read/write both).


2. Preparing for future:

a. I want to be able to add my friends (located in different parts of the world) to be able to connect to my build-machine (which will also have SVN) and be able to check-out code, and check-in changes.

b. I want to be able to scale-up this model.

Hope I am making sense.

Thanks,

Last edited by ca172 (2008-10-27 03:41:15)

Re: two computer dev enviornment setup for personal home use

I have managed to avoid all significant contact with Java and PHP in my career so I really have nothing to say with regard to Tomcat except that any web server should be run by some unprivledged user so as to avoid significant danger to your system.

I would recommend that you get a copy of "Version Control with Subversion" by  Ben Collins-Sussman, Brian W. Fitzpatrick and C. Michael Pilato which is available from O'Reilly or online at http://svnbook.red-bean.com/.  It is a good book for learning how to set up and use subversion.  There are other version control systems available ranging from SCCS and RCS to git which is now used for control of the Linux kernel.  The system you use is not really all that important, what matters is that you understand what you want to do with the version control system and use it all of the time.  I believe that there is a plugin for Eclipse that interfaces to subversion (I could be wrong, I don't use Eclipse).

If I were to set up a system on which to do development and build for ROR, Java and PHP I would do the following:
1 - Load Linux (I would use Ubuntu because it seems to have a simple update system.  Other distributions would work about the same) with separate root, swap and home partitions.
Immediatly configure the network so it works with your hardware (which may be nothing or may be a big job depending on how your system is configured) and run synaptic or sudo apt-get to reload the database and update the system.
2 - Load a database that you want to use (postgres, MySql, SQLite etc., you can load more than one) and load Rubyfull (and Java and PHP if they are not already there) and rubygems as well as your IDE or editor and language specific plugins.  Install your version control software (like subversion).  If you use synaptic or sudo apt-get to do these installs the tools will be installed and configured in a ready to run configuration.
3 - Either install rails with sudo gem install rake and sudo gem install rails or use synaptic or sudo apt-get to install these.  Either way will work, using gem is more rails way or doing it using the other tools is the Ubuntu or Debian way of doing it.
4. Figure out where you are going to put your software repository.  If your project anticipates having multiple participants I would set up a seperate user specifically for that kind of stuff and put the repository in that user's home directory.  See the documentation for the version control tool you will use for instructions on how to set up the repository.  I would also use that user or another set up for that purpose to do system packaging and distribution (what you call build).  You probably do not need what we usually call a build machine.  The build systems I worked with were commonly fairly powerful systems with a lot of disk space and memory which would on a scheduled nightly basis extract the system from configuration control (a more comprehensive version control type system) and build it from scratch and package it up.  These systems were large enough that we had to start the build by midnight to have systems ready for test in the morning.  All of the languages you mention are interpreted so there is no such thing as a real build needed.
5 - Configure your database system (what is required depends on what you use for a dbms).  At the least you should setup a database user and password.
6 - Load a web server following the same process as above.  You might want multiple servers for different purposes (like mongrel for ROR and Tomcat for Java) which will make the configuration somewhat complex.  You will have to find experts on configuration of the respective servers for help with that.

With these steps you should have a system capable of supporting development and deployment of systems as described.

Norm

Re: two computer dev enviornment setup for personal home use

Thanks, Norm. Fantastic answer. I really liked it and I will get started on these things. Few follow-up questions:

Step 4: I think you are right in that I should set-up a separate user for source control (svn, git or something). Let's say, svnadmin, and then I can create a directory named svn-dir and set-that up as my svn repository.

Once it is set-up, and I've configured which port it should be available on etc. I can login from my client machine (development machine) and check-in/check-out code.

Once I check-in code (pre-tested in my system) - what will I need to do to deploy that code? I mean, where will I run my ant file? And how will I generate my .jar/.war (java terminology)? And how will I deploy them to a webserver?

Thanks.

Re: two computer dev enviornment setup for personal home use

Well that can vary really. Depending on the directory you configure for git, cvs, or subversion, you can have it set as the same directory as say Apache such as /var/www or /var/www/html, etc... So that is entirely up to you and how you set it up.

Any jar files should have been compiled before you ever check in the code. All .jar and .class files are compiled before execution. I write Java and PHP myself (not as much as Rails now tongue), and the server does nothing for building anything. A server serves and serving is all it will do. So compile your Java source in Eclipse, package everything up, test it, then tell the web server to serve.

Re: two computer dev enviornment setup for personal home use

ca172 wrote:

...
Once I check-in code (pre-tested in my system) - what will I need to do to deploy that code? I mean, where will I run my ant file? And how will I generate my .jar/.war (java terminology)? And how will I deploy them to a webserver?

Thanks.

Sorry I cannot help you much with that.  I would not know an ant file if I fell over it.  What I do on a pure ROR application is

svn extract from_path to_path

to create a clean complete copy from the repository.  I then package it up (tar or zip) and distribute it.  Others use things like capistrano etc. which I have no experience with.

Take a look at the forum area about deployment for more authoritative information.

Good Luck
Norm