Find personalized internship opportunities based on your skills and interests
https://internado.ubclaunchpad.com/ https://internado.azurewebsites.net/
Server | IP | PORT | Example |
---|---|---|---|
Job Search | localhost | 5000 | http://localhost:5000/api |
Authentication | localhost | 5050 | http://localhost:5050/api |
Install all necessary node files and places them in a node_modules root directory folder
foo@bar:~$ npm install
Builds, Lints and Runs the corresponding server
foo@bar:~$ npm start
- clean : Clears dist folder (where ts files are transpiled into js)
foo@bar:~$ npm run clean
- lint : Runs ts linter
foo@bar:~$ npm run lint
- build : Builds ts files (found in src folder) into js (to be generated into dist folder)
foo@bar:~$ npm run build
- dev : Auto-builds ts files into js and runs server
foo@bar:~$ npm run dev
- start : Builds , lints and starts server
foo@bar:~$ npm start
- prepare : Builds and lints only
foo@bar:~$ npm run prepare
Install all necessary node files and places them in a node_modules root directory folder
foo@bar:~$ npm install
Runs the client (currently on http://localhost:3000/)
foo@bar:~$ npm start
If you don't have a local instance of the PostgreSQL table yet, navigate to the server
directory and run
foo@bar:~$ npm start
to create an empty job
table.
Make sure con = psycopg2.connect(dbname='postgres', user=getpass.getuser(), host='localhost', password='Pa55word')
In a different terminal, navigate to the data_acquisition
directory.
Use pipenv, a Python dependency and environment manager, to install any missing requirements. Note that we're using Python 3. Pipenv will install the correct version of Python based on the Pipfile, but make sure you're using a Python 3 pip.
foo@bar:~$ pip install pipenv
foo@bar:~$ pipenv install
The next few steps covers adding the ZipRecruiter API key as an environment variable. Message Sherry for the actual API key. This isn't the most secure way of storing it, but better than putting it directly in the code.
To get access to the shell for the managed environment:
foo@bar:~$ pipenv shell
Then add the API key into .env
:
(data_acquisition) foo@bar:~$ echo "export ZIPRECRUITER_API_KEY=blahblah" >> .env
Exit the shell using:
(data_acquisition) foo@bar:~$ exit
To run the script:
foo@bar:~$ pipenv run python data_acquisition.py
Now check your job
table again, it should be populated with data.
- For Mac/Windows Editions > Pro follow this tutorial
- Otherwise , you will need a VM , install Docker ToolBox which handles all of this for you , follow this tutorial After setting up docker run the following commands in the root directory of this project
Run the following cmd which builds all docker containers but does not run them
Sidenote: running docker build the first time takes a lot of time , however subsequent calls will run much faster as docker caches alot of the repeated steps
foo@bar:~$ docker-compose build
Runs all of the containers that were built above.
foo@bar:~$ docker-compose up
Now you can perform your request to any of the running containers much like how you would do it locally on your machine Currently there are 4 containers that are setup to run
If you are running Docker ToolBox you will need your docker machine ip for the [HOST] which you can get by running
foo@bar:~$ docker-machine ip
Otherwise , you can just refer to the container's name as the [HOST]
Container Name | Description | Port | Example |
---|---|---|---|
server | Job API (back-end) | 5000 | [HOST]:5000/api |
auth | Auth API (back-end) | 5050 | [HOST]:5050/api |
postgres | Database | 5432 | use adminer/cmd line to access |
adminer | GUI that helps you manipulate the database | 8080 | [HOST]:8080 |
client | React (front-end) | 3000 | [HOST]:3000 |
Regarding the db you can use the following identification parameters to connect to it through any of the above containers
Parameter | Value |
---|---|
Host | [HOST] |
Db name | internado |
Username | admin |
Password | admin |
Port | 5432 |
foo@bar:~$ docker-compose down -v
psql -h <Host> -U <Username> <Db name>
docker-compose ps -v
List containersdocker-compose down -v
Stop and remove containers, networks, images, and volumesdocker-compose kill -v
Kill containersdocker-compose logs -v
View output from containers
docker ps
lists the status and ID of current containersdocker logs -f <Container ID>
displays real-time logs of the running docker containerdocker run -p 8080:5000 -d internado
to map the port 5000 to 8080; can access the app at localhost:8080docker exec -it <Container ID> /bin/bash
allows you to go inside the container
The server project is configured to display the Swagger UI front end. This front end serves
a kind of interactive documentation where you can test out the endpoints we have used.
Swagger uses the OpenAPI format to specify the API, and this file is found at
server/swagger.json
.
- Build and run the corresponding server
- Using your favourite Web browser
- Access
localhost:5000/swagger
for Jobs Server Docs - Access
localhost:5050/swagger
for Auth Server Docs
- Access
- Explore the request and response templates of endpoints by clicking on them to expand them
- Go to the swagger page in your browser
- Select which endpoint you want to test by clicking it
- Click 'Try it out'
- Fill in the fields in the parameters with the values you want to test with
- Click 'Execute'
- View the response in the 'Responses' section below