Skip to content

aaatipamula/cd-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker flask github

About

A Flask app that automatically reloads my docker containers

This project arose from the need and want to manage some of my other projects. I like to self host my discord bots to save some money on cloud compute costs. I came up with a lit of other problems I wanted to solve as well.

  1. I want my projects to automatically update when I push new code
  2. Changing and reloading my project can be done without direct access to my server
  3. My app should be secure
  4. Deploying the project itself shouldn't be too much of a hassle

Setup

Environment Variables

Should be located in .env

Note

This file can also be automatically generated by the setup script

FLASK_DEV_FOLDER # Path to directory to host files
FLASK_SECRET_KEY # Key to verify, use src/secret_key.py to generate
FLASK_AUTH_USERNAME # Admin Username
FLASK_AUTH_PASSWORD # Admin Password
FLASK_DOCKER_RELOAD_SCRIPT # Location to docker reload script

Production

No Service (Not Recommended)

  1. Setup venv
python3 -m venv .venv
source .venv/bin/activate
  1. Install dependencies
pip install -r requirements.txt
  1. Install Gunicorn
pip install gunicorn
  1. Start Gunicorn in the background
nohup gunicorn -w 4 'server.main:app' > gunicorn.log 2>&1 &

With Service

./scripts/createsocket.sh <username> <server-ip-domain>
source .venv/bin/activate
pip install -r requirements.txt
pip install gunicorn

Development Server

Start Server

python3 -m flask --app server --debug run

Forward Github Webhooks

nohup gh webhook forward --repo=aaatipamula/REPOSITORY-NAME --events=pull_request --url=http://localhost:5000/webhooks &

About

A simple server that deploys projects for me.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published