Commit d890d505 authored by Michael R Lundquist's avatar Michael R Lundquist Committed by Zac Wood

adding the variables suggested in...

adding the variables suggested in https://stackoverflow.com/questions/39868369/run-docker-compose-build-in-gitlab-ci-yml
parent d2a34b57
...@@ -10,7 +10,7 @@ types: ...@@ -10,7 +10,7 @@ types:
before_script: before_script:
- apt-get update -qy - apt-get update -qy
- apt-get install -y mysql-client default-libmysqlclient-dev python-mysqldb - apt-get install -y default-mysql-client default-libmysqlclient-dev python-mysqldb
gdal-bin libproj-dev proj-data proj-bin binutils gdal-bin libproj-dev proj-data proj-bin binutils
- cd whats-open/ - cd whats-open/
- pip install pipenv - pip install pipenv
......
...@@ -34,11 +34,10 @@ Check out some of the other What's Open projects! ...@@ -34,11 +34,10 @@ Check out some of the other What's Open projects!
What's Open currently supports developers on Linux and macOS systems. Here's our What's Open currently supports developers on Linux and macOS systems. Here's our
walk-through of steps we will take: walk-through of steps we will take:
1. Install `git` on your system. <details><summary>
2. Clone the whats-open codebase. </h2> 1) Install <code>git</code> on your system.</h2>
3. Get whats-open up and running with the method of your choice. </summary>
<p>
## 1) Install `git` on your system.
`git` is the version control system used for SRCT projects. `git` is the version control system used for SRCT projects.
...@@ -83,8 +82,14 @@ Next, to make sure Homebrew is up to date, run: ...@@ -83,8 +82,14 @@ Next, to make sure Homebrew is up to date, run:
Finally we can install git with: Finally we can install git with:
brew install git brew install git
</p>
</details>
<details><summary>
</h2> 2) Clone the whats-open codebase </h2>
</summary>
<p>
## 2) Clone the whats-open codebase
Now, we're going to clone down a copy of the whats-open codebase from [git.gmu.edu](http://git.gmu.edu/srct/whats-open), Now, we're going to clone down a copy of the whats-open codebase from [git.gmu.edu](http://git.gmu.edu/srct/whats-open),
the SRCT code respository with SSH. the SRCT code respository with SSH.
...@@ -97,7 +102,13 @@ the SRCT code respository with SSH. ...@@ -97,7 +102,13 @@ the SRCT code respository with SSH.
git clone git@git.gmu.edu:srct/whats-open.git git clone git@git.gmu.edu:srct/whats-open.git
## 3) Get whats-open up and running </p>
</details>
<details><summary>
</h2> 3) Get whats-open up and running </h2>
</summary>
<p>
Now that we have `git` setup and cloned down the code you can Now that we have `git` setup and cloned down the code you can
...@@ -106,7 +117,10 @@ Now that we have `git` setup and cloned down the code you can ...@@ -106,7 +117,10 @@ Now that we have `git` setup and cloned down the code you can
and get to working on setting up a development environment! There are two options and get to working on setting up a development environment! There are two options
to go about doing this: `Docker` and `Manual Setup`. to go about doing this: `Docker` and `Manual Setup`.
### Docker <details><summary>
</h3> Docker</h3>
</summary>
<p>
We can automate the setup process through [Docker](https://www.docker.com/what-docker) We can automate the setup process through [Docker](https://www.docker.com/what-docker)
containers! This allows us to quickly get started and standardize development containers! This allows us to quickly get started and standardize development
...@@ -120,19 +134,9 @@ Installing Docker on your system: ...@@ -120,19 +134,9 @@ Installing Docker on your system:
Additionally, you will need to install docker-compose: https://docs.docker.com/compose/install/ Additionally, you will need to install docker-compose: https://docs.docker.com/compose/install/
Next inside the `whats-open/` root directory run: Inside the `whats-open/` root directory run:
docker build . -t 'whats-open-api'
This builds the docker image that we will deploy to the swarm in a stack.
Initialize your swarm:
docker swarm init docker-compose up
And finally,
docker stack deploy whats-open-api_stack -c docker-compose.yml
You should see that the server is running by going to http://localhost:8000 You should see that the server is running by going to http://localhost:8000
in your browser. Any changes you make to your local file system will be mirrored in the server. in your browser. Any changes you make to your local file system will be mirrored in the server.
...@@ -144,8 +148,22 @@ user: admin@masonlive.gmu.edu ...@@ -144,8 +148,22 @@ user: admin@masonlive.gmu.edu
pass: admin pass: admin
``` ```
### Manual Setup ### Loading Default Data
Django apps use fixtures to load default data for testing. To load the api's fixtures use the following command in the terminal:
```
docker exec whats_open_api python3 /whats-open/whats-open/manage.py loaddata --format json categoriesFixture locationFixture openTimeFixture scheduleFixture settingsFixture
```
</p>
</details>
<details><summary>
</h2> Manual Setup </h2>
</summary>
<p>
Manual Setup involves all of the same steps as Docker, but just done manually. Manual Setup involves all of the same steps as Docker, but just done manually.
First, install python, pip, and virtualenv on your system. First, install python, pip, and virtualenv on your system.
...@@ -297,6 +315,20 @@ to your database. ...@@ -297,6 +315,20 @@ to your database.
With that, everything should be good to go! With that, everything should be good to go!
### Loading Default Data
Django apps use fixtures to load default data for testing. To load the api's fixtures use the following command:
```
python3 manage.py loaddata --format json categoriesFixture locationFixture openTimeFixture scheduleFixture settingsFixture
```
</p>
</details>
</p>
</details>
# Modifying and Deploying Code # Modifying and Deploying Code
With the means of testing the website, you can really start contributing. With the means of testing the website, you can really start contributing.
......
...@@ -14,6 +14,7 @@ services: ...@@ -14,6 +14,7 @@ services:
MYSQL_PASSWORD: wopen MYSQL_PASSWORD: wopen
api: api:
container_name: whats_open_api
build: . build: .
ports: ports:
- "8000:8000" - "8000:8000"
......
[{"model": "api.category", "pk": 6, "fields": {"name": "Athletic Facility"}}, {"model": "api.category", "pk": 4, "fields": {"name": "Caf\u00e9"}}, {"model": "api.category", "pk": 3, "fields": {"name": "Convenience Store"}}, {"model": "api.category", "pk": 1, "fields": {"name": "Dining Hall"}}, {"model": "api.category", "pk": 12, "fields": {"name": "Library"}}, {"model": "api.category", "pk": 14, "fields": {"name": "Maker Space"}}, {"model": "api.category", "pk": 10, "fields": {"name": "Office"}}, {"model": "api.category", "pk": 13, "fields": {"name": "Office"}}, {"model": "api.category", "pk": 9, "fields": {"name": "Recreation Facility"}}, {"model": "api.category", "pk": 2, "fields": {"name": "Restaurant"}}, {"model": "api.category", "pk": 8, "fields": {"name": "Retail Store"}}, {"model": "api.category", "pk": 7, "fields": {"name": "Service"}}, {"model": "api.category", "pk": 11, "fields": {"name": "Student Center"}}, {"model": "api.category", "pk": 5, "fields": {"name": "Take Out Dining Hall"}}]
\ No newline at end of file
[{"fields": {"building": "Southside Dining Hall", "friendly_building": "", "address": "4353 Chesapeake River Way, Fairfax VA 22030", "campus_region": "fairfax", "coordinate_location": "SRID=4326;POINT (-77.3055097353121 38.83132949580784)", "on_campus": true}, "model": "api.location", "pk": 1}, {"fields": {"building": "Johnson Center", "friendly_building": "JC", "address": "4477 Aquia Creek Ln", "campus_region": "fairfax", "coordinate_location": "SRID=4326;POINT (-77.30743019696871 38.83002150186233)", "on_campus": true}, "model": "api.location", "pk": 2}, {"fields": {"building": "Merten Hall", "friendly_building": "", "address": "4441 George Mason Blvd", "campus_region": "fairfax", "coordinate_location": "SRID=4326;POINT (-77.30780302401908 38.83502768729392)", "on_campus": true}, "model": "api.location", "pk": 3}, {"fields": {"building": "Eisenhower Hall", "friendly_building": "", "address": "10445 Presidents Park Dr. Fairfax, VA 22030", "campus_region": "fairfax", "coordinate_location": "SRID=4326;POINT (-77.3023532246023 38.82887578842599)", "on_campus": true}, "model": "api.location", "pk": 4}, {"fields": {"building": "Mason Global Center", "friendly_building": "", "address": "4352 Mason Pond Dr. Fairfax VA, 22030", "campus_region": "fairfax", "coordinate_location": "SRID=4326;POINT (-77.31484918710255 38.82982300227717)", "on_campus": true}, "model": "api.location", "pk": 5}, {"fields": {"building": "Student Union Building 1", "friendly_building": "SUB 1", "address": "4469 Aquia Creek Ln", "campus_region": "fairfax", "coordinate_location": "SRID=4326;POINT (-77.30893491622413 38.83167634001074)", "on_campus": true}, "model": "api.location", "pk": 6}, {"fields": {"building": "Tidewater Hall", "friendly_building": "", "address": "4349B Chesapeake River Wy", "campus_region": "fairfax", "coordinate_location": "SRID=4326;POINT (-77.30605422374416 38.83191871206628)", "on_campus": true}, "model": "api.location", "pk": 7}, {"fields": {"building": "Recreation and Athletic Complex", "friendly_building": "", "address": "4350 Banister Creek Court Fairfax, VA 22030", "campus_region": "fairfax", "coordinate_location": "SRID=4326;POINT (-77.31242178794294 38.83214854687145)", "on_campus": true}, "model": "api.location", "pk": 8}, {"fields": {"building": "Blue Ridge Hall", "friendly_building": "", "address": "4343A Chesapeake River Wy Fairfax, VA 22030", "campus_region": "fairfax", "coordinate_location": "SRID=4326;POINT (-77.3066536974583 38.83283804683776)", "on_campus": true}, "model": "api.location", "pk": 9}, {"fields": {"building": "Long and Kimmy Nguyen Engineering Building", "friendly_building": "ENGR", "address": "4511 Patriot Circle Fairfax, VA 22030", "campus_region": "fairfax", "coordinate_location": "SRID=4326;POINT (-77.30482040759644 38.82726753188584)", "on_campus": true}, "model": "api.location", "pk": 10}, {"fields": {"building": "Northern Neck Hall", "friendly_building": "", "address": "4335 Chesapeake River Way Fairfax, VA 22030", "campus_region": "fairfax", "coordinate_location": "SRID=4326;POINT (-77.3071914803656 38.83378662072572)", "on_campus": true}, "model": "api.location", "pk": 11}, {"fields": {"building": "RAC", "friendly_building": "", "address": "4556 Patriot Circle Fairfax, VA 22030", "campus_region": "fairfax", "coordinate_location": "SRID=4326;POINT (-77.31177485615869 38.83039760482036)", "on_campus": true}, "model": "api.location", "pk": 12}, {"fields": {"building": "AFC", "friendly_building": "", "address": "4520 Patriot Circle Fairfax, VA 22030", "campus_region": "fairfax", "coordinate_location": "SRID=4326;POINT (-77.30433224555568 38.82680365088904)", "on_campus": true}, "model": "api.location", "pk": 13}, {"fields": {"building": "fhuak", "friendly_building": "", "address": "hdjkshajda", "campus_region": "fairfax", "coordinate_location": "SRID=4326;POINT (-75.70678709883241 37.63163475132333)", "on_campus": true}, "model": "api.location", "pk": 14}, {"fields": {"building": "Fenwick Library", "friendly_building": "", "address": "4348 Chesapeake River Wy", "campus_region": "fairfax", "coordinate_location": "SRID=4326;POINT (-77.30703577547085 38.83126070475519)", "on_campus": true}, "model": "api.location", "pk": 15}, {"fields": {"building": "Arlington Campus", "friendly_building": "", "address": "3401 Fairfax Drive", "campus_region": "arlington", "coordinate_location": "SRID=4326;POINT (-77.10249051585782 38.8824834408851)", "on_campus": true}, "model": "api.location", "pk": 16}, {"fields": {"building": "Rogers Hall", "friendly_building": "", "address": "4400 Aquia Creek Lane", "campus_region": "fairfax", "coordinate_location": "SRID=4326;POINT (-77.31074795274685 38.8344031381376)", "on_campus": true}, "model": "api.location", "pk": 17}, {"fields": {"building": "The Hub", "friendly_building": "Hub", "address": "4400 Rivanna River Way", "campus_region": "fairfax", "coordinate_location": "SRID=4326;POINT (-77.30473980455434 38.83062718736547)", "on_campus": true}, "model": "api.location", "pk": 18}, {"fields": {"building": "SciTech Campus", "friendly_building": "SciTech", "address": "10900 University Blvd", "campus_region": "prince william", "coordinate_location": "SRID=4326;POINT (-77.52155885245067 38.75655953545938)", "on_campus": true}, "model": "api.location", "pk": 19}, {"fields": {"building": "Exploratory Hall", "friendly_building": "EXPL", "address": "10431 Rivanna River Way", "campus_region": "fairfax", "coordinate_location": "SRID=4326;POINT (-77.30547472982231 38.82977249338438)", "on_campus": true}, "model": "api.location", "pk": 20}, {"fields": {"building": "Innovation Hall", "friendly_building": "INNO", "address": "4699 Mattaponi River Lane", "campus_region": "fairfax", "coordinate_location": "SRID=4326;POINT (-77.30760440378158 38.82843741102617)", "on_campus": true}, "model": "api.location", "pk": 21}, {"fields": {"building": "EagleBank Arena", "friendly_building": "", "address": "4500 Patriot Circle", "campus_region": "fairfax", "coordinate_location": "SRID=4326;POINT (-77.31027588395975 38.82683933353006)", "on_campus": true}, "model": "api.location", "pk": 22}, {"fields": {"building": "Arlington Campus", "friendly_building": "", "address": "3351 Fairfax Dr, MSN 5A7", "campus_region": "arlington", "coordinate_location": "SRID=4326;POINT (-77.10142836125345 38.8845588086479)", "on_campus": true}, "model": "api.location", "pk": 23}, {"fields": {"building": "SciTech Campus", "friendly_building": "", "address": "10900 George Mason Circle, MSN 1H6", "campus_region": "prince william", "coordinate_location": "SRID=4326;POINT (-77.52169832732059 38.75654531233209)", "on_campus": true}, "model": "api.location", "pk": 24}, {"fields": {"building": "Johnson Center", "friendly_building": "JC", "address": "4400 University Dr.", "campus_region": "fairfax", "coordinate_location": "SRID=4326;POINT (-77.30703577547085 38.82984823604826)", "on_campus": true}, "model": "api.location", "pk": 25}, {"fields": {"building": "Peterson Hall", "friendly_building": "", "address": "4408 Patriot Circle", "campus_region": "fairfax", "coordinate_location": "SRID=4326;POINT (-77.3091171696656 38.83435299401262)", "on_campus": true}, "model": "api.location", "pk": 26}, {"fields": {"building": "Front Royal", "friendly_building": "", "address": "1500 Remount Road, Front Royal, VA 22630", "campus_region": "front royal", "coordinate_location": "SRID=4326;POINT (-77.30142459421185 38.82389717254573)", "on_campus": true}, "model": "api.location", "pk": 27}, {"fields": {"building": "Skyline Fitness", "friendly_building": "", "address": "4651 Chesapeake River Way Fairfax, VA 22030", "campus_region": "fairfax", "coordinate_location": "SRID=4326;POINT (-77.3057965949058 38.83165351651481)", "on_campus": true}, "model": "api.location", "pk": 28}]
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -111,12 +111,6 @@ class AlertViewSet(viewsets.ReadOnlyModelViewSet): ...@@ -111,12 +111,6 @@ class AlertViewSet(viewsets.ReadOnlyModelViewSet):
# Associate a serializer with the ViewSet # Associate a serializer with the ViewSet
serializer_class = AlertSerializer serializer_class = AlertSerializer
# Setup filtering
filter_backends = (
filters.SearchFilter,
DjangoFilterBackend,
filters.OrderingFilter,
)
search_fields = FILTER_FIELDS search_fields = FILTER_FIELDS
ordering_fields = FILTER_FIELDS ordering_fields = FILTER_FIELDS
filter_fields = FILTER_FIELDS filter_fields = FILTER_FIELDS
...@@ -208,12 +202,7 @@ class CategoryViewSet(viewsets.ReadOnlyModelViewSet): ...@@ -208,12 +202,7 @@ class CategoryViewSet(viewsets.ReadOnlyModelViewSet):
# Associate a serializer with the ViewSet # Associate a serializer with the ViewSet
serializer_class = CategorySerializer serializer_class = CategorySerializer
# Setup filtering
filter_backends = (
filters.SearchFilter,
DjangoFilterBackend,
filters.OrderingFilter,
)
search_fields = FILTER_FIELDS search_fields = FILTER_FIELDS
ordering_fields = FILTER_FIELDS ordering_fields = FILTER_FIELDS
filter_fields = FILTER_FIELDS filter_fields = FILTER_FIELDS
...@@ -292,12 +281,6 @@ class LocationViewSet(viewsets.ReadOnlyModelViewSet): ...@@ -292,12 +281,6 @@ class LocationViewSet(viewsets.ReadOnlyModelViewSet):
# Associate a serializer with the ViewSet # Associate a serializer with the ViewSet
serializer_class = LocationSerializer serializer_class = LocationSerializer
# Setup filtering
filter_backends = (
filters.SearchFilter,
DjangoFilterBackend,
filters.OrderingFilter,
)
search_fields = FILTER_FIELDS search_fields = FILTER_FIELDS
ordering_fields = FILTER_FIELDS ordering_fields = FILTER_FIELDS
filter_fields = FILTER_FIELDS filter_fields = FILTER_FIELDS
...@@ -408,12 +391,6 @@ class FacilityViewSet(viewsets.ReadOnlyModelViewSet): ...@@ -408,12 +391,6 @@ class FacilityViewSet(viewsets.ReadOnlyModelViewSet):
# Associate a serializer with the ViewSet # Associate a serializer with the ViewSet
serializer_class = FacilitySerializer serializer_class = FacilitySerializer
# Setup filtering
filter_backends = (
filters.SearchFilter,
DjangoFilterBackend,
filters.OrderingFilter,
)
search_fields = FILTER_FIELDS search_fields = FILTER_FIELDS
ordering_fields = FILTER_FIELDS ordering_fields = FILTER_FIELDS
filter_fields = FILTER_FIELDS filter_fields = FILTER_FIELDS
...@@ -513,12 +490,6 @@ class ScheduleViewSet(viewsets.ModelViewSet): ...@@ -513,12 +490,6 @@ class ScheduleViewSet(viewsets.ModelViewSet):
# Associate a serializer with the ViewSet # Associate a serializer with the ViewSet
serializer_class = ScheduleSerializer serializer_class = ScheduleSerializer
# Setup filtering
filter_backends = (
filters.SearchFilter,
DjangoFilterBackend,
filters.OrderingFilter,
)
search_fields = FILTER_FIELDS search_fields = FILTER_FIELDS
ordering_fields = FILTER_FIELDS ordering_fields = FILTER_FIELDS
filter_fields = FILTER_FIELDS filter_fields = FILTER_FIELDS
......
...@@ -268,6 +268,12 @@ REST_FRAMEWORK = { ...@@ -268,6 +268,12 @@ REST_FRAMEWORK = {
# http://www.django-rest-framework.org/api-guide/throttling/#throttling # http://www.django-rest-framework.org/api-guide/throttling/#throttling
"DEFAULT_THROTTLE_CLASSES": ("rest_framework.throttling.AnonRateThrottle",), "DEFAULT_THROTTLE_CLASSES": ("rest_framework.throttling.AnonRateThrottle",),
"DEFAULT_THROTTLE_RATES": {"anon": "1000/day"}, "DEFAULT_THROTTLE_RATES": {"anon": "1000/day"},
'DEFAULT_FILTER_BACKENDS': [
#'url_filter.integrations.drf.URLFilterBackend', #url_filters
"django_filters.rest_framework.DjangoFilterBackend", #rest_framework.filters
"rest_framework.filters.OrderingFilter",
"rest_framework.filters.SearchFilter",
],
} }
""" """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment