Skip to content

Commit 8545b1a

Browse files
committed
Started working on removing last bits of frontend+backend monolith
1 parent b6dc654 commit 8545b1a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+259
-351
lines changed

.env.example

Lines changed: 0 additions & 42 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
CELERY_BROKER_URL: redis://localhost:6379/4
8686
CELERY_RESULT_BACKEND: redis://localhost:6379/4
8787
TIKA_CLIENT_ONLY: "True"
88-
MITOPEN_BASE_URL: http://localhost:8063/
88+
MITOPEN_APP_BASE_URL: http://localhost:8062/
8989
MAILGUN_KEY: fake_mailgun_key
9090
MAILGUN_SENDER_DOMAIN: other.fake.site
9191
OPENSEARCH_INDEX: testindex
@@ -123,7 +123,7 @@ jobs:
123123
- name: Webpack build
124124
run: yarn run build
125125
env:
126-
MITOPEN_AXIOS_BASE_PATH: https://api.mitopen-test.odl.mit.edu
126+
MITOPEN_API_BASE_URL: https://api.mitopen-test.odl.mit.edu
127127

128128
- name: Lints
129129
run: yarn run lint-check

.github/workflows/production.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
env:
3737
EMBEDLY_KEY: ${{ secrets.EMBEDLY_KEY_PROD }}
3838
MITOPEN_AXIOS_WITH_CREDENTIALS: true
39-
MITOPEN_AXIOS_BASE_PATH: https://api.mitopen.odl.mit.edu
39+
MITOPEN_API_BASE_URL: https://api.mitopen.odl.mit.edu
4040

4141
- uses: akhileshns/heroku-deploy@581dd286c962b6972d427fcf8980f60755c15520
4242
with:

.github/workflows/release-candidate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
env:
3737
EMBEDLY_KEY: ${{ secrets.EMBEDLY_KEY_RC }}
3838
MITOPEN_AXIOS_WITH_CREDENTIALS: true
39-
MITOPEN_AXIOS_BASE_PATH: https://api.mitopen-rc.odl.mit.edu
39+
MITOPEN_API_BASE_URL: https://api.mitopen-rc.odl.mit.edu
4040

4141
- uses: akhileshns/heroku-deploy@581dd286c962b6972d427fcf8980f60755c15520
4242
with:

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ __pycache__/
99

1010
# Distribution / packaging
1111
.Python
12-
env/
1312
build/
1413
build-exports/
1514
develop-eggs/

README.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ The following settings must be configured before running the app:
2525

2626
Controls which docker containers run. To run them all, use `COMPOSE_PROFILES=backend,frontend`. See [Frontend Development](./frontends/README.md) for more.
2727

28-
- `INDEXING_API_USERNAME`
29-
30-
At least to start out, this should be set to the username of the superuser
31-
you created above.
32-
3328
- `MAILGUN_KEY` and `MAILGUN_SENDER_DOMAIN`
3429

