summaryrefslogtreecommitdiff
path: root/ansible/setup-deployment.yml
diff options
context:
space:
mode:
authoromagdy7 <omar.professional8777@gmail.com>2024-05-15 23:22:06 +0300
committeromagdy7 <omar.professional8777@gmail.com>2024-05-15 23:22:06 +0300
commit0ab11da15ae920ec695f48bb88ee9c97376b1c1f (patch)
treefd3ca15ce6720ff7fbe80673d83e4c6436465f0f /ansible/setup-deployment.yml
parenteab060df8cfde1137d24f372a2396963c69b5965 (diff)
downloadcloudrender-infra-0ab11da15ae920ec695f48bb88ee9c97376b1c1f.tar.xz
cloudrender-infra-0ab11da15ae920ec695f48bb88ee9c97376b1c1f.zip
Removed ansible as we don't use it anymore
Diffstat (limited to 'ansible/setup-deployment.yml')
-rw-r--r--ansible/setup-deployment.yml108
1 files changed, 0 insertions, 108 deletions
diff --git a/ansible/setup-deployment.yml b/ansible/setup-deployment.yml
deleted file mode 100644
index feb42c5..0000000
--- a/ansible/setup-deployment.yml
+++ /dev/null
@@ -1,108 +0,0 @@
----
-- name: Deploy Flask Application on Amazon Linux
- hosts: all
- become: yes
-
- vars:
- app_directory: "/opt/image_processor"
- requirements:
- - Flask==2.0.1
- - flask-cors
- - boto3
- - opencv-python-headless
- - numpy
- - gunicorn
-
- tasks:
- - name: Update all system packages
- yum:
- name: "*"
- state: latest
- update_cache: yes
-
- - name: Install essential packages
- yum:
- name:
- - gcc
- - gcc-c++
- - git
- state: present
-
- - name: enable Nginx using amazon-linux-extras
- command: amazon-linux-extras enable nginx1.12
-
- - name: Install nginx
- yum:
- name: nginx
- state: present
-
- - name: Upgrade pip
- command: pip3 install --upgrade pip
-
- - name: Install virtualenv using pip
- command: pip3 install virtualenv
-
- - name: Create application directory
- file:
- path: "{{ app_directory }}"
- state: directory
- mode: '0755'
-
- - name: Remove existing virtual environment
- file:
- path: "{{ app_directory }}/venv"
- state: absent
-
- - name: Create a virtual environment using virtualenv
- command: virtualenv -p python {{ app_directory }}/venv
-
- - name: Install Python packages in the virtual environment
- pip:
- name: "{{ item }}"
- virtualenv: "{{ app_directory }}/venv"
- loop: "{{ requirements }}"
-
- - name: Copy application files to the server
- copy:
- src: "{{ item }}"
- dest: "{{ app_directory }}"
- mode: '0644'
- with_fileglob:
- - "../../CloudRender/backend/*.py"
-
- - name: Setup Gunicorn systemd service
- template:
- src: gunicorn.service.j2
- dest: /etc/systemd/system/gunicorn.service
- notify:
- - Reload systemd
- - Restart Gunicorn
-
- - name: Setup Nginx configuration
- template:
- src: nginx.conf.j2
- dest: /etc/nginx/conf.d/my_flask_app.conf
- notify:
- - Restart nginx
-
- - name: Ensure nginx is running and enabled
- systemd:
- name: nginx
- state: started
- enabled: true
-
- handlers:
- - name: Restart nginx
- systemd:
- name: nginx
- state: restarted
-
- - name: Reload systemd
- systemd:
- daemon_reload: yes
-
- - name: Restart Gunicorn
- systemd:
- name: gunicorn
- state: restarted
-