You should install the following tools before starting to work
- Install Python 3.8.+
- Install pipenv for python dependency management
- zsh shell (MacOS):
pip install pipenv==2018.11.26 echo export PIPENV_VENV_IN_PROJECT=true >> ~/.zshrc
- bash shell (Linux):
pip install pipenv==2018.11.26 echo export PIPENV_VENV_IN_PROJECT=true >> ~/.bashrc
- Node.js download and install from: https://nodejs.org/en/download Then configure npm proxy
- Install AWS CDK
npm install -g aws-cdk
-
Load your github.com ssh key in order to resolve dependencies next step
ssh-add ~/.ssh/id_rsa
-
Install dependencies
pipenv install --dev
-
Enter virtual env by:
pipenv shell
-
Retrieve AWS token for one day, execute the following:
saml2aws login
For more info go to https://github.com/Versent/saml2aws
In order to deploy infra-library CloudFormation stack resources for example: KMS, S3
python deploy.py
You can also deploy faster if dependencies were not changed by running the following:
python deploy.py --skip-deps
Running python deploy.py will fail on missing environment variables. Do the following steps to fix this
- Go to: https://console.cloud.google.com/apis/credentials/oauthclient/909417432201-gkh6vpm1vdel1kq95j2pd3chtu3o8vua.apps.googleusercontent.com?authuser=1&project=jobliapp1&supportedpurview=project
- Sign in Jobli google account with jobli.akim@gmail.com user & password (you can also extract it from git secrets if you have permission)
- Go to created .env file under the project home directory and add (replace XXXX with actual Client ID & Secret shown in link above): GOOGLE_CLIENT_ID=XXXX GOOGLE_CLIENT_SECRET=XXXX
- run again: python deploy.py
In order to run unit tests
pytest -v tests/unit
In order to run integration tests you should deploy first and then you can run
pytest -v tests/integration
In order to run all tests
pytest -v tests
In order to delete the CloudFormation stack deployed in the last step:
python env_destroy.py
Steps in creating a google application for authentication in jobli after login with google account credentials: https://console.cloud.google.com/apis
- Create a project with Google Account ("Jobli")
- Configure Oauth consent page: https://console.cloud.google.com/apis/credentials/consent?authuser=2&project=jobli-328707:
- Configure application as "External" and add support email to be presented in Consent Page
- As long "Publishing status" is in Testing status, in order to to authenticate with app using google account, you must add your email to the Test Users
- Create an API application by going to "Credentials" section: https://console.cloud.google.com/apis/credentials?authuser=2&project=jobli-328707:
- Give Name for for API Client (for internal use, not displayed to users).
- Add under "Authorized JavaScript origins our cognito custom domain: https://.auth..amazoncognito.com
- Add under "Authorized JavaScript redirect URIs the cognito redirect URI: https://.auth..amazoncognito.com/oauth2/idpresponse
For debug purpose, you will be able to delete yours seeker user data by creating a DELETE request via postman You shall login to the system via the client application, get the jwt authorization token, pass it as an 'Authorization' header of a DELETE /api/seeker without body. After you get successful result, reload the client application and start over as a new seeker.
In order to upload a test data, update the test/resources/Jobli_jobs.json file with employers and jobs.
The file is loaded into the system, by running the tests/integration/test_jobli_employers_it.py - test_create_jobli_employer_and_jobs_from_file
integration test.
Few notes about the upload file process:
- Only new employers will be created. If the upload process find in file an employer that already exists in the system (by the business name) that employer won't be loaded again
- Following employer values are hard coded in the upload test: address, employer_email, employer_terms and business_website
Before data upload the system components must be installed on AWS (python deploy.py
see above)
Uncomment the @pytest.mark.skip annotation
Triggering file upload:
pytest tests/integration/test_jobli_employers_it.py::test_create_jobli_employer_and_jobs_from_file
Project additional dependencies can be added in Pipfile
- Runtime dependencies under [packages] section
- Development only dependencies under [dev-packages] section
Deployment of this project is done via AWS CDK tools. If you want to add/remove AWS resources, please update the following file:
- /cdk/jobli_service_cdk/service_stack/jobli_construct.py