This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/local/bin/ruby | |
| require 'AWS' | |
| require 'yaml' | |
| class SnapshotManagement | |
| # initalize class, optional override path to yml file | |
| # * options [String] :path ('') | |
| # | |
| def initialize(params = {}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Create 4 volumes and attach them to hdb | |
| %w[sdi sdj sdk sdl].each do |dev| | |
| volume = AWS.volumes.new :device => "/dev/#{dev}", :size => 5, :availability_zone => hdb.availability_zone | |
| volume.server = hdb | |
| volume.save | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| require 'rubygems' | |
| require 'aws-sdk' | |
| ## アクセスIDとシークレットアクセスキーを指定します | |
| ACCESS_KEY = 'SET UP YOUR ACCESS KEY' | |
| SECRET_KEY = 'SET UP YOUR SECRET KEY' | |
| ## 引数チェック | |
| unless ARGV.size == 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| snapshot_ids.each do |snapshot_id| | |
| AWS.config(:access_key_id => 'AAAAAAAAAAAAAAAAAA', :secret_access_key => 'aaaaaaaaaaaaaaaaaaaa', :region => 'eu-west-1') | |
| ec2 = AWS::EC2.new | |
| current_snap1 = ec2.snapshots[snapshot_id].status | |
| current_snap = Fog::Compute.new({:provider => 'AWS', :region => 'eu-west-1'}).snapshots.all('snapshot-id' => snapshot_id) | |
| p "Snapshot id is #{snapshot_id}" | |
| p current_snap1 | |
| p ec2.snapshots[snapshot_id].progress |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| test.pp: | |
| $db = 'postgresql_test_db' | |
| class { 'postgresql::server': } | |
| postgresql::server::db { $db: | |
| user => $db, | |
| password => postgresql_password($db, $db),} | |
| When executed: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Server configuration for nginx to host Atlassian Jira / Jetbrain TeamCity or any other Tomcat web application | |
| # | |
| # author cedric.walter, www.waltercedric.com | |
| # to be saved for ex in /etc/nginx/sites-available/example | |
| server { | |
| listen 80; | |
| server_name jira.example.com; | |
| access_log off; | |
| location / { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| description "Mailcatcher" | |
| start on runlevel [2345] | |
| stop on runlevel [!2345] | |
| respawn | |
| pre-start script | |
| bash << "EOF" | |
| mkdir -p /var/log/mailcatcher |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| description "Mailcatcher" | |
| start on runlevel [2345] | |
| stop on runlevel [!2345] | |
| respawn | |
| pre-start script | |
| bash << "EOF" | |
| mkdir -p /var/log/mailcatcher |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| description "Tomcat Server" | |
| start on runlevel [2345] | |
| stop on runlevel [!2345] | |
| respawn | |
| respawn limit 10 5 | |
| # run as non privileged user | |
| # add user with this command: | |
| ## adduser --system --ingroup www-data --home /opt/apache-tomcat apache-tomcat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| description "Tomcat Server" | |
| start on runlevel [2345] | |
| stop on runlevel [!2345] | |
| respawn | |
| respawn limit 10 5 | |
| # run as non privileged user | |
| # add user with this command: | |
| ## adduser --system --ingroup www-data --home /opt/apache-tomcat apache-tomcat |