summaryrefslogtreecommitdiff
path: root/ansible
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
parenteab060df8cfde1137d24f372a2396963c69b5965 (diff)
downloadcloudrender-infra-0ab11da15ae920ec695f48bb88ee9c97376b1c1f.tar.xz
cloudrender-infra-0ab11da15ae920ec695f48bb88ee9c97376b1c1f.zip
Removed ansible as we don't use it anymore
Diffstat (limited to 'ansible')
-rw-r--r--ansible/gunicorn.service.j213
-rw-r--r--ansible/hosts.ini2
-rw-r--r--ansible/nginx.conf.j213
-rw-r--r--ansible/setup-deployment.yml108
-rw-r--r--ansible/setup-docker.yml27
5 files changed, 0 insertions, 163 deletions
diff --git a/ansible/gunicorn.service.j2 b/ansible/gunicorn.service.j2
deleted file mode 100644
index fe9c69c..0000000
--- a/ansible/gunicorn.service.j2
+++ /dev/null
@@ -1,13 +0,0 @@
-[Unit]
-Description=gunicorn daemon
-After=network.target
-
-[Service]
-User=ec2-user
-Group=nginx
-WorkingDirectory=/opt/image_processor
-ExecStart=/opt/image_processor/venv/bin/gunicorn --workers 3 --bind unix:{{ app_directory }}/myapp.sock -m 007 wsgi:app
-
-[Install]
-WantedBy=multi-user.target
-
diff --git a/ansible/hosts.ini b/ansible/hosts.ini
deleted file mode 100644
index c3896e7..0000000
--- a/ansible/hosts.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[ec2_instances]
-44.202.210.65 ansible_user=ec2-user ansible_ssh_private_key_file=~/keypair_amazon/deployer_key
diff --git a/ansible/nginx.conf.j2 b/ansible/nginx.conf.j2
deleted file mode 100644
index a890814..0000000
--- a/ansible/nginx.conf.j2
+++ /dev/null
@@ -1,13 +0,0 @@
-server {
- listen 80;
- ec2_user {{ server_ip }};
-
- location / {
- proxy_pass http://unix:/opt/image_processor/myapp.sock;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto $scheme;
- }
-}
-
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
-
diff --git a/ansible/setup-docker.yml b/ansible/setup-docker.yml
deleted file mode 100644
index e4cac93..0000000
--- a/ansible/setup-docker.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-- name: Install Docker on EC2 instances
- hosts: ec2_instances
- become: yes
-
- tasks:
- - name: Update yum package manager
- yum:
- name: '*'
- state: latest
-
- - name: Install Docker
- yum:
- name: docker
- state: present
-
- - name: Start and enable Docker service
- service:
- name: docker
- state: started
- enabled: yes
-
- - name: Add ec2-user to the docker group
- user:
- name: ec2-user
- groups: docker
- append: yes
-