Skip to content

Instantly share code, notes, and snippets.

@rybakit
Created October 6, 2017 06:18
Show Gist options
  • Save rybakit/ea85169a0a24d61a7bd397a97bf19262 to your computer and use it in GitHub Desktop.
Save rybakit/ea85169a0a24d61a7bd397a97bf19262 to your computer and use it in GitHub Desktop.
tarantool/queue config example
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
}
local os = require('os')
return {
user = os.getenv('TARANTOOL_USER_NAME'),
password = os.getenv('TARANTOOL_USER_PASSWORD')
}
#!/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