Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
configuration
Commits
0ff01963
Commit
0ff01963
authored
Jan 21, 2014
by
Feanil Patel
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #654 from edx/feanil/pass_mongo
Feanil/pass mongo
parents
4bc3c22d
62d496d6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
23 deletions
+50
-23
playbooks/edx-east/forum.yml
+3
-0
playbooks/roles/nginx/defaults/main.yml
+1
-1
util/jenkins/stage_release.py
+10
-3
util/vpc-tools/abbey.py
+36
-19
No files found.
playbooks/edx-east/forum.yml
View file @
0ff01963
...
...
@@ -5,4 +5,7 @@
vars_files
:
-
[
"
{{
secure_vars
}}"
,
"
dummy.yml"
]
roles
:
-
role
:
nginx
nginx_sites
:
-
forum
-
forum
playbooks/roles/nginx/defaults/main.yml
View file @
0ff01963
...
...
@@ -24,7 +24,7 @@ nginx_sites_available_dir: "{{ nginx_app_dir }}/sites-available"
nginx_sites_enabled_dir
:
"
{{
nginx_app_dir
}}/sites-enabled"
nginx_user
:
root
nginx_htpasswd_file
:
"
{{
nginx_app_dir
}}/nginx.htpasswd"
nginx_default_sites
:
[]
nginx_debian_pkgs
:
-
nginx
-
python-passlib
...
...
util/jenkins/stage_release.py
View file @
0ff01963
...
...
@@ -83,7 +83,8 @@ def uri_from(doc_store_config):
def
prepare_release
(
args
):
config
=
yaml
.
safe_load
(
open
(
args
.
config
))
client
=
MongoClient
(
uri_from
(
config
[
'DOC_STORE_CONFIG'
]))
mongo_uri
=
uri_from
(
config
[
'DOC_STORE_CONFIG'
])
client
=
MongoClient
(
mongo_uri
)
db
=
client
[
config
[
'DOC_STORE_CONFIG'
][
'db'
]]
# Get configuration repo versions
...
...
@@ -152,7 +153,9 @@ def prepare_release(args):
release
[
'plays'
]
=
all_plays
release_coll
.
insert
(
release
)
# All plays that need new AMIs have been updated.
notify_abbey
(
config
[
'abbey_url'
],
config
[
'abbey_token'
],
args
.
deployment
,
all_plays
,
args
.
release_id
)
notify_abbey
(
config
[
'abbey_url'
],
config
[
'abbey_token'
],
args
.
deployment
,
all_plays
,
args
.
release_id
,
mongo_uri
,
config_repo_ver
,
config_secure_ver
)
def
ami_for
(
db
,
env
,
deployment
,
play
,
configuration
,
configuration_secure
,
ansible_vars
):
...
...
@@ -169,7 +172,8 @@ def ami_for(db, env, deployment, play, configuration,
return
db
.
amis
.
find_one
(
ami_signature
)
import
requests
def
notify_abbey
(
abbey_url
,
abbey_token
,
deployment
,
all_plays
,
release_id
):
def
notify_abbey
(
abbey_url
,
abbey_token
,
deployment
,
all_plays
,
release_id
,
mongo_uri
,
configuration_ref
,
configuration_secure_ref
):
for
play_name
,
play
in
all_plays
.
items
():
for
env
,
ami
in
play
[
'amis'
]
.
items
():
if
ami
is
None
:
...
...
@@ -179,6 +183,9 @@ def notify_abbey(abbey_url, abbey_token, deployment, all_plays, release_id):
params
.
append
({
'name'
:
'environment'
,
'value'
:
env
})
params
.
append
({
'name'
:
'vars'
,
'value'
:
yaml
.
dump
(
play
[
'vars'
],
default_flow_style
=
False
)})
params
.
append
({
'name'
:
'release_id'
,
'value'
:
release_id
})
params
.
append
({
'name'
:
'mongo_uri'
,
'value'
:
mongo_uri
})
params
.
append
({
'name'
:
'configuration'
,
'value'
:
configuration_ref
})
params
.
append
({
'name'
:
'configuration_secure'
,
'value'
:
configuration_secure_ref
})
build_params
=
{
'parameter'
:
params
}
log
.
info
(
"Need ami for {}"
.
format
(
pformat
(
build_params
)))
...
...
util/vpc-tools/abbey.py
View file @
0ff01963
...
...
@@ -71,19 +71,29 @@ class MongoConnection:
Adds the built AMI to the deployment
collection
"""
query
=
{
'_id'
:
args
.
jenkins_build
,
'plays'
:
{
args
.
play
:
{
'amis'
:
{},
},
},
}
update
=
query
.
copy
()
pprint
(
update
)
update
[
'plays'
][
args
.
play
][
'amis'
][
args
.
environment
]
=
ami
self
.
mongo_deployment
.
update
(
query
,
update
,
True
)
query
=
{
'_id'
:
args
.
jenkins_build
}
deployment
=
self
.
mongo_deployment
.
find_one
(
query
)
try
:
deployment
[
'plays'
][
args
.
play
][
'amis'
][
args
.
environment
]
=
ami
except
KeyError
as
e
:
msg
=
"Unexpected document structure, couldn't write "
+
\
"to path deployment['plays']['{}']['amis']['{}']"
print
msg
.
format
(
args
.
play
,
args
.
environment
)
pprint
(
deployment
)
if
args
.
noop
:
deployment
=
{
'plays'
:
{
args
.
play
:
{
'amis'
:
{
args
.
environment
:
ami
,
},
},
},
}
else
:
raise
self
.
mongo_deployment
.
save
(
deployment
)
class
Unbuffered
:
"""
...
...
@@ -174,7 +184,7 @@ def parse_args():
default
=
"test"
,
help
=
"Mongo database"
)
parser
.
add_argument
(
"--mongo-ami-collection"
,
required
=
False
,
default
=
"ami"
,
default
=
"ami
s
"
,
help
=
"Mongo ami collection"
)
parser
.
add_argument
(
"--mongo-deployment-collection"
,
required
=
False
,
default
=
"deployment"
,
...
...
@@ -247,8 +257,10 @@ $(curl http://169.254.169.254/latest/meta-data/local-ipv4 2>/dev/null)
instance_type=
\\
$(curl http://169.254.169.254/latest/meta-data/instance-type 2>/dev/null)
playbook_dir="$base_dir/configuration/playbooks/edx-east"
git_repo="https://github.com/edx/configuration"
git_repo_secure="git@github.com:edx/configuration-secure"
git_repo_name="configuration"
git_repo_secure_name="configuration-secure"
git_repo="https://github.com/edx/$git_repo_name"
git_repo_secure="git@github.com:edx/$git_repo_secure_name"
if $config_secure; then
git_cmd="env GIT_SSH=$git_ssh git"
...
...
@@ -298,14 +310,19 @@ EOF
chmod 400 $secure_identity
$git_cmd clone -b $configuration_version $git_repo
$git_cmd clone $git_repo $git_repo_name
cd $git_repo_name
$git_cmd checkout $configuration_version
cd $base_dir
if $config_secure; then
$git_cmd clone -b $configuration_secure_version
\\
$git_repo_secure
$git_cmd clone $git_repo_secure $git_repo_secure_name
cd $git_repo_secure_name
$git_cmd checkout $configuration_secure_version
cd $base_dir
fi
cd $base_dir/
configuration
cd $base_dir/
$git_repo_name
sudo pip install -r requirements.txt
cd $playbook_dir
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment