Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
slapos
Commits
ec01997c
Commit
ec01997c
authored
Nov 03, 2015
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X on embedded redis
parent
80442a6c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
50 additions
and
49 deletions
+50
-49
slapos/recipe/redis/__init__.py
slapos/recipe/redis/__init__.py
+7
-1
slapos/recipe/redis/promise.py
slapos/recipe/redis/promise.py
+6
-4
slapos/recipe/redis/template/redis.conf.in
slapos/recipe/redis/template/redis.conf.in
+1
-3
software/gitlab/instance-gitlab.cfg.in
software/gitlab/instance-gitlab.cfg.in
+33
-39
software/gitlab/instance.cfg.in
software/gitlab/instance.cfg.in
+1
-0
software/gitlab/template/database.yml.in
software/gitlab/template/database.yml.in
+1
-0
software/gitlab/template/resque.yml.in
software/gitlab/template/resque.yml.in
+1
-2
No files found.
slapos/recipe/redis/__init__.py
View file @
ec01997c
...
...
@@ -45,6 +45,11 @@ class Recipe(GenericBaseRecipe):
log_file
=
self
.
options
[
'log_file'
],
master_passwd
=
master_passwd
)
if
self
.
options
.
get
(
'unixsocket'
):
unixsocket
=
"unixsocket %s
\
n
unixsocketperm 700"
%
self
.
options
[
'unixsocket'
]
else
:
unixsocket
=
""
configuration
[
'unixsocket'
]
=
unixsocket
config
=
self
.
createFile
(
config_file
,
self
.
substituteTemplate
(
self
.
getTemplateFilename
(
'redis.conf.in'
),
...
...
@@ -63,7 +68,8 @@ class Recipe(GenericBaseRecipe):
promise
=
self
.
createPythonScript
(
promise_script
,
'%s.promise.main'
%
__name__
,
dict
(
host
=
self
.
options
[
'ipv6'
],
port
=
self
.
options
[
'port'
])
dict
(
host
=
self
.
options
[
'ipv6'
],
port
=
self
.
options
[
'port'
],
unixsocket
=
self
.
options
.
get
(
'unixsocket'
)
)
)
path_list
.
append
(
promise
)
...
...
slapos/recipe/redis/promise.py
View file @
ec01997c
...
...
@@ -7,12 +7,14 @@ import sys
def
main
(
args
):
host
=
args
[
'host'
]
port
=
int
(
args
[
'port'
])
unixsocket
=
args
[
'unixsocket'
]
try
:
pool
=
redis
.
ConnectionPool
(
host
=
host
,
port
=
port
,
db
=
0
)
r
=
redis
.
Redis
(
connection_pool
=
pool
)
#pool = redis.ConnectionPool(host=host, port=port, unix_socket_path=unixsocket, db=0)
#r = redis.Redis(connection_pool=pool)
r
=
redis
.
Redis
(
host
=
host
,
port
=
port
,
unix_socket_path
=
unixsocket
,
db
=
0
)
r
.
publish
(
"Promise-Service"
,
"SlapOS Promise"
)
pool
.
disconnect
()
r
.
connection_
pool
.
disconnect
()
sys
.
exit
(
0
)
except
Exception
,
e
:
print
str
(
e
)
sys
.
exit
(
1
)
\ No newline at end of file
sys
.
exit
(
1
)
slapos/recipe/redis/template/redis.conf.in
View file @
ec01997c
...
...
@@ -72,9 +72,7 @@ bind %(ipv6)s
# Specify the path for the Unix socket that will be used to listen for
# incoming connections. There is no default, so Redis will not listen
# on a unix socket when not specified.
#
# unixsocket /tmp/redis.sock
# unixsocketperm 700
%(unixsocket)s
# Close the connection after a client is idle for N seconds (0 to disable)
timeout 0
...
...
software/gitlab/instance-gitlab.cfg.in
View file @
ec01997c
...
...
@@ -18,7 +18,7 @@ parts =
service-nginx
service-postgresql
#
service-redis
service-redis
# std stuff for slapos instance
...
...
@@ -69,38 +69,6 @@ recipe = slapos.cookbook:publish
url = ${gitlab-backend:url}
{#
# # TODO reintegrate postgresql/redis into this instance
# #################################
# # need: PostgreSQL instance #
# #################################
# [request-postgresql]
# <= slap-connection
# recipe = slapos.cookbook:request
# # TODO name = $(gitlab-name)/pgsql
# name = g-pgsql
# software-url = {{ urlparse.urljoin(software_release_url, '../postgres/software.cfg') }}
# return = url
#
# [postgresql-urlparse]
# recipe = slapos.cookbook:urlparse
# url = ${request-postgresql:connection-url}
#
#
# ############################
# # need: Redis instance #
# ############################
# [request-redis]
# <= slap-connection
# recipe = slapos.cookbook:request
# # TODO name = $(gitlab-name)/pgsql
# name = g-redis
# software-url = {{ urlparse.urljoin(software_release_url, '../redis-server/software.cfg') }}
# return = redis_ip redis_port
#}
#############################
# GitLab instance setup #
...
...
@@ -178,8 +146,8 @@ context =
[resque.yml]
<= gitlab-etc-template
template= {{ resque_yml_in }}
#
context =
# section redis request
-redis
context =
section redis service
-redis
[smtp_settings.rb]
<= gitlab-etc-template
...
...
@@ -338,7 +306,7 @@ command =
#recipe = slapos.cookbook:mkdirectory
#srv = ${directory:srv}/postgresql
# XXX etc - no
# XXX log
# XXX log
- goes to stdout/stderr
[postgresql-password]
recipe = slapos.cookbook:generate.password
...
...
@@ -361,20 +329,46 @@ superuser = gitlab
# TODO password
password= ...
# empty addresses - listn only on unix socket
pgdata-directory = ${directory:srv}/postgresql
# empty addresses - listen only on unix socket
ipv4 = !py!set([])
ipv6 = !py!set([])
ipv6-random =
port =
pgdata-directory = ${directory:srv}/postgresql
#############
# Redis #
#############
[redis]
recipe = slapos.cookbook:mkdirectory
srv = ${directory:srv}/redis
[service-redis]
recipe = slapos.cookbook:redis.server
server_bin = {{ redis_bin }}
server_dir = ${redis:srv}
config_file = ${directory:etc}/redis.conf
log_file = ${directory:log}/redis.log
pid_file = ${directory:run}/redis.pid
use_passwd = false
wrapper = ${directory:service}/redis
promise_wrapper = ${directory:promise}/redis
unixsocket = ${:server_dir}/redis.socket
# port = 0 means "don't listen on TCP at all" - listen only on unix socket
ipv6 = ::1
port = 0
######################
# Nginx frontend #
...
...
software/gitlab/instance.cfg.in
View file @
ec01997c
...
...
@@ -35,6 +35,7 @@ context =
raw nginx_bin ${nginx-output:nginx}
raw mime_types ${nginx-output:mime}
raw postgresql_location ${postgresql92:location}
raw redis_bin ${redis28:location}/bin/redis-server
raw macrolib_cfg_in ${macrolib.cfg.in:target}
raw gitlab_parameters_cfg ${gitlab-parameters.cfg:target}
...
...
software/gitlab/template/database.yml.in
View file @
ec01997c
...
...
@@ -8,6 +8,7 @@ production:
encoding: unicode
database: {{ pgsql.dbname }}
pool: 10
{# XXX is it ok to use superuser, even if the whole database is only for gitlab? #}
username: '{{ pgsql.superuser }}'
password:
host: '{{ pgsql["pgdata-directory"] }}'
...
...
software/gitlab/template/resque.yml.in
View file @
ec01997c
...
...
@@ -3,5 +3,4 @@
# https://gitlab.com/gitlab-org/gitlab-ce/blob/master/config/resque.yml.example
# https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-cookbooks/gitlab/templates/default/resque.yml.erb
{# production: redis://[{{ redis['connection-redis_ip'] }}]:{{ redis['connection-redis_port'] }} #}
production: redis://127.0.0.1:12345
production: unix://{{ redis.unixsocket }}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment