Skip to content

Commit bf5aa36

Browse files
committed
Create deployment script
1 parent 8c04118 commit bf5aa36

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

examples/demonstration/deploy.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
cd ~/fastapi-oauth2/
3+
git restore .
4+
git pull
5+
6+
cd ~/fastapi-oauth2/examples/demonstration
7+
echo "import main; from fastapi import FastAPI; app = FastAPI(); app.mount('/fastapi-oauth2', main.app)" > playground.py
8+
9+
sudo rm -r /var/www/playground/fastapi-oauth2/
10+
sudo cp -r ~/fastapi-oauth2/examples/demonstration /var/www/playground/fastapi-oauth2/
11+
sudo python3 -m pip install -r /var/www/playground/fastapi-oauth2/requirements.txt
12+
13+
# Update environment variables for production
14+
ENV_FILE=/var/www/playground/fastapi-oauth2/.env
15+
for ENV_KEY in OAUTH2_GITHUB_CLIENT_ID OAUTH2_GITHUB_CLIENT_SECRET OAUTH2_GOOGLE_CLIENT_ID OAUTH2_GOOGLE_CLIENT_SECRET;
16+
do
17+
sudo python3 -c "from dotenv import set_key; set_key('${ENV_FILE}', '${ENV_KEY}', '${!ENV_KEY}')";
18+
done
19+
20+
sudo service playground.fastapi-oauth2 restart

0 commit comments

Comments
 (0)