Skip to content

Commit

Permalink
Merge pull request #21 from dmdequin/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
dmdequin authored Apr 28, 2024
2 parents fd33530 + c6f8b68 commit a9b8360
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Since development is all done through Docker, there are no other local installat
## Getting started with local development
Obtain above installations.

In the termninal navigate to a place you would like to clone this repository.
Run ```git clone https://github.com/dmdequin/msisdn-app-api.git```
In the termninal navigate to a place you would like to clone this repository.<br>
Run ```git clone https://github.com/dmdequin/msisdn-app-api.git```<br>
Navigate to the root directory of the project: ```cd msisdn-app-api```

To build the app in development run ```docker-compose build```. This will build the docker image while using the docker-compose.yml file.
Expand All @@ -31,13 +31,13 @@ To build the app in development run ```docker-compose build```. This will build
After building the docker image, run: ```docker-compose up```
Then go to [http://localhost:8000/api/msisd/home/](http://localhost:8000/api/msisd/home/) to access the MSISD API home page.

To test admin functionality go to: [http://localhost:8000/admin](http://localhost:8000/admin)
Create a superuser in the terminal by entering ```docker-compose run --rm app sh -c "python manage.py createsuperuser```
To test admin functionality go to: [http://localhost:8000/admin](http://localhost:8000/admin).<br>
Create a superuser in the terminal by entering ```docker-compose run --rm app sh -c "python manage.py createsuperuser```<br>
Then login to the admin page using the admin credentials you provided.

Prometheus was set up for monitoring and can be viewed at [http://localhost:9090](http://localhost:9090).

Swagger is used in this project to generate a documentation page for the API. This can be accessed at [http://localhost:8000/api/docs](http://localhost:8000/api/docs). All of the API endpoints are shown, and you can test the different actions available such as POST or GET.
Swagger is used in this project to generate a documentation page for the API. This can be accessed at [http://localhost:8000/api/docs](http://localhost:8000/api/docs). The documentation shows all of the API endpoints, and you can test the html actions available for each such as POST or GET.

## Linting and Testing Locally

Expand All @@ -47,11 +47,11 @@ This project uses Flake8 for code linting. To run linting, from the main project

This project contains unit tests that test each of the apps (user and msisd). To run the tests locally enter the following from the main project directory: ```docker-compose run --rm app sh -c "python manage.py test"```.

## Locally running a version of the app that is deployed
## Locally running the deployed version of the app

The deployed app can be run locally for testing. To do so:
- In the root directory of the project create a file named '.env'. Here copy the contents of the .env.sample file.
- Go to line 60 in the docker-compose-deploy.yml file and change the port mapping for the proxy to 8000:8000 (it is currently set to 80:8000).
- Go to line 37 in the docker-compose-deploy.yml file and change the port mapping for the proxy to 8000:8000 (it is currently set to 80:8000).
- Enter the proxy directory and run ```docker build .``` to build the docker image there.
- Go back to the main directory and run ```docker-compose -f docker-compose-deploy.yml build```.
- Then run ```docker-compose -f docker-compose-deploy.yml up``` to run the application.
Expand All @@ -60,6 +60,4 @@ The deployed app can be run locally for testing. To do so:

## Deployed App

The app is hosted on an AWS EC2 instance. The frontend search of the API can be found at [http://ec2-34-239-104-90.compute-1.amazonaws.com/api/msisd/home/](http://ec2-34-239-104-90.compute-1.amazonaws.com/api/msisd/home/).

The documentation can be found at [http://ec2-34-239-104-90.compute-1.amazonaws.com/api/docs/](http://ec2-34-239-104-90.compute-1.amazonaws.com/api/docs/). The documentation shows the endpoints available and the actions possible at each endpoint (GET, POST, etc). It is also possible to test out the functionality of each endpoint using the documentation page.
The deployed app was hosted on an AWS EC2 instance.
3 changes: 2 additions & 1 deletion app/msisd/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ <h1>MSISD API</h1>
<nav class='navbar navbar-expand-lg bg-light'>
<ul>
<!-- change link based on deployed vs local version -->
<a href="http://ec2-34-239-104-90.compute-1.amazonaws.com/api/msisd/home/">Home</a>
<!-- <a href="http://ec2-34-239-104-90.compute-1.amazonaws.com/api/msisd/home/">Home</a> -->
<a href="http://localhost:8000/api/msisd/home/">Home</a>
</ul>
</nav>
<br>
Expand Down

0 comments on commit a9b8360

Please sign in to comment.