3530
You can set these values to any non-empty string value if email-sending functionality
@@ -216,7 +211,7 @@ Once these are set (and you've restarted the app), you should see events flowing
216211
A Javascript bundle of exported frontend components can be generated for use in external websites that have CORS allowance into a given instance of `mit-open`. There are a few settings you might want to change in order to get the expected results.
217212

218213
- `MITOPEN_AXIOS_WITH_CREDENTIALS` - This sets `withCredentials: true` when initializing the Axios API, which tells the end user's browser to send along any browser level cookies for the current domain when making CORS requests
219-
- `MITOPEN_AXIOS_BASE_PATH` - This sets the base path used for API requests, which will need to be set to a fully qualified url pointing to an instance of `mit-open` (i.e. https://mitopen.odl.mit.edu) in order for requests from the external site to reach the proper destination
214+
- `MITOPEN_API_BASE_URL` - This sets the base url used for API requests, which will need to be set to a fully qualified url pointing to an instance of `mit-open` (i.e. https://mitopen.odl.mit.edu) in order for requests from the external site to reach the proper destination
220215
- `CORS_ALLOWED_ORIGINS`, `CSRF_TRUSTED_ORIGINS` - On the instance of `mit-open` that the externally hosted components will access via the API, the domains of any sites that need CORS access need to be here as a list of strings
221216

222217
To build the bundle of exported components, run:

app.json

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
{
55
"url": "https://github.com/heroku/heroku-buildpack-apt"
66
},
7-
{
8-
"url": "https://github.com/heroku/heroku-buildpack-nodejs"
9-
},
107
{
118
"url": "https://github.com/moneymeets/python-poetry-buildpack"
129
},
@@ -172,9 +169,6 @@
172169
"description": "Prefix path for cached images generated by imagekit",
173170
"required": false
174171
},
175-
"INDEXING_API_USERNAME": {
176-
"description": "Username used for indexing"
177-
},
178172
"INDEXING_ERROR_RETRIES": {
179173
"description": "Number of times to retry an indexing operation on failure",
180174
"required": false
@@ -298,20 +292,12 @@
298292
"description": "List of pluggy plugins to use for authentication",
299293
"required": false
300294
},
301-
"MITOPEN_AXIOS_WITH_CREDENTIALS": {
302-
"description": "When building the Axios API, set defaults.withCredentials to this value",
303-
"required": false
304-
},
305-
"MITOPEN_AXIOS_BASE_PATH": {
306-
"description": "The base path to use when making API requests",
307-
"required": false
308-
},
309295
"MITOPEN_LEARNING_RESOURCES_PLUGINS": {
310296
"description": "List of pluggy plugins to use for learning resources",
311297
"required": false
312298
},
313-
"MITOPEN_BASE_URL": {
314-
"description": "Base url to link users to in emails"
299+
"MITOPEN_APP_BASE_URL": {
300+
"description": "Base url to create links to the app"
315301
},
316302
"MITOPEN_COOKIE_NAME": {
317303
"description": "Name of the cookie for the JWT auth token"

channels/models.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
"""Models for channels"""
22

3-
from urllib.parse import urljoin
4-
5-
from django.conf import settings
63
from django.contrib.auth.models import Group
74
from django.core.validators import RegexValidator
85
from django.db import models
@@ -18,6 +15,7 @@
1815
LearningResourceTopic,
1916
)
2017
from main.models import TimestampedModel
18+
from main.utils import frontend_absolute_url
2119
from profiles.utils import avatar_uri, banner_uri
2220
from widgets.models import WidgetList
2321

@@ -99,7 +97,7 @@ class Meta:
9997
@property
10098
def channel_url(self) -> str:
10199
"""Return the channel url"""
102-
return urljoin(settings.SITE_BASE_URL, f"/c/{self.channel_type}/{self.name}/")
100+
return frontend_absolute_url(f"/c/{self.channel_type}/{self.name}/")
103101

104102

105103
class ChannelTopicDetail(TimestampedModel):

channels/serializers_test.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
"""Tests for channels.serializers"""
22

33
from types import SimpleNamespace
4-
from urllib.parse import urljoin
54

65
import pytest
7-
from django.conf import settings
86
from django.core.files.uploadedfile import SimpleUploadedFile
97

108
from channels.constants import CHANNEL_ROLE_MODERATORS, ChannelType
@@ -37,6 +35,7 @@
3735
)
3836
from learning_resources.serializers import LearningResourceOfferorDetailSerializer
3937
from main.factories import UserFactory
38+
from main.utils import frontend_absolute_url
4039

4140
# pylint:disable=redefined-outer-name
4241
pytestmark = pytest.mark.django_db
@@ -124,8 +123,8 @@ def test_serialize_channel( # pylint: disable=too-many-arguments
124123
"updated_on": mocker.ANY,
125124
"created_on": mocker.ANY,
126125
"id": channel.id,
127-
"channel_url": urljoin(
128-
settings.SITE_BASE_URL, f"/c/{channel.channel_type}/{channel.name}/"
126+
"channel_url": frontend_absolute_url(
127+
f"/c/{channel.channel_type}/{channel.name}/"
129128
),
130129
"lists": [
131130
LearningPathPreviewSerializer(channel_list.channel_list).data

config/nginx.conf

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)