This repository was archived by the owner on Mar 24, 2022. It is now read-only.
File tree 5 files changed +40
-5
lines changed
5 files changed +40
-5
lines changed Original file line number Diff line number Diff line change 1
- ## 0.1.1 (2015-09-04)
1
+ ## 0.1.2 (2015-09-xx)
2
+
3
+ * Redis cache support (tdiary-cache-redis)
4
+
5
+ ## 0.1.1 (2015-09-10)
2
6
3
7
* Update magellan-proxy to 0.0.2.pre
4
8
* Create database if not exist
Original file line number Diff line number Diff line change @@ -28,17 +28,29 @@ MySQL database connection is configured by environment variables:
28
28
* ` MYSQL_USERNAME `
29
29
* ` MYSQL_PASSWORD `
30
30
31
+ ### Cache with redis
32
+
33
+ magellan-tdiary stores cache into Redis, using tdiary-cache-redis gem.
34
+ Redis connection is configured by environment variables:
35
+
36
+ * ` REDIS_HOST `
37
+ * ` REDIS_PORT ` (optional)
38
+ * ` REDIS_DATABASE ` (optional)
39
+ * ` REDIS_PASSWORD ` (optional)
40
+
31
41
## Local test with docker-compose
32
42
33
43
You can try tDiary with docker-compose:
34
44
35
45
```
36
46
% docker-compose up -d
37
- Creating magellantdiary_db_1...
38
- Creating magellantdiary_tdiary_1...
47
+ magellantdiary_db_1 is up-to-date
48
+ magellantdiary_cache_1 is up-to-date
49
+ Starting magellantdiary_tdiary_1...
39
50
% docker-compose ps
40
51
Name Command State Ports
41
52
---------------------------------------------------------------------------
53
+ magellantdiary_cache_1 /entrypoint.sh redis-server Up 6379/tcp
42
54
magellantdiary_db_1 /entrypoint.sh mysqld Up 3306/tcp
43
55
magellantdiary_tdiary_1 /opt/magellan-tdiary/entry ... Up
44
56
```
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ gem "mysql2"
4
4
gem "tdiary", path: "."
5
5
gem "tdiary-contrib", github: "tdiary/tdiary-contrib"
6
6
#gem "tdiary-cache-memcached", github: "tdiary/tdiary-cache-memcached"
7
- # gem "tdiary-cache-redis", github: "tdiary/tdiary-cache-redis"
7
+ gem "tdiary-cache-redis", github: "tdiary/tdiary-cache-redis"
8
8
#gem "tdiary-io-mongodb", github: "tdiary/tdiary-io-mongodb"
9
9
gem "tdiary-io-rdb", github: "tdiary/tdiary-io-rdb"
10
10
#gem "tdiary-style-emptdiary", github: "tdiary/tdiary-style-emptdiary"
Original file line number Diff line number Diff line change @@ -22,5 +22,21 @@ if ENV['DATABASE_URL']
22
22
system ( 'rake -f /opt/magellan-tdiary/Rakefile db:create' )
23
23
end
24
24
25
+ if !ENV [ 'REDIS_HOST' ] && ENV [ 'CACHE_PORT_6379_TCP_ADDR' ]
26
+ ENV [ 'REDIS_HOST' ] = ENV [ 'CACHE_PORT_6379_TCP_ADDR' ]
27
+ end
28
+
29
+ if !ENV [ 'REDIS_PORT' ] && ENV [ 'CACHE_PORT_6379_TCP_PORT' ]
30
+ ENV [ 'REDIS_PORT' ] = ENV [ 'CACHE_PORT_6379_TCP_PORT' ]
31
+ end
32
+
33
+ if !ENV [ 'REDIS_URL' ] && ENV [ 'REDIS_HOST' ]
34
+ require 'uri'
35
+ ENV [ 'REDIS_URL' ] = URI ::Generic . build ( scheme : "redis" , host : ENV [ 'REDIS_HOST' ] , port : ( ENV [ 'REDIS_PORT' ] || 6379 ) . to_i ) . tap { |o |
36
+ o . user = ":#{ ENV [ 'REDIS_PASSWORD' ] } " if ENV [ 'REDIS_PASSWORD' ]
37
+ o . path = "/#{ ENV [ 'REDIS_DATABASE' ] } " if ENV [ 'REDIS_DATABASE' ]
38
+ } . to_s
39
+ end
40
+
25
41
program = ARGV . shift
26
42
exec ( program , *ARGV )
Original file line number Diff line number Diff line change 1
1
tdiary :
2
- image : minimum2scp/magellan-tdiary:0.1.1
2
+ image : minimum2scp/magellan-tdiary:0.1.2
3
3
links :
4
4
- db
5
+ - cache
5
6
command : bundle exec puma --port 80
6
7
environment :
7
8
- MYSQL_USERNAME=tdiary
21
22
# - ./volumes/mysql-data:/var/lib/mysql:rw
22
23
- ./volumes/mysql-conf/charset.cnf:/etc/mysql/conf.d/charset.cnf:ro
23
24
25
+ cache :
26
+ image : redis:3.0
24
27
You can’t perform that action at this time.
0 commit comments