This file contains 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
aws dynamodb query \ | |
--table-name app-config \ | |
--key-condition-expression \ | |
"app_name = :app_name" \ | |
--expression-attribute-values \ | |
"{\":app_name\": {\"S\": \"my_app\"}}" \ | |
--limit 1 --no-scan-index-forward \ | |
| jq -r ".Items[0].my_key.S" |
This file contains 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
timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | |
aws dynamodb put-item \ | |
--table-name app-config \ | |
--item "{\"app_name\": {\"S\": \"myapp\"}, \"my_key\": {\"S\": \"my_val\"}, \"updated_at\": {\"S\": \"$timestamp\"}}" |
This file contains 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
aws dynamodb create-table \ | |
--table-name app-config \ | |
--attribute-definitions \ | |
AttributeName=app_name,AttributeType=S \ | |
AttributeName=updated_at,AttributeType=S \ | |
--key-schema \ | |
AttributeName=app_name,KeyType=HASH \ | |
AttributeName=updated_at,KeyType=RANGE \ | |
--provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 |
This file has been truncated, but you can view the full file.
This file contains 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
2016-08-10T17:29:09Z web:20160726130742/060a78c35106 fatal error: concurrent map read and map write | |
2016-08-10T17:29:09Z web:20160726130742/060a78c35106 | |
2016-08-10T17:29:09Z web:20160726130742/060a78c35106 goroutine 35665 [running]: | |
2016-08-10T17:29:09Z web:20160726130742/060a78c35106 runtime.throw(0x1131ea0, 0x21) | |
2016-08-10T17:29:09Z web:20160726130742/060a78c35106 /usr/local/go/src/runtime/panic.go:547 +0x90 fp=0xc82204bc68 sp=0xc82204bc50 | |
2016-08-10T17:29:09Z web:20160726130742/060a78c35106 runtime.mapaccess1_faststr(0xc0ac40, 0xc821031800, 0xc822042700, 0x20, 0xc8201564b0) | |
2016-08-10T17:29:09Z web:20160726130742/060a78c35106 | |
2016-08-10T17:29:09Z web:20160726130742/060a78c35106 github.com/convox/rack/api/cache.Get(0x10e71e0, 0x11, 0xc0ebc0, 0xc820435860, 0x0, 0x0) | |
2016-08-10T17:29:09Z web:20160726130742/060a78c35106 /go/src/github.com/convox/rack/api/cache/cache.go:43 +0x5bf fp=0xc82204be10 sp=0xc82204bcc8 | |
2016-08-10T17:29:09Z web:20160726130742/060a78c35106 github.com/convox/rack/api/provider/aws.(*AWS |
This file contains 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
#!/bin/sh | |
set -e | |
if ! grep fluentd /etc/ecs/ecs.config &> /dev/null | |
then | |
echo 'ECS_AVAILABLE_LOGGING_DRIVERS=["json-file","syslog","fluentd"]' >> /etc/ecs/ecs.config | |
fi |
This file contains 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
* Loaded features: | |
0 enumerator.so | |
1 thread.rb | |
2 rational.so | |
3 complex.so | |
4 /usr/local/lib/ruby/2.3.0/x86_64-linux/enc/encdb.so | |
5 /usr/local/lib/ruby/2.3.0/x86_64-linux/enc/trans/transdb.so | |
6 /usr/local/lib/ruby/2.3.0/unicode_normalize.rb |
This file contains 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
/* font size (cards etc) */ | |
html, body, input, select, textarea {font-size: 13px !important;} /* instead of 14px */ | |
/**************** HEADER *****************/ | |
/* header bar */ | |
#header {background: #2B2B2B !important;} | |
/* header buttons */ | |
.header-btn.header-notifications, .header-btn.header-boards, |
This file contains 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
en: | |
activerecord: | |
attributes: | |
mything: | |
sku: SKU | |
errors: | |
models: | |
mything: | |
attributes: | |
sku: |
This file contains 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
class MyThing < ActiveRecord::Base | |
private | |
def create_or_update | |
super | |
rescue ActiveRecord::RecordNotUnique => e | |
case e.message | |
when /index_mytable_on_sku_unique/ | |
errors.add(:sku, :taken) | |
else | |
# This should not happen; we want to know if we forgot to handle some unique constraint |
This file contains 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
class AddUniqueConstraintToSkus < ActiveRecord::Migration | |
disable_ddl_transaction! | |
def up | |
# code to de-dupe the table, if needed in real time. If these are rare and it takes a long time to fix, you can run it as a separate job prior to this migration | |
connection.execute("CREATE UNIQUE INDEX CONCURRENTLY index_mytable_on_sku_unique ON mytable(lower(sku),user_id) where deleted_at is null;") | |
end | |
def down | |
connection.execute("DROP INDEX CONCURRENTLY IF EXISTS index_mytable_on_sku_unique;") |