fixed conf_setup backup so it has proper values it was using ' and " too much

modified:   modules/conf_setup.py
	modified:   share/templates/meta/development.yml
	modified:   share/templates/meta/layout.yml
	modified:   share/templates/meta/staging.yml
This commit is contained in:
Ronny Abraham 2016-09-15 20:36:20 +03:00
parent 12c57354f7
commit 596b6e7da3
4 changed files with 36 additions and 39 deletions

View file

@ -118,58 +118,58 @@ def _modify_configuration(branch):
branch = config_yaml['project']['branch'] branch = config_yaml['project']['branch']
config_yaml['project']['name'] = "\"PROJECT_NAME\"" config_yaml['project']['name'] = 'PROJECT_NAME'
# we don't use 'paths/home' in anything other than dev # we don't use 'paths/home' in anything other than dev
if branch == 'development': if branch == 'development':
config_yaml['project']['paths']['home'] = "\"PROJECT_NAME.prj\"" config_yaml['project']['paths']['home'] = 'PROJECT_NAME.prj'
config_yaml['project']['user'] = '"BRANCH_USER"' config_yaml['project']['user'] = 'BRANCH_USER'
config_yaml['project']['group'] = '"BRANCH_GROUP"' config_yaml['project']['group'] = 'BRANCH_GROUP'
config_yaml['project']['extension'] = '"BRANCH_NAME"' config_yaml['project']['extension'] = 'BRANCH_EXT'
if config_yaml['project']['host'] != 'localhost': if config_yaml['project']['host'] != 'localhost':
config_yaml['project']['host'] = '"PROJECT_IP"' config_yaml['project']['host'] = 'PROJECT_IP'
# #
# database configuration # database configuration
config_yaml['database']['name'] = '"PROJECT_NAME_{{branch}}"'.format( config_yaml['database']['name'] = "PROJECT_NAME_{branch}".format(
branch=config_yaml['project']['extension']) branch=config_yaml['project']['extension'])
if config_yaml['database']['host'] == "docker": if config_yaml['database']['host'] == "docker":
config_yaml['database']['port'] = '"DOCKER_PORT"' config_yaml['database']['port'] = 'DOCKER_PORT'
else: else:
config_yaml['database']['host'] = '"DATABASE_IP"' config_yaml['database']['host'] = 'DATABASE_IP'
# #
# database user name values # database user name values
config_yaml['database']['users']['admin']['name'] = \ config_yaml['database']['users']['admin']['name'] = \
'"DATABASE_ADMIN_NAME"' 'DATABASE_ADMIN_NAME'
config_yaml['database']['users']['admin']['pass'] = \ config_yaml['database']['users']['admin']['pass'] = \
'"DATABASE_ADMIN_PASS"' 'DATABASE_ADMIN_PASS'
config_yaml['database']['users']['default']['name'] = \ config_yaml['database']['users']['default']['name'] = \
'"DATABASE_USER_NAME"' 'DATABASE_USER_NAME'
config_yaml['database']['users']['default']['pass'] = \ config_yaml['database']['users']['default']['pass'] = \
'"DATABASE_USER_PASS"' 'DATABASE_USER_PASS'
# #
# django configuration # django configuration
config_yaml['django']['port'] = '"DJANGO_PORT"' config_yaml['django']['port'] = 'DJANGO_PORT'
config_yaml['django']['host'] = '"DJANGO_IP"' config_yaml['django']['host'] = 'DJANGO_IP'
# #
# nginx and virtualenv configuration # nginx and virtualenv configuration
config_yaml['nginx']['port'] = '"NGINX_PORT"' config_yaml['nginx']['port'] = 'NGINX_PORT'
if hasattr(config_yaml['virtualenv'], 'name'): if hasattr(config_yaml['virtualenv'], 'name'):
config_yaml['virtualenv']['name'] = '"PROJECT_NAME"' config_yaml['virtualenv']['name'] = 'PROJECT_NAME'
return config_yaml return config_yaml

