这是我常用的 fab 部署脚本的改写通用版本。
可能对大型项目没起作用,但是对于小项目,作用还是很大,所以发出来写个文章分享下。
| # License: CC0 1.0 or newer | |
| # https://creativecommons.org/publicdomain/zero/1.0/ | |
| # You can download this script here: https://gist.github.com/vazhnov/fcb487e6ea432fec056793ef710b5a28 | |
| wget "http://repo.zabbix.com/zabbix/3.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.0-1+xenial_all.deb" | |
| sudo dpkg -i zabbix-release_3.0-1+xenial_all.deb | |
| sudo apt-get update | |
| sudo apt-get install zabbix-server-pgsql zabbix-frontend-php libapache2-mod-php php-bcmath php-mbstring php7.0-xml php-pgsql | |
| # Zabbix can't work without password (with ident), so you need to create user with password: |
| http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query | |
| http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails | |
| #payload: [{"kind"=>"person"}] | |
| Segment.where("payload @> ?", [{kind: "person"}].to_json) | |
| #data: {"interest"=>["music", "movies", "programming"]} | |
| Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json) | |
| Segment.where("data #>> '{interest, 1}' = 'movies' ") | |
| Segment.where("jsonb_array_length(data->'interest') > 1") |
| user=... | |
| pass=... | |
| host=localhost # or remote if necessary | |
| database=... | |
| mysqldump -u${user} -p${pass} -h ${host} --add-drop-table --no-data ${database} | grep ^DROP | mysql -u${user} -p${pass} -h ${host} ${database} |
| mysqldump --user="username" --password="password" --skip-triggers --compact --no-create-info --ignore-table="database_name.schema_migrations" --ignore-table="database_name.table_populated_through_migration" "database_name" > "dump.sql" |
SSH into Root
$ ssh [email protected]
Change Root Password
| #!/usr/bin/env ruby | |
| require 'rubygems' | |
| require 'gollum/app' | |
| gollum_path = File.expand_path(File.join(File.dirname(__FILE__), 'database.git')) # CHANGE THIS TO POINT TO YOUR OWN WIKI REPO | |
| Precious::App.set(:gollum_path, gollum_path) | |
| Precious::App.set(:default_markup, :markdown) # set your favorite markup language | |
| Precious::App.set(:wiki_options, {:live_preview => false, :universal_toc => false, :user_icons => 'gravatar'}) | |
| module Precious | |
| class App < Sinatra::Base | |
| # Creates a simple authentication layer |
| module CarrierWave | |
| module MiniMagick | |
| def toaster_filter | |
| manipulate! do |img| | |
| img.modulate '150,80,100' | |
| img.gamma 1.1 | |
| img.contrast | |
| img.contrast | |
| img.contrast | |
| img.contrast |
| <% left_col_content = @page.content_for(:left_column) %> | |
| <% content_content = @page.content_for(:content) %> | |
| <% right_col_content = @page.content_for(:right_column) %> | |
| <% if (!left_col_content && !!content_content && !right_col_content) -%> | |
| <%= render :partial => 'content', :object => @page, | |
| :locals => { :css => "grid_12 alpha omega" } %> | |
| <% end -%> | |
| <% if (!!left_col_content && !!content_content && !right_col_content) -%> | |
| <%= render :partial => 'leftcol', :object => @page, |