Skip to content

Installing CodeSync

Alessandro Maggio edited this page Jul 26, 2016 · 8 revisions

You should find enough information to install CodeSync in your README.md file, which is included in codesync. However, it may be useful to have this detailed guide.

Installing the server

The first component we are going to install is the server.

Requirements

CodeSync is a lightweight application by nature. It just transfer files over an HTTP tunnel, taking advantages of built-in HTTP features. It will not heavily load your web server unless you want to synchronize many devices. You might get overwhelmed if syncing more than 100 devices together, but we are sure that some PCs may support even that. With that consideration in mind, we can analyze the technical prerequisites needed.

Prerequisites

As a pre-requisite, the machine that you will transform in a CodeSync server will have to run Apache webserver. It is very easy to install on linux and on windows you can use XAMPP to do it in a next-next-next way. Apache webserver is mandatory, since CodeSync server takes advantage of the Apache's unique features. Another web server will not work. Once you get that Apache running, we can move to the next step.

Installation

  1. Download codesync from github and get the latest version
  2. Take all the contents of the "server" folder of codesync and put it into your www root (its patch will be /etc/var/www on many linux distributions and C:/xampp on Windows, if you are using XAMPP)
  3. Make sure you started the server by accessing http://localhost Boom! The server is ready to go, but it will not actually make anything. To make it synchronize device you will need to configure it.

Configuring the server

Configuring the server is actually quite easy, it is all just about creating folders and files.

  • Under the www root, you can create folder with the name you like: these folders represents devices, a device which is configured with that name will know that has to get these files. For now, don't worry about how to configure names on devices, it is part of the client configuration
  • Within each device folder, you can create folders representing projects. A project is just what the name says: a project, a collection of files that interoperates to the same goal
  • Inside each project folder, you can have files and subfolders (containing other subfolders and/or files, and so on). These are the files and folders of your project, the ones you will be editing while doing your development

Installing the client

Requirements

A client can only synchronize its files to and from a single CodeSync server. It is just because of that that we are very confident that CodeSync will not be overwhelming at all for your client device on the normal operations. It may push the lower-end devices to hard condition when you make the initial sync of huge projects, but it should be nothing that a device cannot handle.

Prerequisites

As the client is written in python, the client will need to have the python interpreter. This is included in virtually any linux distribution, whereas is downloadable and installable on windows. Note that on some Windows 7 computers python might not work well. In that case, we reccomend you to install Anaconda. CodeSync uses Python 3.3. Once you have python, you also need the external library requests. In order to install it, just open a prompt/terminal and type pip install requests and you are done. To do that, you will need internet access.

Installation

Once you have python and requests on your device just put the files of the CodeSync client folder where you think it would be best.

Configuring the client

Configuring the client is the most important part. Open the codesync.cfg file with notepad or, even better, Notepad++. Then, add one command per line, separating each word (command and user input with a TAB).

  • device device-name - REQUIRED, define the device name used to fetch files specific for this device
  • default-projects-root folder-absolute-path - REQUIRED, specify where to put the projects you download from the server
  • project project-name absolute-path - OPTIONAL, for the projects you wish, you can define another folder which is not the default and that will override also the project name, being completely transparent to the server
  • server url - REQUIRED, Specify the URL of your codesync server Save the file and you're done! Now you can run python codesync.py -sync all to synchronize your projects.

Automatic Synchronization

CodeSync does not have a built-in synchronization mechanism, you have to launch the command manually. However, you can easily integrate your application to launch the CodeSync synchronization before. We are considering developing a tutorial on how to implement automatic synchronization.