From 211213807786fa7b857730c398122ed3ea5da188 Mon Sep 17 00:00:00 2001 From: Ashish Acharya Date: Thu, 23 May 2024 15:03:55 -0500 Subject: [PATCH] Add file and instructions on how to run locally --- .env_sample | 18 ++++++++++++++++++ README.md | 34 ++++++++++++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 .env_sample diff --git a/.env_sample b/.env_sample new file mode 100644 index 00000000..e370568f --- /dev/null +++ b/.env_sample @@ -0,0 +1,18 @@ +CELERY_BROKER_URL="" +CELERY_FLOWER_PASSWORD="" +CELERY_FLOWER_USER="" +DATABASE_URL='postgresql://:@localhost:5432/' +DJANGO_ACCOUNT_ALLOW_REGISTRATION=False +DJANGO_AWS_ACCESS_KEY_ID="" +DJANGO_AWS_SECRET_ACCESS_KEY="" +DJANGO_AWS_STORAGE_BUCKET_NAME="" +GITHUB_ACCESS_TOKEN="" +GITHUB_BRANCH_FOR_WEBAPP="" +IPYTHONDIR="" +REDIS_URL="" +SINEQUA_CONFIGS_GITHUB_REPO="" +SINEQUA_CONFIGS_REPO_DEV_BRANCH="" +SINEQUA_CONFIGS_REPO_MASTER_BRANCH="" +SINEQUA_CONFIGS_REPO_WEBAPP_PR_BRANCH="" +SLACK_WEBHOOK_URL="" +USE_DOCKER=no diff --git a/README.md b/README.md index 01efe654..ceabb8dd 100644 --- a/README.md +++ b/README.md @@ -12,15 +12,46 @@ Moved to [settings](http://cookiecutter-django.readthedocs.io/en/latest/settings ## Basic Commands ### Building The Project + ```bash $ docker-compose -f local.yml build ``` ### Running The Necessary Containers + ```bash $ docker-compose -f local.yml up ``` +### Non-docker Local Setup + +If you want to run the project without docker, you will need the following: + +- Postgres + +Run the following commands: + +```` +$ psql postgres +postgres=# create database ; +postgres=# create user with password ''; +postgres=# grant all privileges on database to ; + +# This next one is optional, but it will allow the user to create databases for testing + +postgres=# alter role with superuser; +``` + +Now copy .env_sample in the root directory to .env. Note that in this setup we don't end up using the .envs/ directory, but instead we use the .env file. + +Replace the variables in this line in the .env file: `DATABASE_URL='postgresql://:@localhost:5432/'` with your user, password and database. Change the port if you have a different one. + +You don't need to change any other variable, unless you want to use specific modules (like the GitHub code will require a GitHub token etc). + +There is a section in `config/settings/base.py` which reads environment variables from this file. The line should look like `READ_DOT_ENV_FILE = env.bool("DJANGO_READ_DOT_ENV_FILE", default=True)`. Make sure either the default is True here (which it should already be), or run `export DJANGO_READ_DOT_ENV_FILE=True` in your terminal. + +Run `python manage.py runserver` to test if your setup worked. You might have to run an initial migration with `python manage.py migrate`. + ### Setting Up Your Users - To create a **normal user account**, just go to Sign Up and fill out the form. Once you submit it, you'll see a "Verify Your E-mail Address" page. Go to your console to see a simulated email verification message. Copy the link into your browser. Now the user's email should be verified and ready to go. @@ -144,7 +175,7 @@ To run a celery worker: ```bash cd sde_indexing_helper celery -A config.celery_app worker -l info -``` +```` Please note: For Celery's import magic to work, it is important _where_ the celery commands are run. If you are in the same folder with _manage.py_, you should be right. @@ -186,7 +217,6 @@ Run against the files : It's usually a good idea to run the hooks against all of the files when adding new hooks (usually `pre-commit` will only run on the chnages files during git hooks). - ### Sentry Sentry is an error logging aggregator service. You can sign up for a free account at or download and host it yourself.