Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Helios Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
Helios Server
Commits
9a4ed9f5
Commit
9a4ed9f5
authored
14 years ago
by
Ben Adida
Browse files
Options
Downloads
Patches
Plain Diff
updated fab file, almost ready
parent
f7da2664
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fabfile.py
+30
-8
30 additions, 8 deletions
fabfile.py
with
30 additions
and
8 deletions
fabfile.py
+
30
−
8
View file @
9a4ed9f5
...
...
@@ -5,14 +5,20 @@ A fabric deployment script for Helios that assumes the following:
- locally, development is /web/helios-server
- remotely, production is /web/production/helios-server
- remotely, staging is /web/staging/helios-server
- all of these directories are git checkouts that have a proper origin pointer
Deployment is git and tag based, so
Other assumptions that should probably change:
- both staging and production run under the same apache instance
Deployment is git and tag based, so:
fab staging_deploy:tag=v3.0.4,hosts=
"
vote.heliosvoting.org
"
fab production_deploy:tag=v3.0.5,hosts=
"
vote.heliosvoting.org
"
IMPORTANT: settings file may need to be tweaked manually
"""
from
fabric.api
import
local
,
settings
,
abort
,
cd
,
run
from
fabric.api
import
local
,
settings
,
abort
,
cd
,
run
,
sudo
from
fabric.contrib.console
import
confirm
STAGING_DIR
=
"
/web/staging/helios-server
"
...
...
@@ -34,16 +40,32 @@ def check_tag(tag, path):
abort
(
"
no remote tag %s
"
%
tag
)
def
checkout_tag
(
tag
,
path
):
pass
with
cd
(
path
):
result
=
run
(
'
git checkout %s
'
%
tag
)
if
result
.
failed
:
abort
(
"
on remote: could not check out tag %s
"
%
tag
)
def
migrate_db
(
path
):
pass
with
cd
(
path
):
result
=
run
(
'
python manage.py migrate
'
)
if
result
.
failed
:
abort
(
"
could not migrate
"
)
def
restart_apache
():
pass
result
=
sudo
(
'
/etc/init.d/apache2 restart
'
)
if
result
.
failed
:
abort
(
"
could not restart apache
"
)
def
deploy
_staging
(
tag
):
confirm
(
"
Ready to deploy %s to s
taging
?
"
%
tag
)
def
deploy
(
tag
,
path
):
confirm
(
"
Ready to deploy %s to
%
s?
"
%
(
tag
,
path
)
)
run_tests
()
check_tag
(
tag
,
path
=
STAGING_DIR
)
check_tag
(
tag
,
path
=
path
)
checkout_tag
(
tag
,
path
=
path
)
#migrate_db(path=path)
restart_apache
()
def
staging_deploy
(
tag
):
deploy
(
tag
,
path
=
STAGING_DIR
)
def
production_deploy
(
tag
):
deploy
(
tag
,
path
=
PRODUCTION_DIR
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment