transifex / txgh

A server that integrates Transifex with GitHub
Apache License 2.0
68 stars 48 forks source link

There needs to be a recommended way of running Txgh on AWS #14

Closed matthewjackowski closed 8 years ago

matthewjackowski commented 8 years ago

There is no specific recommendations on how to run Txgh on a cloud server provider like EC2. A standard recommended approach is important so that we can better support people running on AWS.

matthewjackowski commented 8 years ago

Start up a Ubuntu instance Open the associated Security Group add an inbound rule to allow all traffic (it is recommended that this can be locked down after initial setup)

Build Ruby 2.1.5

apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
wget http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.5.tar.gz 
tar -xvzf ruby-2.1.5.tar.gz
cd ruby-2.1.5/
./configure --prefix=/usr/local
make
make install
ruby --version

Should return: "ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]"

If you have old versions, or somehow the linking was broken, you can create a new link to it like this:

ls -la /usr/bin/ruby

Install Txgh in your 'home' directory

cd ~

Now download Txgh

wget https://github.com/transifex/txgh/archive/master.zip

apt-get install unzip
unzip master.zip -d github

cd ./github/txgh-master

gem install bundler

bundle install

Let's test running the server:

rackup

Should give: Puma 2.5.1 starting...

If this runs, we know that Ruby is setup and Txgh dependencies have been installed. Things to note at this point. The environment is set to development and the host/port is not set to valid web hook location.

Now let's configure our service, todo this we can pull a test repository.

apt-get install git
git clone https://github.com/matthewjackowski/txgh-test-resources.git

This is just an example repository for testing. Github commits can be made from any location.

Now let's setup our configuration. There are 2 files that need to be setup in config txgh.yml and tx.config

There is an example conf file already in config called 'strava-test.conf', this can also be generated by the Transifex client.

An example txgh.yml can be found in the readme.

Now be sure to setup your web hooks in both Transifex and Github...for Github be sure to choose 'application/x-www-form-urlencoded' for Content Type.

Now run the server on port 80 to be able to see web hooks.

rackup -p 80

Either push a new source file to the Github repository or translate a resource to 100% in Transifex to activate the webhooks and test the Txgh server.

cheesegrits commented 8 years ago

As per an issue I submitted yesterday, I found that doing a default rackup started it only listening on localhost, unless I set the environment variable RACK_ENV=production.

-- hugh

matthewjackowski commented 8 years ago

Ah yes. Good point. Depending on your OS settings, you may default to a configuration that doesn't work. You can alter the environment as suggested or you can also force the host like this:

rackup -o 0.0.0.0 -p 80

Ideally setting up the proper ENV is a better way to go!

cheesegrits commented 8 years ago

It just took me by surprise when I switched from running my fork to this one, and suddenly github couldn't talk to it. Being a complete ruby noob it took me quite a while to work out what was going on!

PetrGasparik commented 8 years ago

Hi, what if I want all translations to be pulled, not only those 100%? is this configurable?

matthewjackowski commented 8 years ago

Hi @PetrGasparik this configuration is set by Transifex web hooks themselves, not the Txgh project. Unfortunately Transifex currently only fires these requests when 100% complete. We do have a feature request open to improve this, however, so any feedback you can give about what would be a more ideal timing would be great!

PetrGasparik commented 8 years ago

Hi @matthewjackowski, thank you for your reply. Preferred way is to be able to configure functionality equivalent to tx pull --minimum-perc=MINIMUM_PERC: "Specify the minimum acceptable percentage of a translation in order to download it.". See http://docs.transifex.com/client/pull/

Regards, P.