GithubHelp home page GithubHelp logo

certs's Introduction

Certs

Certs is a management tool of SSL certifications' expiration date.

Setup (Ubuntu)

1. Install Dependencies

$ sudo apt-get install git ruby rubygems ruby-dev libmysql-ruby libmysqlclient-dev unicorn nginx mysql-server
$ sudo gem install rails

2. Setup MySQL Database

Create MySQL user.

$ mysql -u root -p -e "CREATE USER 'certs'@'localhost' IDENTIFIED BY 'certs';"

Create MySQL database.

$ mysql -u root -p -e 'CREATE DATABASE IF NOT EXISTS `certs` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;'

Grant.

$ mysql -u root -p -e "GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES ON \`certs\`.* TO 'certs'@'localhost';"

3. Deploy Application

Deploy application.

$ sudo mkdir -p /var/www
$ sudo chown $USER /var/www
$ cd /var/www
$ git clone https://github.com/akagisho/certs.git
$ cd certs
$ bundle install --path vendor/bundle --without test development
$ bundle exec rake db:migrate RAILS_ENV=production
$ bundle exec rake assets:precompile RAILS_ENV=production

4. Start Application

Start unicorn server.

$ unicorn_rails -c config/unicorn.rb -E production -D

Start delayed_job worker.

$ ./script/delayed_job start

Set crontab.

$ crontab -e
30 4 * * * cd /var/www/certs; /usr/local/bin/rake certificates:update_expirations

5. Setup nginx

Make nginx's configuration file.

$ sudo vim /etc/nginx/conf.d/certs.conf
upstream certs {
    server unix:/tmp/certs.sock;
}

server {
    listen      80;
    server_name certs.example.com
    access_log  /var/www/certs/log/access.log;
    error_log   /var/www/certs/log/error.log;

    location / {
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Client-IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_pass http://certs;
    }

    location ~ ^/assets/ {
        root    /var/www/certs/public;
    }

    location = /robots.txt  { log_not_found off; }
    location = /favicon.ico { log_not_found off; }
}

Fix nginx.conf.

$ diff -u /etc/nginx/nginx.conf.orig /etc/nginx/nginx.conf
--- /etc/nginx/nginx.conf.orig  2013-10-23 18:05:28.152611049 +0900
+++ /etc/nginx/nginx.conf       2013-10-23 18:05:51.188610889 +0900
@@ -20,7 +20,7 @@
        types_hash_max_size 2048;
        # server_tokens off;

-       # server_names_hash_bucket_size 64;
+       server_names_hash_bucket_size 64;
        # server_name_in_redirect off;

        include /etc/nginx/mime.types;

Restart nginx.

$ sudo service nginx restart

Complete!

Now you can use certs:

http://certs.example.com/

certs's People

Contributors

akagisho avatar

Stargazers

 avatar

Watchers

 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.