-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deployment script #261
Deployment script #261
Conversation
…red upstart, change the supervisord restart command
Changes Unknown when pulling 25adfce on deployment-script into ** on v0.2.5.1**. |
Changes Unknown when pulling d50490f on deployment-script into ** on v0.2.5.1**. |
Changes Unknown when pulling 8d01756 on deployment-script into ** on v0.2.5.1**. |
Changes Unknown when pulling 3f57d30 on deployment-script into ** on v0.2.5.1**. |
Changes Unknown when pulling aa8861d on deployment-script into ** on v0.2.5.1**. |
Changes Unknown when pulling 639f1ce on deployment-script into ** on v0.2.5.1**. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a lot of comments... (Because it is a lot ;)
I think I'd quite like a 'rollback to branch' command that for an existing deployment environment will just make that the one actively deployed, stopping supervisor/gunicorn, starting the named one, and replacing cron, upstart etc...
So that if I decide to abort a deployment I can do e.g.
fab rollback 0.4
conf_templates/cron_copy.jinja2
Outdated
@@ -0,0 +1 @@ | |||
0 2 * * * {{ unix_user }} {{ virtualenv }}/bin/fab -f {{ fabric_file }} copy_backup:{{ branch }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you know that this deterministically runs after today's database backup ?
Also, worth redirecting stdout and error to a log file...
conf_templates/gunicorn.conf.jinja2
Outdated
@@ -3,7 +3,7 @@ | |||
; ===================== |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come we're putting these in conf_templates as a top level directory?
We now have at the top level:
./config
./conf_templates
./etc
./fabric_tests
Maybe that's too many sysadminy / deploymenty directories at the top level ? :)
elcid/settings.py
Outdated
@@ -180,7 +180,7 @@ | |||
) | |||
|
|||
if 'test' in sys.argv: | |||
INSTALLED_APPS += ('opal.tests',) | |||
INSTALLED_APPS += ('opal.tests', 'fabric_tests',) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't these go in ./elcid/test/ or ./elcid/test/fabric ?
fabfile.py
Outdated
DB_USER = "ohc" | ||
RELEASE_NAME = "elcidrfh-{branch}" | ||
|
||
VIRTUAL_ENV_PATH = "/home/{usr}/.virtualenvs/{release_name}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we name the inline variable unix_user
like the one below?
fabfile.py
Outdated
for db_command in db_commands(username): | ||
local(db_command) | ||
def create_empty_env(new_branch): | ||
_deploy(new_branch) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this now also restart the supervisord/gunicorn processes in the new environment if it just calls _deploy?
services_symlink_upstart(new_env) | ||
|
||
# django setup | ||
run_management_command("collectstatic --noinput", new_env) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to check that these haven't failed?
cmd = "{0}/bin/python manage.py {1}".format( | ||
env.virtual_env_path, some_command | ||
) | ||
result = local(cmd, capture=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does capture=True mean that stdout/err are available on result
? Do they also get printed to the terminal?
fabfile.py
Outdated
|
||
|
||
def restart_nginx(): | ||
local('sudo /etc/init.d/nginx restart') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not service nginx
?
env.host_string = private_settings["host_string"] | ||
|
||
# Setup environment | ||
pip_create_virtual_env(new_env) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I want print to stdout as we perform each of these tasks somehow - either here or inside the functions...
fabfile.py
Outdated
_deploy(new_branch, old_env.release_backup_name) | ||
new_status = run_management_command("status_report", new_env) | ||
|
||
print("=" * 20) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that we're expected to eyeball these?
Can't we have a compare function so that a computer can test for equivalence? :)
Changes Unknown when pulling ca67b78 on deployment-script into ** on v0.2.5.1**. |
Changes Unknown when pulling 8edcc05 on deployment-script into ** on v0.2.5.1**. |
Changes Unknown when pulling 4cb401e on deployment-script into ** on v0.2.5.1**. |
…t testing it at least once.
No description provided.