GithubHelp home page GithubHelp logo

spark's Introduction

Install Ruby Environment

  1. Install required libs 1. On ubuntu sudo apt-get install -y build-essential openssl curl libcurl3-dev libreadline6 libreadline6-dev git zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev libxslt-dev autoconf automake libtool imagemagick libmagickwand-dev libpcre3-dev libsqlite3-dev.

  2. Dowload ruby source code 1. Visit official website of ruby and find the latest ruby version. The current version is 1.9.3-p362. 2. Run wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p362.tar.gz

  3. Make and install ruby 1. Uncompress. Run tar xzf ruby-1.9.3-p362.tar.gz 2. Make and install

    1. cd ruby-1.9.3-p362
    2. Configure. Run ./configure --prefix=/opt/ruby/1.9.3-p362 --enable-pthread --enable-shared. This will install ruby in /opt/ruby/1.9.3-p362
    3. Make. Just run make in the ruby source code directory
    4. Install ruby. Run sudo make install 3. Add links to your bin directory
      sudo ln -s /opt/ruby/1.9.3-p362/ruby /usr/local/bin/ruby
      sudo ln -s /opt/ruby/1.9.3-p362/rake /usr/local/bin/rake
      sudo ln -s /opt/ruby/1.9.3-p362/irb /usr/local/bin/irb
      sudo ln -s /opt/ruby/1.9.3-p362/gem /usr/local/bin/gem
    
4. Install "bundle" gem
  1. Run `sudo gem install bundle`
  2. Add "bundle" to bin directory, `sudo ln -s /opt/ruby/1.9.3-p362/bundle /usr/local/bin/bundle`

Install the Project

  1. Get the codes, and put them into /srv directory, for example I put them into /srv/sftp_monitor_spark/. The structure of the project is under below.
```
  |--config
  |  |--config.yml
  |  |--user.yml
  |--lib
  |  |--x_log.rb
  |--public
  |  |--CSS and JS here
  |--views
  |  |--schedules
  |  |--layout.erb
  |  |--logs.erb
  |  |--new.erb
  |  |--sections.erb
  |--aplication.rb
  |--config.ru
  |--config.yml
  |--Gemfile
  |--README.md
```
  1. Edit the basic settings 1. Copy the example file to your own file
      cp config/config.example.yml config/config.yml
      cp config/user.example.yml config/user.yml
    
2. Edit the lines #2~5 in config/config.yml to set where are your files. Attention, the `ini`, `schedule` and `lock_file` should be put into the same diretory as scripts.
3. Edit config/user.yml to set HTTP authentication name and password of your own.
  1. Install the necessary ruby gems. In the project directory, run bundle install

Test the Project

  1. Run ruby application.rb -e production in project directory. This will start the program on your localhost with port 4567 as default * Here are some other options for this command ruby application.rb [-h] [-x] [-e ENVIRONMENT] [-p PORT] [-o HOST] [-s HANDLER] * More detailed description for the options: ruby application --help
  2. Visit http://localhost:4567 in your browser

Deploy in Production Model with Nginx

  1. Make sure your port is available. For example, if you plan to use Port 3000, you can run sudo netstat -ltnp | grep ':3000' to see whether Port 3000 is being used by other process.
  2. Install Nigix with Passenger. During the installation, select the default configurations.
```
  sudo gem install passenger
  sudo /opt/ruby/1.9.3-p362/bin/passenger-install-nginx-module
```
  1. Add Nginx to service and start up auto run list
```
  wget https://raw.github.com/gist/1548664/53f6d7ccb9dfc82a50c95e9f6e2e60dc59e4c2fb/nginx
  sudo cp nginx /etc/init.d/
  sudo chmod +x /etc/init.d/nginx
  sudo update-rc.d nginx defaults
```
  1. Configure Nginx 1. Edit the Nginx configuration file (/opt/nginx/conf/nginx.conf)

      server {
      listen       3000;
      server_name  localhost;
    
      location / {
      root /srv/sftp_monitor_spark/public;
      passenger_enabled on;
      }
    
2. Restart Nginx

  Run `sudo service nginx restart`

spark's People

Contributors

hegwin avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.