Skip to content

Commit

Permalink
Merge pull request #46 from bendsouza2/feature/ec2-auto-update
Browse files Browse the repository at this point in the history
add shell scripts for cluster setup and refresh
  • Loading branch information
bendsouza2 authored Dec 24, 2024
2 parents 2e1faea + f9cef7b commit 0a4266b
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 1 deletion.
34 changes: 34 additions & 0 deletions app/cluster_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
set -e

# Install Build Dependencies
sudo add-apt-repository -y ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.10 python3.10-venv
sudo apt install -y libmysqlclient-dev default-libmysqlclient-dev build-essential pkg-config

#Clone the repo
git clone --no-checkout --branch main https://github.com/bendsouza2/yt-translator.git yt_translator
cd yt_translator

python3.10 -m venv venv

git sparse-checkout init --cone
echo "app/" >> .git/info/sparse-checkout
echo "requirements.txt" >> .git/info/sparse-checkout
git checkout main

# Copy post-merge hook
if [ ! -f .git/hooks/post-merge ]; then
cp hooks/post-merge .git/hooks/post-merge
chmod +x .git/hooks/post-merge
else
echo "post-merge hook already exists, skipping copy."
fi


if [ ! -f venv ]; then
python3.10 -m venv venv
else
echo "venv already exists, skipping venv creation"
fi
2 changes: 2 additions & 0 deletions app/hooks/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
bash /home/ubuntu/yt_translator/app/post_update.sh
12 changes: 12 additions & 0 deletions app/post_update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# Copy custom settings file
if [ ! -f settings.py ]; then
echo "Restoring settings.py..."
cp /home/ubuntu/settings_backup/settings.py video_host/settings.py
fi

source /home/ubuntu/yt_translator/venv/bin/activate
python manage.py migrate


2 changes: 1 addition & 1 deletion frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" type="image/png" href="<%= BASE_URL %>favicon.png">
<title><%= htmlWebpackPlugin.options.title %></title>
<title><%= Spanish Word of the Day %></title>
</head>
<body>
<noscript>
Expand Down

0 comments on commit 0a4266b

Please sign in to comment.