One Stop News for all 📰
Look through News from various sources and subscribe to newsletters to receive daily headlines via email
Report Bug
·
Request Feature
- All PRs should be merged to
developmentbranch. So always change todevelopmentbranch.
-
Clone the repository
-
Download
redisforemail queue -
Create a
virtual environmentfor python insideapp/api -
Change directory to
app/and activate thevenvand install all modules fromrequirements.txtusingpip -
Then run
redis server. -
Create a
start_api.shscript which will export all theenvironment variablesand will run the flask app and alsoCelery. To know how to runCelery, again refer to the link provided in the previous step.
-
Install postgresql
-
Start the service by typing
service postgresql start -
(optional) To connect to the database via CLI, type,
sudo -u <username> psql. The default username ispostgresTo connect to database, type
\c <databasename>in psql CLI. Here, the name isnewsfeed.Type
\dtto list the tables inside the database.Type
select * from <tablename>to show the entire content of the database.
-
Install redis server
-
Start the service by typing
service redis-server start -
(optional) Connect to redis via redis-cli, type
redis-clithen typepingin the cli
We will be using a postgresql. Follow this documentation.
-
Create a service account key (JSON)
-
Download
cloud_sql_proxyand make it executable usingchmod +x cloud_sql_proxy -
Create a user in the database and add an appropiate password
-
Create a database named
newsfeed -
Database URI should be of the following format
postgresql+psycopg2://{username}:{password}@/?host=/cloudsql/{connection_name} -
Run the proxy first. Type the following to run it.
./cloud_sql_proxy -dir=/cloudsql -instances={connection_name} \ -credential_file={service_account_key} & -
Now, create the tables. To create the tables, simply export the environment variables and then type the following in your terminal.
python manage.py create_db
Simply create env, key, certs folder. Add all the .env files inside env folder, add the service account key to key folder and add the certificates to the certs folder. The last one is optional (if you want ssl certificate).
Make a folder inside docker called cloudsql and give it read and write permission using chmod. Also create a .env file which will contain the database's connection name. Don't forget to create a database in Cloud SQL
Go inside docker folder and simply run ./run_docker.sh and your server should be up and running. Don't forget to change your servers firewall settings to allow http and https connections.
To install letsencrypt vertificates with docker-compose, you need to use the letsencrypt docker image. Follow this guide to get started.