File tree Expand file tree Collapse file tree 6 files changed +29
-17
lines changed
contrib/ansible_playbooks Expand file tree Collapse file tree 6 files changed +29
-17
lines changed Original file line number Diff line number Diff line change 1- provision :
1+ provision : install-python-remote
22 @ansible-playbook provision.yml -v --ask-become-pass
33
44deploy :
Original file line number Diff line number Diff line change 1515 - name : Update system.
1616 apt : update_cache=yes
1717
18- # - name: Upgrade system.
19- # apt: upgrade=dist
18+ - name : Upgrade system.
19+ apt : upgrade=dist
2020
2121 - name : Install required system packages.
2222 apt : pkg={{ item }} state=installed update-cache=yes allow_unauthenticated=yes
3737 - name : Create virtualenv
3838 shell : /usr/bin/python3.5 -m venv {{ virtualenv_directory }}
3939
40+ - name : Upgrade PIP.
41+ shell : " {{ virtualenv_directory }}/bin/pip install --upgrade pip"
42+
4043 - name : Install requirements of Python project.
4144 pip : requirements={{ project_root }}/requirements.txt virtualenv={{ virtualenv_directory }}
4245
7073 copy : src=secret/nginx.conf dest=/etc/nginx/sites-enabled/{{ project_name }}.conf
7174 notify : restart nginx
7275
76+ - name : Create supervisor start scripts.
77+ shell : update-rc.d supervisor defaults
78+
7379 - name : Enable supervisor on start.
74- shell : update-rc.d supervisor defaults && update-rc.d supervisor enable
80+ shell : update-rc.d supervisor enable
7581
7682 - name : Create database.
77- shell : SECRET_KEY={{ secret_key }} SERVER_NAME={{ server_name }} DATABASE_URI={{ database_uri }} python db_create.py
83+ shell : " SECRET_KEY={{ secret_key }} SERVER_NAME={{ server_name }} DATABASE_URI={{ database_uri }} {{ virtualenv_directory }}/bin/python3.5 {{ project_root }}/db_create.py"
84+
85+ - name : Run collect static.
86+ shell : " SECRET_KEY={{ secret_key }} SERVER_NAME={{ server_name }} DATABASE_URI={{ database_uri }} {{ virtualenv_directory }}/bin/python3.5 {{ project_root }}/manage.py collect"
87+
88+ - name : Change permissions.
89+ file : dest={{ project_home }} owner={{ project_name }} group={{ project_name }} recurse=yes
7890
7991 handlers :
8092 - include : handlers.yml
Original file line number Diff line number Diff line change 11[virtualbox-vms]
2- vm01 ansible_port =22 ansible_ssh_host =<ip of your application host> environment_type =production branch =master ansible_ssh_pass =<your ssh password> ansible_ssh_user =<your ssh user>
2+ vm01 ansible_port =22 ansible_ssh_host =<your host here > environment_type =production branch =master ansible_ssh_pass =<your password here > ansible_ssh_user =<your user here >
Original file line number Diff line number Diff line change 66
77server {
88 listen 80 ;
9- # server_name flasktutorial.abraseucodigo.com.br;
9+ server_name flasktutorial.abraseucodigo.com.br;
1010
1111 location / {
1212 client_max_body_size 5M ;
@@ -16,7 +16,7 @@ server {
1616
1717 location /static {
1818 autoindex on;
19- alias /home/flasktutorial/project/staticfiles ;
19+ alias /home/flasktutorial/project/static ;
2020 }
2121
2222 location /robots.txt {
Original file line number Diff line number Diff line change @@ -7,5 +7,5 @@ stderr_logfile=/home/flasktutorial/flasktutorial_error.log
77autostart=true
88autorestart=true
99stopsignal=QUIT
10- environment=SECRET_KEY="<your secret key>",SERVER_NAME="<your server name>",DATABASE_URI="sqlite:///tvseries.sqlite3"
10+ environment=SECRET_KEY="<your secret key here >",SERVER_NAME="<your server name here >",DATABASE_URI="sqlite:///tvseries.sqlite3"
1111
Original file line number Diff line number Diff line change @@ -4,16 +4,16 @@ project_home: /home/flasktutorial
44project_root : /home/flasktutorial/project
55virtualenv_directory : /home/flasktutorial/.venv
66project_repo : git@github.com:rafaelhenrique/flask_tutorial.git
7- private_key_github : /home/rafael /.ssh/id_rsa
8- public_key_github : /home/rafael /.ssh/id_rsa.pub
9- management_user : rafael
10- secret_key : ' <your secret key>'
11- server_name : ' <your server name>'
7+ private_key_github : /home/<your local user here> /.ssh/id_rsa
8+ public_key_github : /home/<your local user here> /.ssh/id_rsa.pub
9+ management_user : <your remote user here>
10+ secret_key : ' <your secret key here >'
11+ server_name : ' <your server name here >'
1212database_uri : ' sqlite:///tvseries.sqlite3'
1313production_variables :
14- SECRET_KEY : ' <your secret key> '
15- SERVER_NAME : ' <your server name > '
16- DATABASE_URI : ' sqlite:///tvseries.sqlite3 '
14+ SECRET_KEY : " {{ secret_key }} "
15+ SERVER_NAME : " {{ server_name }} "
16+ DATABASE_URI : " {{ database_uri }} "
1717system_packages :
1818 - build-essential
1919 - python3
You can’t perform that action at this time.
0 commit comments