Merge pull request #78 from EbookFoundation/jk/ansible-mysql-connector

Fix database hostname and add deploy guide
newfoundation
John Kelly 2018-05-15 21:24:04 -04:00 committed by GitHub
commit e79eace9d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 153 additions and 2087 deletions

4
.gitignore vendored
View File

@ -15,5 +15,5 @@ cache/*
celerybeat.pid
celerybeat-schedule
.gitignore~
static/scss/**/*.css.map
static/scss/**/*.css.map
*.retry

View File

@ -0,0 +1,46 @@
# Deploying Regluit to Production
The current provisioning setup uses [Ansible](https://www.ansible.com/resources/get-started) to deploy code to production servers.
## Pre-requisites
Before attempting to deploy, ensure you have done the following:
1. Install `ansible` on your local machine
1. Obtain the `ansible-vault` password and save it to a file
1. Set the path to the `ansible-vault` file via environment variable e.g. `export NSIBLE_VAULT_PASSWORD_FILE=[path]`
1. Create/obtain the secret key needed to SSH into the server
1. (optional) Add the secret key to your ssh agent
```
$ ssh-agent bash
$ ssh-add /path/to/secret.pem
```
## Deploy
Deploying is as simple as running the `setup-prod` ansible playbook.
Navigate to the `provisioning/` directory and run the following:
```
$ ansible-playbook -i hosts setup-prod.yml
```
If you successfully completed all the pre-requisite steps, the playbook should begin running through deploy tasks and finally restart apache.
## Additional Configuration
### Variables and Secrets
The necessary variables are pulled from `provisioning/group_vars/production/vars.yml` which in turn pulls certain secret values from `vault.yml`.
The variables are split into two files to still allow for searching references in playbook tasks.
To add or view secret values, you must decrypt the file first: `$ ansible-vault decrypt vault.yml` however **always remember to encrypt secret files before pushing to git**. This is done in a similar manner: `$ ansible-vault encrypt vault.yml`.
Ansible also allows for overriding variables from the command line when running playbooks.
This is useful for ad-hoc playbook runs without editing var files.
For example, deploying code from another branch can be done as so:
`$ ansible-playbook -i hosts setup-prod.yml -e git_branch=mybranch`
### Inventory and Groups
Currently we are using a static inventory file `hosts` to define target server hosts and groups.
This means that the `hosts` file must be manually updated to reflect things such as DNS changes or additional hosts being added.
In the future, the static inventory file may be replaced with a dynamic inventory solution, such as ansible's [ec2 inventory script](http://docs.ansible.com/ansible/latest/user_guide/intro_dynamic_inventory.html#example-aws-ec2-external-inventory-script)
One important aspect of the `hosts` file is that it defines the groups which a host or hosts are a part of.
Currently, there is only one prod host called `regluit-prod` which is a member of the `production` group.
Both of these designations are important, as the `setup-prod` playbook specifically targets the `regluit-prod` host, and only that host will inherit the variables in `group_vars/production/`.

View File

@ -1,219 +0,0 @@
# Ansible EC2 external inventory script settings
#
[ec2]
# to talk to a private eucalyptus instance uncomment these lines
# and edit edit eucalyptus_host to be the host name of your cloud controller
#eucalyptus = True
#eucalyptus_host = clc.cloud.domain.org
# AWS regions to make calls to. Set this to 'all' to make request to all regions
# in AWS and merge the results together. Alternatively, set this to a comma
# separated list of regions. E.g. 'us-east-1,us-west-1,us-west-2' and do not
# provide the 'regions_exclude' option. If this is set to 'auto', AWS_REGION or
# AWS_DEFAULT_REGION environment variable will be read to determine the region.
regions = all
regions_exclude = us-gov-west-1, cn-north-1
# When generating inventory, Ansible needs to know how to address a server.
# Each EC2 instance has a lot of variables associated with it. Here is the list:
# http://docs.pythonboto.org/en/latest/ref/ec2.html#module-boto.ec2.instance
# Below are 2 variables that are used as the address of a server:
# - destination_variable
# - vpc_destination_variable
# This is the normal destination variable to use. If you are running Ansible
# from outside EC2, then 'public_dns_name' makes the most sense. If you are
# running Ansible from within EC2, then perhaps you want to use the internal
# address, and should set this to 'private_dns_name'. The key of an EC2 tag
# may optionally be used; however the boto instance variables hold precedence
# in the event of a collision.
destination_variable = public_dns_name
# This allows you to override the inventory_name with an ec2 variable, instead
# of using the destination_variable above. Addressing (aka ansible_ssh_host)
# will still use destination_variable. Tags should be written as 'tag_TAGNAME'.
#hostname_variable = tag_Name
# For server inside a VPC, using DNS names may not make sense. When an instance
# has 'subnet_id' set, this variable is used. If the subnet is public, setting
# this to 'ip_address' will return the public IP address. For instances in a
# private subnet, this should be set to 'private_ip_address', and Ansible must
# be run from within EC2. The key of an EC2 tag may optionally be used; however
# the boto instance variables hold precedence in the event of a collision.
# WARNING: - instances that are in the private vpc, _without_ public ip address
# will not be listed in the inventory until You set:
# vpc_destination_variable = private_ip_address
vpc_destination_variable = ip_address
# The following two settings allow flexible ansible host naming based on a
# python format string and a comma-separated list of ec2 tags. Note that:
#
# 1) If the tags referenced are not present for some instances, empty strings
# will be substituted in the format string.
# 2) This overrides both destination_variable and vpc_destination_variable.
#
#destination_format = {0}.{1}.example.com
#destination_format_tags = Name,environment
# To tag instances on EC2 with the resource records that point to them from
# Route53, set 'route53' to True.
route53 = False
# To use Route53 records as the inventory hostnames, uncomment and set
# to equal the domain name you wish to use. You must also have 'route53' (above)
# set to True.
# route53_hostnames = .example.com
# To exclude RDS instances from the inventory, uncomment and set to False.
#rds = False
# To exclude ElastiCache instances from the inventory, uncomment and set to False.
#elasticache = False
# Additionally, you can specify the list of zones to exclude looking up in
# 'route53_excluded_zones' as a comma-separated list.
# route53_excluded_zones = samplezone1.com, samplezone2.com
# By default, only EC2 instances in the 'running' state are returned. Set
# 'all_instances' to True to return all instances regardless of state.
all_instances = False
# By default, only EC2 instances in the 'running' state are returned. Specify
# EC2 instance states to return as a comma-separated list. This
# option is overridden when 'all_instances' is True.
# instance_states = pending, running, shutting-down, terminated, stopping, stopped
# By default, only RDS instances in the 'available' state are returned. Set
# 'all_rds_instances' to True return all RDS instances regardless of state.
all_rds_instances = False
# Include RDS cluster information (Aurora etc.)
include_rds_clusters = False
# By default, only ElastiCache clusters and nodes in the 'available' state
# are returned. Set 'all_elasticache_clusters' and/or 'all_elastic_nodes'
# to True return all ElastiCache clusters and nodes, regardless of state.
#
# Note that all_elasticache_nodes only applies to listed clusters. That means
# if you set all_elastic_clusters to false, no node will be return from
# unavailable clusters, regardless of the state and to what you set for
# all_elasticache_nodes.
all_elasticache_replication_groups = False
all_elasticache_clusters = False
all_elasticache_nodes = False
# API calls to EC2 are slow. For this reason, we cache the results of an API
# call. Set this to the path you want cache files to be written to. Two files
# will be written to this directory:
# - ansible-ec2.cache
# - ansible-ec2.index
cache_path = ~/.ansible/tmp
# The number of seconds a cache file is considered valid. After this many
# seconds, a new API call will be made, and the cache file will be updated.
# To disable the cache, set this value to 0
cache_max_age = 300
# Organize groups into a nested/hierarchy instead of a flat namespace.
nested_groups = False
# Replace - tags when creating groups to avoid issues with ansible
replace_dash_in_groups = True
# If set to true, any tag of the form "a,b,c" is expanded into a list
# and the results are used to create additional tag_* inventory groups.
expand_csv_tags = False
# The EC2 inventory output can become very large. To manage its size,
# configure which groups should be created.
group_by_instance_id = True
group_by_region = True
group_by_availability_zone = True
group_by_aws_account = False
group_by_ami_id = True
group_by_instance_type = True
group_by_instance_state = False
group_by_platform = True
group_by_key_pair = True
group_by_vpc_id = True
group_by_security_group = True
group_by_tag_keys = True
group_by_tag_none = True
group_by_route53_names = True
group_by_rds_engine = True
group_by_rds_parameter_group = True
group_by_elasticache_engine = True
group_by_elasticache_cluster = True
group_by_elasticache_parameter_group = True
group_by_elasticache_replication_group = True
# If you only want to include hosts that match a certain regular expression
# pattern_include = staging-*
# If you want to exclude any hosts that match a certain regular expression
# pattern_exclude = staging-*
# Instance filters can be used to control which instances are retrieved for
# inventory. For the full list of possible filters, please read the EC2 API
# docs: http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeInstances.html#query-DescribeInstances-filters
# Filters are key/value pairs separated by '=', to list multiple filters use
# a list separated by commas. To "AND" criteria together, use "&". Note that
# the "AND" is not useful along with stack_filters and so such usage is not allowed.
# See examples below.
# If you want to apply multiple filters simultaneously, set stack_filters to
# True. Default behaviour is to combine the results of all filters. Stacking
# allows the use of multiple conditions to filter down, for example by
# environment and type of host.
stack_filters = False
# Retrieve only instances with (key=value) env=staging tag
# instance_filters = tag:env=staging
# Retrieve only instances with role=webservers OR role=dbservers tag
# instance_filters = tag:role=webservers,tag:role=dbservers
# Retrieve only t1.micro instances OR instances with tag env=staging
# instance_filters = instance-type=t1.micro,tag:env=staging
# You can use wildcards in filter values also. Below will list instances which
# tag Name value matches webservers1*
# (ex. webservers15, webservers1a, webservers123 etc)
# instance_filters = tag:Name=webservers1*
# Retrieve only instances of type t1.micro that also have tag env=stage
# instance_filters = instance-type=t1.micro&tag:env=stage
# Retrieve instances of type t1.micro AND tag env=stage, as well as any instance
# that are of type m3.large, regardless of env tag
# instance_filters = instance-type=t1.micro&tag:env=stage,instance-type=m3.large
# An IAM role can be assumed, so all requests are run as that role.
# This can be useful for connecting across different accounts, or to limit user
# access
# iam_role = role-arn
# A boto configuration profile may be used to separate out credentials
# see http://boto.readthedocs.org/en/latest/boto_config_tut.html
# boto_profile = some-boto-profile-name
[credentials]
# The AWS credentials can optionally be specified here. Credentials specified
# here are ignored if the environment variable AWS_ACCESS_KEY_ID or
# AWS_PROFILE is set, or if the boto_profile property above is set.
#
# Supplying AWS credentials here is not recommended, as it introduces
# non-trivial security concerns. When going down this route, please make sure
# to set access permissions for this file correctly, e.g. handle it the same
# way as you would a private SSH key.
#
# Unlike the boto and AWS configure files, this section does not support
# profiles.
#
# aws_access_key_id = AXXXXXXXXXXXXXX
# aws_secret_access_key = XXXXXXXXXXXXXXXXXXX
# aws_security_token = XXXXXXXXXXXXXXXXXXXXXXXXXXXX

File diff suppressed because it is too large Load Diff

View File

@ -8,21 +8,19 @@ django_settings_module: "regluit.settings.prod"
virtualenv_name: "venv"
user_name: "ubuntu"
server_name: "m.unglue.it"
wsgi_home: "/opt/regluit/venv"
wsgi_python_path: "/opt/regluit/venv/bin/python"
# Branch to checkout
repo_version: "newfoundation"
git_repo: "https://github.com/EbookFoundation/regluit.git"
git_branch: "master"
### Variables in settings.prod.py ###
mysql_db_name: "regluit"
mysql_db_user: "regluit"
mysql_db_pass: "password123"
mysql_db_host: "localhost"
mysql_db_port: 3306
mysql_db_name: "{{ vault_mysql_db_name }}"
mysql_db_user: "{{ vault_mysql_db_user }}"
mysql_db_pass: "{{ vault_mysql_db_pass }}"
mysql_db_host: "{{ vault_mysql_db_host }}"
mysql_db_port: ""
email_host: "{{ vault_email_host }}"
email_port: "{{ vault_email_port }}"
email_port: 465
default_from_email: "notices@gluejar.com"
broker_transport: "redis"
broker_host: "127.0.0.1"

View File

@ -1,92 +1,90 @@
$ANSIBLE_VAULT;1.1;AES256
36653766626632633437383061323964393266313432373930623833333534336239323666336565
3565323337323164646362303335353830646330666130300a366661323362356164343366613265
35383637336431323965373730653539356530643839373866663330373066313337616330653966
3939363433663434620a323761336338393463303230363931366130393866653462383561343234
65383838626238366239326665306237373632666635653533333330643738326235643335663932
33643238613365636233383437663262663466333463353938316166626130373663323864393665
39646639393832383133373166373539343563343363633261646362373530643161646563396336
35336362653339656231376166356463666361336437636431636663633530623036656131663035
61656631626637313837646434356363373931336130626336363964656434366636616432303031
63366532343463663732353330613264633734366162326631356631616161303238323062613035
31373532646437316130333461636538333166346237323561323633333363373038323564316262
30666666663966313332313561373236666636363366313631343730376362393833663739343630
61313133393631323534623962633830343766316566613039323263643436626665393462626531
34366232656535316533363234383466663335346465386333383563626131383032346434653639
35656663613163383262643661306635633733336261613739316232636334373965353261663333
61333338623039343166333339613464656663643765643236353561626331643134363661393631
33343134376161333230326261656531386635643165653966393631636361663631353639353036
64393336643364333239333830333166626638643031666237383466623563653336613763336434
37383137643264616162373138313431393534376633333938383161663736633236303631666365
30383430326430613131353839376162363839636364363865376231336336386232353333656135
31336231366236386532633563663432383334336563323862393330343133346135336332303832
38386232303036656164363963623363393063353437363031623638386336373363623765393636
31303230666136366164623835366463316436363633303563386533623431313035323564626164
38353166333038633634396534363137626536623862376231643332633762383065613161343538
62646565396530623931653031626331383163333332373637393661353236396662363133326637
35623531366239363336313164623035353339623265323734393437336137366330396362623664
33366639666161373666663035373537656364313534663137316165363862623630643933353437
31303131353063656139366466376564393230613235396333343230313639353734343731376333
38636235306535316361663433333462383637633435306432623833396435356263663235373262
64316462383064653733396633376564646665343432616231646332393032383463656263376338
64303836366236613865353137366333643334313764383538633832363532346334663734633130
65333664666163363838613063663139306435613038653133396363353532343865376462393835
61366539383731613430636132306130626466306334343035646436336230376434383633326436
36343338653961613566636230326665653733666139303537623531363439613931316331633131
63663234663664343031326462326464393532363364383332626263616132386434333665303132
36336332633030313061666637643532393833353465656531663939636538623864316561353266
36366162343962383964396163653865633164363262373833383931373537623865373466626666
66613466623734633131626161356136363864656366346437393638306431623531306133643861
66303066633566653733386466326635303463383262626664643162323839323239303661316330
37393634346166633730393038636234326338386565613461656636343837393934303666633836
37663061633761636361316562383733623265373863363066383634356633383132623366643237
37623430643933393663353130613933396331363336626530383364373432613436333633646537
37643231353364333962616138386239366634356430303637323466346662633965346365653935
32303763363631653037666634366165363739373436356562396565363438386538353730366634
61613262633134323735353165363738336363626136306665613530306532386565336537303137
30653364626233663165316263633466326638313166383539306437396139343863656337663161
66303036326264353637646330323230616264343034303630323334363632353963303739383262
33396331306631323065363334323633623461613934633932303962333965653564313164376530
35613539376434373265663563326436653439323866326235313562643239303237373931656363
64306533396261626562323838613236623031353932383638636565323035623566383063313663
38656665663065346136666433373361373562626233333863633964346535366234643430336135
61613439303030663339363436343462373531356165366433303437613961376137326236333139
36336238376261336538663933306539313737333033633039626230336336383165346664323565
64626334656663396462396134313634333362363537663566663137363863636434366361306364
64316563616135616264316431396365353037316433313364653461616466303563626461353633
63346238383964333533386264613637663865373833656334303938663661613035356335663036
62326630646330396135313931366631323362653031623034623239386162383663376135653537
38336165376365666166623937663930653636666230323565653966303361393436373637623833
35663333613531623837336663373863616431343434373337626230646261366333666232626263
36393130303739363834643737383532626536623662356539373264363730396639643864633931
37313038343732653731383262353637386464396435356561656137613835656465306464626436
66383837376236363965666237396534376566623536393437633031336461393666336466613962
62656337356331366233316537626665633264666637633433303130653736343033313830326131
31396531356139653466376661663961626637316130316661653963653938646362343862653136
62303664623938313863636238636532376566303863633861663035333834303966636263636532
64386539643230366139303961326230633366336534656536323463313366626137353261666539
30333265653361643230643337616131663339373630663464656438373434363431356661343131
37386435633137316538623964643731643936643562656565386164653032356530353166316437
34346637336430373566366232323166386132383962616165633239366237646238366236343862
34633733396635333762616436656365346232393637366630386634376636366531363535633032
35303232636239663734396632363163366133396237646661346466303464323937323164663838
35376661643662343932316635356631653865633765663035396366396666353965646365396236
66633162323830653162306339383437363463663130633531336662303162663861323337396133
36646363323438313337313031623330323230313063373634366162653533646365353864336233
65653335333436316363393866303763353365386333326662353166333230316336353761343833
32376435376237303966366230396232303236626361366637323666303732303934643231373630
62313563633865336532616438396562363337306332643236333861616162353761666162636262
63393464353166633666366466616465323531396366303337306262653339373435633135613436
65323062623361326465313636663732346665323261383730313131636130626566363433623733
62656637353564336237333139303338396262306462643337316163356638356365343838643030
62613538363765613638643439333034653830653464663364613464346339643136353239393263
33333766363137306365616230343963646338353263663964653739663239646232666233306339
65336366306139363038333034313364633637366133303931613030313733343966323161353563
62306134626166633339336139393630336166666637373364643037343232333035353830346136
38623139326536386130363034333831393961316261643531313335316261396266666561356633
31366636343733616230306563666239643134666363343831363731663439396234656365363535
66363935356633303166316635663239313338333335623931663234616334373536616634363739
62343739353733336663336535376161376132326462306166353963303030633764343663646261
36376131663764313339316330316638653331376139616635363461623036386434373564323334
63336465623166343261363262636665363838383866393234343631663136303265313430386432
616437326539303165323962636534633063
35613232373661333630323135393138313263623531323030656532643831313832373766393635
3737383265653238663165613563396162613961353532320a363562386230383432646265323563
61313039646366633965653136353264663236356333653265386336386437343832386131333362
3432663165313436390a356633616663383135393232613833663433376239366666336532353066
66306530333030366339636232333164346136393166636434343130646164316135306633363933
37316434376238363963636237393932343065633737383139366465306231323431393061663632
62323863633466613134393862633238623766616139653361653965663766363837376537646164
32366363336262633437333931363130333463333439346566313631633666333139623335393337
38373931643833636532353762376562346530313931343335663463653139323135633161383861
65656462396333646437306265303934306538316537383462303238346665366135656662616532
62306534303233356130356565323034396337383336386238643836303839393031613338656434
62633363663961633837643535663737323631636238393063306236666261306432616338643761
64336364656539306363336461353962333766316137623965633962663066326262316635636530
66646163386134363036386463363332333365396661313138666538383334626266633737303533
65316433383136613063616565633934633230666561663433346564323462396531623133343538
34613233373134323831613365383266363565313632383866373330333032646261316433663539
61363966343366306166393162343834323663616632663761343266663138373164346534343837
66616131323638386532376461336231313238333463303533613830646535633666386463393037
35313562326139616438396633383265383361316262363535323934303837306631386130386637
38313636613963373038646536333466393031613835376639363461383837343731646430343930
30373130376231383837306539633934643030616563386166643865636361643932623031323439
62623364373665353934366633303133343337306139373033313032613261393761363235376135
65356661313361356466353761336239656166356533636461663832613766363736303961666463
65346662346361323032653230626630356336353832656565363963633561343163626266653631
66626239393533653664353438323331616531333438356530653664376561346134626430643964
35393437663861373164303039333138643337653035643761316236313366616563666136666365
32396535663837626239626136393466653534613630316636323932376133376462323730613731
64393039373636353536313036363064633831323334383930663164323539656161613932656364
64636565636136343063626438623639386635306436383432313333376361393035653436353332
64623161316133663166336363343437393962633834333065396433313832333362326639363336
31633333393563306436646464313561643932393632613762643765333835323463303431383133
37653431366661653833623561343637343631616366623165656430396638353638346632326133
31333237336531386239643161623634656334336565646463653763363735653035653334626431
65656361343437316132323733303136623961313030663638656366653836376530393765643133
66306130343331353165643836613339306662393861656132626530626438333439386239396434
64613464646337393866306365333632316565383430303331353533623366373832666336616336
37313961393237363433396333626631643363666366633732386334353062333639333463613035
66306231303331306531636534313036646362336337333964353237396464353138663531346133
66613433326434363138326131383836636330343739336366623364643062633433613766386639
37393562396239633933373735313661316531366662346362313162326233366438653565656531
66323138383834666463313232623535643139336230336664653739386161316466653965653236
64653730623332326239646236636539643435373835333130666133623764343037363663366538
35643130313162376435363336383563363666353366303634663735393632366439373461393737
36353764613834613730376261356566626665396133396364383762633661386238616134633831
61613466633639656662333138396338303630643961353939326462373661356162356534383133
65393739643061356330366535616461326464613332346233616538633439373133323562343363
34343437633236333638366263616235356634613262396562623535383538306430643932353766
39623465376165343839326332623634303431613964646232373738323434313632376336393561
39653065633735326137386539323531656337396339363865393034336131663163646338363733
33356165306661343966373463643034383564313637353339653562663238306233356137383266
30303263303864396430366438613039383436396139343838316364323236356431383831383333
66373762396539636435303334313461663066323062623433356637366564336333346264636530
36646564643331343830363563383231636336366437333064333666616234376637343330306261
62663461303134336531623133363261643863383130373561396665643463613239653535663664
65383164313735366532666461323033313562616539363938333131623066623435616438383563
36313236633131356264346239376135376663303035363835393262666264323033353562366535
64363834363734613635613836623433616239613530623434383061616331656431616438653765
39633764656365396232313062333636376463396466376134366266343536336563626237616666
62346565326138343534303030313539396233656232376561643662343533383464656662653736
64653661666332316265396161646435643566336463393639663063373664633561386630633764
64636633336266646264383834633634636633386330626461336463316334386665366137666233
31643537646331653065336236303730316166393138633765333931646539666466643161353935
66613632643037653333366465353831643437663861623361343066336135666164343661313862
61613737396535363362386238333366396135353065303231313435393434623032613464653462
30383039623036393239383966326333663531356537343539333633623036396132646338393332
33653564633165356663636663386232346239303835613739356430386636386137653861306661
64313238306139383066633963333563633235636632613862313862343738633338303638383362
32653630626333613036306366353065663231623263613737626633366236616432383530346633
63306265333461313230346633636662353932336562376636646135633063653031383061626530
35653963363466353263396663313333646661386262393866643762356635353363636235353031
33393732623264353737356131633039653564626334623362383361646436316336343962353830
32303635666134613033666664326235663566646162336161333663333665613266326564616339
34303565306466346662336464666537643037633837353263346363313939623166653539323032
64623731376137393664653039623761366230356566316135613031623363323437343664656261
35626439313232353166666636333263633831653863653939643862323535626439323539626639
35363764303565346336323965383334336562306231656366643066653962356636383436336163
37343435353430363663616232326266333662303462616634633637613432346264366537323062
66323865643738373639356434386232656630383562656336363538356633363134343163343162
62663438393332376166663434366662616565616633636334643536656436643131303432303231
31313639613062323763303336323336646632303834366233633939616230353431356538363636
65623562326637363233333666623532326633643864653261363836626565313537366632653363
64333231663538663739636630356336336565323666373436613337633864313761653664643566
38666439626633353462623236626633613263303265623733636433633666643339356632366133
32616532646466343563636336663230333337366466656232323865333431616434306466646433
62626437316130623839663166323264333866613866323061393662663935363339363337636663
66623634373864613464623230373434363461336461373233616533373461343030313166386230
61623637636630666264346637333961623730356366313336313663643539393138343830346138
34643337343031373566656537626533633131646631383962373437666337303764636163623931
65373737316234666465363839313566323338313939653032643362613962316139

View File

@ -70,19 +70,19 @@
notify:
- restart apache
- name: Generate css files
- name: Generate static files
django_manage:
app_path: "{{ project_path }}"
command: "compilescss"
command: "collectstatic"
virtualenv: "{{ project_path }}/venv"
settings: "{{ django_settings_module }}"
notify:
- restart apache
- name: Generate static files
- name: Migrate databse
django_manage:
app_path: "{{ project_path }}"
command: "collectstatic"
command: "migrate --noinput"
virtualenv: "{{ project_path }}/venv"
settings: "{{ django_settings_module }}"
notify:

View File

@ -34,9 +34,9 @@
git:
accept_hostkey: yes
force: yes
repo: "https://github.com/EbookFoundation/regluit.git"
repo: "{{ git_repo }}"
dest: "{{ project_path }}"
version: "{{ repo_version }}"
version: "{{ git_branch }}"
- name: Install python packages to virtualenv
pip:
@ -101,8 +101,8 @@
- name: Run redis tasks
import_tasks: redis.yml
- name: Run mysql tasks
import_tasks: mysql.yml
# - name: Run mysql tasks
# import_tasks: mysql.yml
- name: Run cert tasks
import_tasks: certs.yml

View File

@ -1,48 +0,0 @@
---
- name: Install mysql-server
become: yes
apt:
name: "{{ item }}"
state: present
with_items:
- 'mysql-server'
# - name: Ensure mysql-server is started and enabled
# become: yes
# service:
# name: mysql-server
# state: started
# enabled: yes
- name: Create MySQL database
become: yes
mysql_db:
name: "{{ mysql_db_name }}"
state: present
- name: Create MySQL user
become: yes
mysql_user:
name: "{{ mysql_db_user }}"
password: "{{ mysql_db_pass }}"
priv: '*.*:ALL'
state: present
- name: Migrate databse
django_manage:
app_path: "{{ project_path }}"
command: "migrate --noinput"
virtualenv: "{{ project_path }}/venv"
settings: "{{ django_settings_module }}"
notify:
- restart apache
- name: Import fixtures
django_manage:
app_path: "{{ project_path }}"
command: "loaddata"
virtualenv: "{{ project_path }}/venv"
settings: "{{ django_settings_module }}"
fixtures: "core/fixtures/initial_data.json core/fixtures/bookloader.json"
notify:
- restart apache

View File

@ -1 +0,0 @@
regluit-prod