Code Monkey home page Code Monkey logo

survey's Introduction

survey

This project is survey web system. Can create surveys and anaylize feedback.

Code Climate Test Coverage

Installation

First create server which survey-prov itamae provisioning.

# clone source
git clone https://github.com/wata-gh/survey.git
cd survey

# bundle install gems
bundle --path vendor/bundle

# create database
RAILS_ENV=production bundle exec rake db:create

# apply db
bundle exec ridgepole -c config/database.yml --apply -f db/Schemafile --env production

# npm install
npm install

# install bower components
./bin/rake bower:install['-f']

# precompile assets
bundle exec rake assets:precompile

# start unicorn
RAILS_ENV=production ./bin/rake unicorn:start

After starting unicorn application, you needs to create default group. If your domain is survey.example.com. you need to insert data to groups table.

insert into groups (
  name, description, created_at, updated_at
) values (
  'survey', 'default group', now(), now()
);

If your not using groups or access by IP, you can simply set name to blank.

insert into groups (
  name, description, created_at, updated_at
) values (
  '', 'default group', now(), now()
);

Settings

By default, storage is Amazon S3. But you can change storage to local disk.

Survey uses S3 storage so you need to set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environments.

export AWS_ACCESS_KEY_ID=[AWS access key]
export AWS_SECRET_ACCESS_KEY=[AWS secret key]
export RAILS_ENV=production

config/initializers/carrierwave.rb

config.fog_credentials = {
  provider: 'AWS',
  aws_access_key_id: Rails.application.secrets.aws_access_key_id,
  aws_secret_access_key: Rails.application.secrets.aws_secret_access_key,
  region: 'ap-northeast-1'
}

Doesn't matter which storage you use, you have to set nginx or something to able to access images. You can use nginx+small_light docker image to do that. Just set Amazon S3 url to image.conf and build image and start.

image_server/nginx/conf.d/image.conf

server {
    listen 80 default_server;

    access_log  /var/log/nginx/survey.image.access.log main;
    root   /opt/survey/public;

    small_light on;

    location ~ ^/resize/w/(.+)/h/(.+?)/(.+)$ {
        set $width $1;
        set $height $2;
        set $file $3;
        set $engine "imagemagick";
        proxy_pass http://127.0.0.1/small_light(dw=$width,dh=$height,e=$engine)/images/$file;
    }

    location ~ small_light[^/]*/(.+)$ {
        set $file $1;
        rewrite ^ /$file;
    }

    location /images/ {
        proxy_pass https://s3-ap-northeast-1.amazonaws.com/[bucket name]/;
    }
}

If you are using docker-compose, just start docker image by following command.

docker-compose up -d

Getting Started

Access to survey with your domain and create new survey.
e.g.
http://survey.example.com

survey's People

Contributors

wata-gh avatar jindev avatar

Stargazers

Demeugaliyev Mirosh avatar  avatar pokohide avatar  avatar

Watchers

James Cloos avatar  avatar

Forkers

jindev sio-roro

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.