Skip to content
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

Merged
merged 41 commits into from
Oct 3, 2017
Merged

Deployment script #261

merged 41 commits into from
Oct 3, 2017

Conversation

fredkingham
Copy link
Contributor

No description provided.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 25adfce on deployment-script into ** on v0.2.5.1**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling d50490f on deployment-script into ** on v0.2.5.1**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 8d01756 on deployment-script into ** on v0.2.5.1**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 3f57d30 on deployment-script into ** on v0.2.5.1**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling aa8861d on deployment-script into ** on v0.2.5.1**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 639f1ce on deployment-script into ** on v0.2.5.1**.

Copy link
Member

@davidmiller davidmiller left a 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

@@ -0,0 +1 @@
0 2 * * * {{ unix_user }} {{ virtualenv }}/bin/fab -f {{ fabric_file }} copy_backup:{{ branch }}
Copy link
Member

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...

@@ -3,7 +3,7 @@
; =====================
Copy link
Member

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 ? :)

@@ -180,7 +180,7 @@
)

if 'test' in sys.argv:
INSTALLED_APPS += ('opal.tests',)
INSTALLED_APPS += ('opal.tests', 'fabric_tests',)
Copy link
Member

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}"
Copy link
Member

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)
Copy link
Member

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)
Copy link
Member

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)
Copy link
Member

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')
Copy link
Member

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)
Copy link
Member

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)
Copy link
Member

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? :)

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling ca67b78 on deployment-script into ** on v0.2.5.1**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 8edcc05 on deployment-script into ** on v0.2.5.1**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 4cb401e on deployment-script into ** on v0.2.5.1**.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.4%) to 84.876% when pulling 15b5ecc on deployment-script into a8ad005 on v0.2.5.1.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.4%) to 84.876% when pulling b9451c5 on deployment-script into a8ad005 on v0.2.5.1.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.4%) to 84.876% when pulling 4795dfe on deployment-script into a8ad005 on v0.2.5.1.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.4%) to 84.876% when pulling cf33a43 on deployment-script into a8ad005 on v0.2.5.1.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.4%) to 84.876% when pulling 1acda1e on deployment-script into a8ad005 on v0.2.5.1.

@davidmiller davidmiller merged commit 634d371 into v0.2.5.1 Oct 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants