Created
October 6, 2017 06:18
-
-
Save rybakit/ea85169a0a24d61a7bd397a97bf19262 to your computer and use it in GitHub Desktop.
tarantool/queue config example
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
queue = require('queue') | |
local function start(config) | |
box.once('jobserver:v0.1.0', function() | |
local tube = queue.create_tube('default', 'fifottl', {if_not_exists = true}) | |
end) | |
end | |
local function stop() | |
end | |
return { | |
start = start, | |
stop = stop | |
} |
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
local os = require('os') | |
return { | |
user = os.getenv('TARANTOOL_USER_NAME'), | |
password = os.getenv('TARANTOOL_USER_PASSWORD') | |
} |
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
#!/usr/bin/env tarantool | |
box.cfg { | |
listen = 3301, | |
log_level = 5 | |
} | |
if jobserver ~= nil then | |
-- hot code reload using tarantoolctl or dofile() | |
-- unload old application | |
jobserver.stop() | |
-- clear cache for loaded modules and dependencies | |
package.loaded['jobserver'] = nil | |
end | |
local config = require('jobserver_config') | |
-- ensure a user exists | |
if not box.schema.user.exists(config.user) then | |
box.schema.user.create(config.user, {password = config.password}) | |
box.schema.user.grant(config.user, 'read,write,execute', 'universe', nil) | |
end | |
-- load a new version of app and all dependencies | |
jobserver = require('jobserver') | |
jobserver.start(config) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment