You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Docs updates, separates nix and non-nix install processes, edits to simplify for both. Update to add index for coherency for devs and reduce some redundancy. (#1379)
This project will use Python 3.11, Docker, and Docker Compose.
17
17
18
-
Instructions to install those packages are included in [development_setup_notes.md](docs/development_setup_notes.md).
19
-
20
-
**NOTE**: All of these various `docker compose` commands, along with other helpful
21
-
developer utility commands, are codified in our `justfile` and can be ran with
22
-
less typing.
23
-
24
-
You will need to install `just`, by [following the documentation](https://just.systems/man/en/)
25
-
26
-
**Environment Variables**: Copy file `env.template` to `.env` and adjust values to match your local environment. See [Environment Variables](docs/env_vars.md) for more information.
27
-
28
-
```shell
29
-
$ cp env.template .env
30
-
```
31
-
32
-
**NOTE**: Double check that the exposed port assigned to the PostgreSQL
33
-
container does not clash with a database or other server you have running
34
-
locally.
35
-
36
-
Then run:
18
+
There are two options for development setups, nix and native. The native setup doesn't require nix to be installed. The nix-based setup works in a similar way to a python venv, with everything encapsulated for the project. Note: it is not a vm. It handles installation of all of the application and development environment's dependencies automatically:
1.[Static Content from S3](docs/static_content.md)
45
+
1.['manage' Commands](docs/commands.md)
46
+
1.[API](docs/api.md)
47
+
1.[RSS Feeds](docs/rss_feeds.md)
48
+
1.[Env Vars](docs/env_vars.md)
49
+
1.[Calendar](docs/calendar.md)
50
+
1.[News](docs/news.md)
51
+
1. Instructional
52
+
1.[Dependency Updates](docs/dependencies.md)
53
+
1.[Release Reports](docs/release_reports.md)
54
+
1.[User Management](docs/user_management.md)
55
+
1.[Non-Dev Server Allauth Setup](docs/non-dev-server-allauth-setup.md)
56
+
1.[Admin Features](docs/admin.md)
57
+
1.[Mailing List Setup](docs/mailing_list.md)
58
+
59
+
After going through the "Development System setup" steps above to create the Docker image, install dependencies, and start the services in `docker-compose.yml`, run:
37
60
38
61
```shell
39
62
# start our services (and build them if necessary)
40
63
$ docker compose up
41
64
42
65
# to create database migrations
43
-
$ docker compose run --rm web python manage.py makemigrations
66
+
$ just makemigrations
44
67
45
68
# to run database migrations
46
-
$ docker compose run --rm web python manage.py migrate
69
+
$ just migrate
47
70
48
71
# to create a superuser
49
-
$ docker compose run --rm web python manage.py createsuperuser
72
+
$ just manage createsuperuser
50
73
```
51
74
52
-
This will create the Docker image, install dependencies, start the services
53
-
defined in `docker-compose.yml`, and start the webserver.
54
-
55
75
styles.css is still missing in a local docker-compose environment. Steps to add it:
@@ -125,22 +136,6 @@ currently generated by `docker compose build` and is included in the Docker imag
125
136
126
137
---
127
138
128
-
## Generating Local Data
129
-
130
-
To **add real Boost libraries and sync all the data from GitHub and S3**, set appropriate values in your new .env file according to [Environment Variables](docs/env_vars.md) for `GITHUB_TOKEN`, `STATIC_CONTENT_AWS_ACCESS_KEY_ID`, `STATIC_CONTENT_AWS_SECRET_ACCESS_KEY`, `STATIC_CONTENT_BUCKET_NAME`, `STATIC_CONTENT_REGION`, `STATIC_CONTENT_AWS_S3_ENDPOINT_URL` then run:
131
-
132
-
```bash
133
-
docker compose run --rm web python manage.py update_libraries --local
134
-
```
135
-
136
-
Those values can be gotten from another developer in the `#boost-website` Slack channel.
137
-
138
-
The `--local` flag speeds up the command a lot by excluding the retrieval of data you generally don't need. For more information, see `update_libraries` in [Management Commands](docs/commands.md).
139
-
140
-
Then as a superuser log into the admin interface, go to "Versions" and click on the "import new releases" button in the top right.
141
-
142
-
---
143
-
144
139
## Setting up Mailman/Hyperkitty locally
145
140
``shell
146
141
sudo apt-get install sassc
@@ -190,17 +185,6 @@ We use [pre-commit hooks](https://pre-commit.com/) to check code for style, synt
190
185
|[Ruff](https://github.com/charliermarsh/ruff)| Wrapper around `flake8` and `isort`, among other linters |
Follow these instructions to use the social logins through django-allauth on your local machine.
4
+
5
+
See https://testdriven.io/blog/django-social-auth/ for more information.
6
+
7
+
#### Github
8
+
- Go to https://github.com/settings/applications/new and add a new OAuth application
9
+
- Set `http://localhost:8000` as the Homepage URL
10
+
- Set `http://localhost:8000/accounts/github/login/callback/` as the Callback URL
11
+
- Click whether you want to enable the device flow
12
+
- <imgsrc="https://user-images.githubusercontent.com/2286304/252841283-9a846c68-46bb-4dac-8d1e-d35270c09f1b.png"alt="The GitHub screen that registers a new OAuth app"width="400">
13
+
- On completion copy the Client ID and Client Secret to the `.env` file as values of `GITHUB_OAUTH_CLIENT_ID` and `GITHUB_OAUTH_CLIENT_SECRET`.
14
+
- Run `direnv allow` and restart your docker containers.
15
+
16
+
Setup should be complete and you should be able to see an option to "Use Github" on the sign up page.
17
+
18
+
To test the flow including authorizing Github for the Boost account, log into your GitHub account settings and click **Applications** in the left menu. Find the "Boost" authorization and delete it. The next time you log into Boost with this GitHub account, you will have to re-authorize it.
19
+
20
+
<imgsrc="https://user-images.githubusercontent.com/2286304/204642346-8b269aaf-4693-4351-9474-0a998b97689c.png"alt="The 'Authorized OAuth Apps' tab in your GitHub Applications"width="400">
21
+
22
+
This setup process is not something that can currently be automated through terraform because of a lack of relevant Github API endpoints to create Oauth credentials.
1.`TF_VAR_google_cloud_email` (the email address of your Google Cloud account)
32
+
2.`TF_VAR_google_organization_domain` (usually the domain of your Google Cloud account, e.g. "boost.org" if you will be using a @boost.org email address)
33
+
3.`TF_VAR_google_cloud_project_name` (optional, default: localboostdev) - needs to change if destroyed and a setup is needed within 30 days
34
+
2. Run `just development-tofu-init` to initialize tofu.
35
+
3. Run `just development-tofu-plan` to confirm the planned changes.
36
+
4. Run `just development-tofu-apply` to apply the changes.
37
+
5. Go to https://console.developers.google.com/
38
+
1. Search for the newly created project, named "Boost Development" (ID: localboostdev by default).
39
+
2. Type "credentials" in the search input at the top of the page.
40
+
3. Select "Credentials" under "APIs & Services".
41
+
1. Click "+ CREATE CREDENTIALS"
42
+
2. Select "OAuth Client ID"
43
+
3. Select Application Type: "Web application"
44
+
4. Name: "Boost Development" (arbitrary)
45
+
5. For "Authorized Javascript Origins" use:`http://localhost:8000`
6. From the page that's displayed, update the `.env` file with values for the following:
51
+
-`GOOGLE_OAUTH_CLIENT_ID` should be similar to "k235bn2b1l1(...)asdsk.apps.googleusercontent.com"
52
+
-`GOOGLE_OAUTH_CLIENT_SECRET` should be similar to "LAJACO(...)KLAI612ANAD"
53
+
54
+
Point 5 above can not be automated through terraform because of a lack of relevant Google Cloud API endpoints to create Oauth credentials.
55
+
56
+
Setup should be complete and you should be able to see an option to "Use Google" on the sign up page.
57
+
58
+
#### Additional Notes on allauth login flows:
59
+
**Working locally**: If you need to run through the login flows multiple times, create a superuser so you can log into the admin. Then, log into the admin and delete your "Social Account" from the admin. This will test a fresh connection to GitHub for your logged-in GitHub user.
Copy file name to clipboardExpand all lines: docs/development_setup_notes_native.md
+14-62Lines changed: 14 additions & 62 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -271,72 +271,24 @@ cd website-v2
271
271
cp env.template .env
272
272
```
273
273
274
-
Edit the .env, adding AWS keys.
275
-
276
-
Continue to the instructions in the top-level README.md file.
277
-
278
-
## Local Development
279
-
280
-
### Social Login with django-allauth
281
-
282
-
Follow these instructions to use the social logins through django-allauth on your local machine.
283
-
284
-
See https://testdriven.io/blog/django-social-auth/ for more information.
285
-
286
-
#### Github
287
-
- Go to https://github.com/settings/applications/new and add a new OAuth application
288
-
- Set `http://localhost:8000` as the Homepage URL
289
-
- Set `http://localhost:8000/accounts/github/login/callback/` as the Callback URL
290
-
- Click whether you want to enable the device flow
291
-
- <imgsrc="https://user-images.githubusercontent.com/2286304/252841283-9a846c68-46bb-4dac-8d1e-d35270c09f1b.png"alt="The GitHub screen that registers a new OAuth app"width="400">
292
-
- On completion copy the Client ID and Client Secret to the `.env` file as values of `GITHUB_OAUTH_CLIENT_ID` and `GITHUB_OAUTH_CLIENT_SECRET`.
293
-
- Run `direnv allow` and restart your docker containers.
274
+
Edit the .env, adding AWS keys, and adjust values to match your local environment. See [Environment Variables](docs/env_vars.md) for more information.
294
275
295
-
Setup should be complete and you should be able to see an option to "Use Github" on the sign up page.
276
+
**NOTE**: Double check that the exposed port assigned to the PostgreSQL
277
+
container does not clash with a database or other server you have running
278
+
locally.
296
279
297
-
To test the flow including authorizing Github for the Boost account, log into your GitHub account settings and click **Applications** in the left menu. Find the "Boost" authorization and delete it. The next time you log into Boost with this GitHub account, you will have to re-authorize it.
280
+
### Pre-commit Hooks Setup
298
281
299
-
<imgsrc="https://user-images.githubusercontent.com/2286304/204642346-8b269aaf-4693-4351-9474-0a998b97689c.png"alt="The 'Authorized OAuth Apps' tab in your GitHub Applications"width="400">
282
+
| Description | Command |
283
+
| ---- | ------- |
284
+
| 1. Install the `pre-commit` package using `pip`|`pip install pre-commit`|
285
+
| 2. Install our list of pre-commit hooks locally |`pre-commit install`|
286
+
| 3. Run all hooks for changed files before commit |`pre-commit run`|
287
+
| 4. Run specific hook before commit |`pre-commit run {hook}`|
288
+
| 5. Run hooks for all files, even unchanged ones |`pre-commit run --all-files`|
This setup process is not something that can currently be automated through terraform because of a lack of relevant Github API endpoints to create Oauth credentials.
1.`TF_VAR_google_cloud_email` (the email address of your Google Cloud account)
311
-
2.`TF_VAR_google_organization_domain` (usually the domain of your Google Cloud account, e.g. "boost.org" if you will be using an @boost.org email address)
312
-
3.`TF_VAR_google_cloud_project_name` (optional, default: localboostdev) - needs to change if destroyed and a setup is needed within 30 days
313
-
2. Run `just development-tofu-init` to initialize tofu.
314
-
3. Run `just development-tofu-plan` to confirm the planned changes.
315
-
4. Run `just development-tofu-apply` to apply the changes.
316
-
5. Go to https://console.developers.google.com/
317
-
1. Search for the newly created project, named "Boost Development" (ID: localboostdev by default).
318
-
2. Type "credentials" in the search input at the top of the page.
319
-
3. Select "Credentials" under "APIs & Services".
320
-
1. Click "+ CREATE CREDENTIALS"
321
-
2. Select "OAuth Client ID"
322
-
3. Select Application Type: "Web application"
323
-
4. Name: "Boost Development" (arbitrary)
324
-
5. For "Authorized Javascript Origins" use:`http://localhost:8000`
6. From the page that's displayed, update the `.env` file with values for the following:
330
-
-`GOOGLE_OAUTH_CLIENT_ID` should be similar to "k235bn2b1l1(...)asdsk.apps.googleusercontent.com"
331
-
-`GOOGLE_OAUTH_CLIENT_SECRET` should be similar to "LAJACO(...)KLAI612ANAD"
332
-
7. Run `direnv allow` and restart your docker containers.
333
-
334
-
Point 5 above can not be automated through terraform because of a lack of relevant Google Cloud API endpoints to create Oauth credentials.
335
-
336
-
Setup should be complete and you should be able to see an option to "Use Google" on the sign up page.
337
-
338
-
#### Additional Notes:
339
-
**Working locally**: If you need to run through the login flows multiple times, create a superuser so you can log into the admin. Then, log into the admin and delete your "Social Account" from the admin. This will test a fresh connection to GitHub for your logged-in GitHub user.
291
+
Continue to the instructions in the top-level README.md file.
340
292
341
293
### Debugging
342
294
For local development there is Django Debug Toolbar, and the option to set a debugger.
0 commit comments