Skip to content

Commit

Permalink
Merge pull request #761 from NASA-IMPACT/760-add-support-and-document…
Browse files Browse the repository at this point in the history
…ation-for-non-docker-local-setup

Add file and instructions on how to run locally
  • Loading branch information
code-geek authored May 23, 2024
2 parents 192407a + 2112138 commit 6c2add9
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .env_sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
CELERY_BROKER_URL=""
CELERY_FLOWER_PASSWORD=""
CELERY_FLOWER_USER=""
DATABASE_URL='postgresql://<user>:<password>@localhost:5432/<database>'
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
34 changes: 32 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <some database>;
postgres=# create user <some username> with password '<some password>';
postgres=# grant all privileges on database <some database> to <some username>;
# This next one is optional, but it will allow the user to create databases for testing
postgres=# alter role <some username> 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://<user>:<password>@localhost:5432/<database>'` 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.
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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 <https://sentry.io/signup/?code=cookiecutter> or download and host it yourself.
Expand Down

0 comments on commit 6c2add9

Please sign in to comment.