-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aed889f
commit ef5ac2e
Showing
2 changed files
with
45 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
|
||
PROJ="tfgha" | ||
POETRY="/home/ubuntu/.local/bin" | ||
WORKDIR="/home/ubuntu" | ||
|
||
# Update package lists | ||
if ! sudo apt-get update; then | ||
echo "Failed to update package lists" | ||
exit 1 | ||
fi | ||
|
||
# Install necessary packages | ||
if ! sudo apt-get install -y python3 python3-pip git curl; then | ||
echo "Failed to install packages" | ||
exit 1 | ||
fi | ||
|
||
# Change to the working directory | ||
cd "$WORKDIR" || { echo "Failed to change directory to $WORKDIR"; exit 1; } | ||
|
||
# Clone the project | ||
if ! git clone "https://github.com/proquickly/$PROJ.git"; then | ||
echo "Failed to clone the repository" | ||
exit 1 | ||
fi | ||
|
||
# Change ownership | ||
if ! sudo chown -R ubuntu:ubuntu "$WORKDIR"; then | ||
echo "Failed to change ownership" | ||
exit 1 | ||
fi | ||
|
||
# Run as the ubuntu user | ||
sudo -u ubuntu bash <<EOF | ||
set -e | ||
python3 -m pip install -U poetry | ||
cd "$WORKDIR/$PROJ" | ||
export PATH="$WORKDIR/.local/bin:\$PATH" | ||
[ -f poetry.lock ] && rm poetry.lock | ||
$POETRY/poetry install | ||
cd "$WORKDIR/$PROJ/src/$PROJ" | ||
nohup $POETRY/poetry run python app.py & |