This template is ready for scaling and is easy to deploy.
Check out Martin Fowler's website with this great article by Cam Jackson on splitting your frontend into microservices. Probably not necessary for most (99%), but consider it.
Start separating into databases instead of tables; right now, there exists one table for each service. You should definitely think about scaling the database, a cloud option is a great option here.
Currently, the different services knows about eachother (which means higher coupling). To remove this, we would want a centralized service that knows all the services, but the rest of the services don't know about eachother. All communication would go through this centralized service.
Most of the work is done, and it would just be changing some endpoints, but if you want truly low coupling, this needs a migration.
This is a simple overview of the system. Go to the app folder and see the technical README for a more detailed overview.
You should make sure that your database is running first and foremost, else the following will fail. Look under installation for Windows or Mac/Linux for how to run the database locally. It just needs to be running in the background, all the databases and tables are created programmatically.
docker-compose buildfor your first build and when you have made changes.
docker-compose upto run all the services.
~/app/setup_app/config.py as needed. I recommend making a mode for development and production (staging if necessary) with all the needed credentials. The file is very easy to extend with new config secrets.
Note that scaling is very easy, you can just convert your
docker-compose.yml file to Kubernetes files, and you can easily get set up and running in Google Cloud Platform or Amazon Web Services. Read this tutorial for more.
For payments, Stripe needs to be able to send you webhooks. You can enable Stripe's test mode to make sure your setup is correct. I have used ngrok (free) to do this. It's really simple, you just navigate to the folder and run
./ngrok http 5004 or whichever port the Stripe service is running on.
Other choices are:
pip install -r requirements.txt
app/setup_app/config.py. I configured MySQL to run on port 5001, but the default port is 3306, which you can easily switch the port to in the code.
Download MySQL server and start it.
**IMPORTANT: Make sure to check "Configure MySQL Server as a Windows Service" and "Start the MySQL server at System Startup".
Check the service is configured by pressing windows key or WINDOWS KEY+R and typing
services.msc and find MySQL (e.g. MySQL80). It should be running, also after you have restarted your computer. Always check back here if something is not running.
A tip that makes your life easier:
C:\Program Files\MySQL\MySQL Server 8.0\bin. Add it as your path and click ok.
Open MySQL vXX Command Line Prompt (e.g. MySQL 8.0 Command Line Prompt) and enter your password, e.g.
rootpw is used in this repo.
Use Homebrew to install mysql. Installing homebrew is the first step:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install mysql
/usr/local/etc/my.cnf, but check
~/.my.cnfif you can't find it. For Ubuntu 18.04, I found it under
mysqld.conf.d. Add or find the line with
port=5001, and optionally
brew services start mysql(starts every time you boot computer)
mysqladmin -u root password 'yourpassword'. This password should be strong if used in production.
You can always restart or stop the service, e.g. if the service is running and you edit your config file, you need to restart the service for it to pick it up:
brew services restart mysql
brew services stop mysql
mysql -u root -p and press enter. It will ask for your password, then you are in.