mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-05 13:14:46 +02:00
docker: enable user/password for RabbitMQ server
Add settings for user/password for the RabbitMQ server and make dockersetup.py set it up. (The rabbitmq container intrinsically understands RABBITMQ_DEFAULT_*, and for the sake of consistency I've reused those variables for the other containers.) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
dad461cd0f
commit
e78c4dae9c
|
@ -19,6 +19,8 @@ services:
|
|||
#- "SECRET_KEY=<set this here>"
|
||||
- "DATABASE_PASSWORD=testingpw"
|
||||
- "DATABASE_HOST=layersdb"
|
||||
- "RABBITMQ_DEFAULT_USER=guest"
|
||||
- "RABBITMQ_DEFAULT_PASS=guest"
|
||||
#- "EMAIL_HOST=<set this here>"
|
||||
#- "DEBUG=1"
|
||||
container_name: layersapp
|
||||
|
@ -44,6 +46,9 @@ services:
|
|||
layersrabbit:
|
||||
image: rabbitmq:alpine
|
||||
container_name: layersrabbit
|
||||
environment:
|
||||
- "RABBITMQ_DEFAULT_USER=guest"
|
||||
- "RABBITMQ_DEFAULT_PASS=guest"
|
||||
layerscelery:
|
||||
depends_on:
|
||||
- layersdb
|
||||
|
@ -56,6 +61,8 @@ services:
|
|||
#- "SECRET_KEY=<set this here>"
|
||||
- "DATABASE_PASSWORD=testingpw"
|
||||
- "DATABASE_HOST=layersdb"
|
||||
- "RABBITMQ_DEFAULT_USER=guest"
|
||||
- "RABBITMQ_DEFAULT_PASS=guest"
|
||||
#- "EMAIL_HOST=<set this here>"
|
||||
#- "DEBUG=1"
|
||||
container_name: layerscelery
|
||||
|
|
|
@ -260,7 +260,7 @@ SUBMIT_EMAIL_SUBJECT = 'OE Layerindex layer submission'
|
|||
SEND_PUBLISH_EMAIL = True
|
||||
|
||||
# RabbitMQ settings
|
||||
RABBIT_BROKER = 'amqp://guest:guest@layersrabbit:5672/'
|
||||
RABBIT_BROKER = 'amqp://' + os.getenv('RABBITMQ_DEFAULT_USER') + ':' + os.getenv('RABBITMQ_DEFAULT_PASS') + '@layersrabbit:5672/'
|
||||
RABBIT_BACKEND = 'rpc://layersrabbit/'
|
||||
|
||||
# Used for fetching repo
|
||||
|
|
|
@ -137,7 +137,7 @@ def yaml_comment(line):
|
|||
|
||||
|
||||
# Add hostname, secret key, db info, and email host in docker-compose.yml
|
||||
def edit_dockercompose(hostname, dbpassword, secretkey, portmapping, letsencrypt):
|
||||
def edit_dockercompose(hostname, dbpassword, secretkey, rmqpassword, portmapping, letsencrypt):
|
||||
filedata= readfile("docker-compose.yml")
|
||||
in_layersweb = False
|
||||
in_layersweb_ports = False
|
||||
|
@ -192,6 +192,12 @@ def edit_dockercompose(hostname, dbpassword, secretkey, portmapping, letsencrypt
|
|||
elif '- "MYSQL_ROOT_PASSWORD' in line:
|
||||
format = line[0:line.find('- "MYSQL_ROOT_PASSWORD')].replace("#", "")
|
||||
newlines.append(format + '- "MYSQL_ROOT_PASSWORD=' + dbpassword + '"\n')
|
||||
elif '- "RABBITMQ_DEFAULT_USER' in line:
|
||||
format = line[0:line.find('- "RABBITMQ_DEFAULT_USER')].replace("#", "")
|
||||
newlines.append(format + '- "RABBITMQ_DEFAULT_USER=layermq"\n')
|
||||
elif '- "RABBITMQ_DEFAULT_PASS' in line:
|
||||
format = line[0:line.find('- "RABBITMQ_DEFAULT_PASS')].replace("#", "")
|
||||
newlines.append(format + '- "RABBITMQ_DEFAULT_PASS=' + rmqpassword + '"\n')
|
||||
elif "ports:" in line:
|
||||
if in_layersweb:
|
||||
in_layersweb_ports = True
|
||||
|
@ -263,6 +269,7 @@ def writefile(filename, data):
|
|||
# Generate secret key and database password
|
||||
secretkey = generatepasswords(50)
|
||||
dbpassword = generatepasswords(10)
|
||||
rmqpassword = generatepasswords(10)
|
||||
|
||||
## Get user arguments and modify config files
|
||||
hostname, http_proxy, https_proxy, dbfile, port, proxymod, portmapping, no_https, cert, cert_key, letsencrypt = get_args()
|
||||
|
@ -307,7 +314,7 @@ if http_proxy:
|
|||
if http_proxy or https_proxy:
|
||||
edit_dockerfile(http_proxy, https_proxy)
|
||||
|
||||
edit_dockercompose(hostname, dbpassword, secretkey, portmapping, letsencrypt)
|
||||
edit_dockercompose(hostname, dbpassword, secretkey, rmqpassword, portmapping, letsencrypt)
|
||||
|
||||
edit_dockerfile_web(hostname, no_https)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user