View file

@ -1,7 +1,7 @@
database: database:
backend: postgresql_psycopg2 backend: postgresql_psycopg2
host: docker host: docker
name: PROJECT_NAME_dev name: PROJECT_NAME_BRANCH_EXT
port: DOCKER_PORT port: DOCKER_PORT
users: users:
admin: {name: DATABASE_ADMIN_NAME, pass: DATABASE_ADMIN_PASS} admin: {name: DATABASE_ADMIN_NAME, pass: DATABASE_ADMIN_PASS}
@ -35,7 +35,7 @@ nginx:
overrides: [null] overrides: [null]
project: project:
branch: development branch: development
extension: dev extension: BRANCH_EXT
group: BRANCH_GROUP group: BRANCH_GROUP
host: localhost host: localhost
name: PROJECT_NAME name: PROJECT_NAME
@ -45,4 +45,4 @@ project:
rootpath: /usr/local/var/www rootpath: /usr/local/var/www
supervisor: supervisor:
paths: {conf: /usr/local/etc/supervisor/conf.d} paths: {conf: /usr/local/etc/supervisor/conf.d}
virtualenv: {name: PROJECT_NAME, workon: /Users/ronny/.virtualenvs} virtualenv: {name: debates_eu, workon: /Users/ronny/.virtualenvs}

View file

@ -14,9 +14,9 @@ paths:
fabric: fabric:
root: "scripts/tools/fabric" root: "scripts/tools/fabric"
templates: templates:
conf: "templates/conf" conf: "share/templates/conf"
meta: "templates/meta" meta: "share/templates/meta"
readmes: "templates/readmes" readmes: "share/templates/readmes"
backups: backups:
root: "backups" root: "backups"

View file

@ -1,20 +1,8 @@
project:
name: PROJECT_NAME
branch: BRANCH_NAME
extension: BRANCH_EXT
host: PROJECT_IP
paths: {root: /home/website}
user: BRANCH_USER
group: BRANCH_GROUP
sudo: true
database: database:
port: 5432
name: PROJECT_NAME_BRANCH_EXT
host: DATABASE_IP
backend: postgresql_psycopg2 backend: postgresql_psycopg2
host: DATABASE_IP
name: PROJECT_NAME_BRANCH_EXT
port: 5432
users: users:
admin: {name: DATABASE_ADMIN_NAME, pass: DATABASE_ADMIN_PASS} admin: {name: DATABASE_ADMIN_NAME, pass: DATABASE_ADMIN_PASS}
default: {name: DATABASE_USER_NAME, pass: DATABASE_USER_PASS} default: {name: DATABASE_USER_NAME, pass: DATABASE_USER_PASS}
@ -37,6 +25,15 @@ nginx:
paths: {available: sites-available, enabled: sites-enabled, root: /etc/nginx} paths: {available: sites-available, enabled: sites-enabled, root: /etc/nginx}
port: NGINX_PORT port: NGINX_PORT
overrides: [null] overrides: [null]
project:
branch: staging
extension: BRANCH_EXT
group: BRANCH_GROUP
host: PROJECT_IP
name: PROJECT_NAME
paths: {root: /home/website}
sudo: true
user: BRANCH_USER
rootpath: /var/www rootpath: /var/www
supervisor: supervisor:
paths: {conf: /etc/supervisor/conf.d} paths: {conf: /etc/supervisor/conf.d}
@ -48,4 +45,4 @@ templates:
conf: {output: nginx.conf, source: unixsocket.jinja2} conf: {output: nginx.conf, source: unixsocket.jinja2}
file: unixsocket.jinja2 file: unixsocket.jinja2
path: scripts/conf/nginx path: scripts/conf/nginx
virtualenv: {name: PROJECT_NAME, workon: /home/website/.virtualenvs} virtualenv: {workon: /home/website/.virtualenvs}