/NotesApp

Simple app for demonstration purposes

Primary LanguagePythonBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

NotesApp

Simple app for demonstration purposes

Installation:

  1. Create working directory and clone there the repository:
sudo mkdir -p /var/www/NotesApp && \
sudo chmod 777 /var/www/NotesApp && \
git clone https://github.com/max2k1/NotesApp.git /var/www/NotesApp && \
echo "Init completed"
  1. Install python3-venv all the dependencies:
python3 -m venv .venv && source .venv/bin/activate && pip install -r requirements.txt
  1. Create /var/www/NotesApp/.env with some defaults:
cd /var/www/NotesApp && \
flask init-env 
  1. Install postgresql and set up the database. Generate pgsql initialization script:
flask init-pgsql
  1. Don't forget to fix postgresql.conf to listen on * (listen_addresses = '*') and pg_hba.confto add network permissions. Both files are usually located in/etc/postgresql/VER/main/` directory.
  2. Copy systemd unit file into its location and start the service:
sudo cp /var/www/NotesApp/system_configs/etc/systemd/system/notes-app.service /etc/systemd/system/ && \
sudo systemctl daemon-reload && sudo systemctl enable notes-app && sudo systemctl restart notes-app && \
sudo systemctl status notes-app
  1. Install apache2, disable its default site and enable required modules:
sudo a2dissite 000-default.conf && \
sudo a2enmod proxy && \
sudo a2enmod proxy_http
  1. Copy apache2 config to its location and enable it:
sudo cp /var/www/NotesApp/system_configs/etc/apache2/sites-available/NotesApp.conf /etc/apache2/sites-available/ && \
sudo a2ensite NotesApp.conf && \
sudo systemctl restart apache2 && \
echo Done
  1. You can also pre-seed your database with 10K notes:
pushd /var/www/NotesApp/ && \
flask recreate-db && \
flask seed-db && \
popd && \
echo "Seeding completed"
  1. Install haproxy and use the supplied config. Update ip addresses.
sudo cp /var/www/NotesApp/system_configs/etc/haproxy/haproxy.cfg /etc/haproxy/ && \
sudo systemct restart haproxy && \
echo "Haproxy ready!" 
  1. Make some testing:
wrk -c 20 -t 2 -d 60s http://server03/