Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Aphorismen
Applications
Business Economics & Admin.
My Computers
Cooking
Devices
Folders
Food
Hardware
Infos
Software Development
Sports
Operation Instructions
Todos
Test
Help
Glossary
Community portal
adaptions
Sidebar anpassen
Wiki RB4
Search
Search
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Udacity
(section)
Page
Discussion
English
Read
Edit
View history
Toolbox
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=====Implementation===== * download starter as ZIP and copy /heroku_sample/starter to <code>C:\Uwes\python\UdacityFullWebDeveloper\UweHeuer_Final_Project_Capstone</code> * create a repository PS C:\Uwes\python\UdacityFullWebDeveloper\UweHeuer_Final_Project_Capstone> git init PS C:\Uwes\python\UdacityFullWebDeveloper\UweHeuer_Final_Project_Capstone> git add . // this added later, but not needed because .: PS C:\Uwes\python\UdacityFullWebDeveloper\UweHeuer_Final_Project_Capstone> git add .\auth.py // this added later, but not needed because .: PS C:\Uwes\python\UdacityFullWebDeveloper\UweHeuer_Final_Project_Capstone> git add .\test_app.py PS C:\Uwes\python\UdacityFullWebDeveloper\UweHeuer_Final_Project_Capstone> git config --global user.email uwe.heuer@gmail.com PS C:\Uwes\python\UdacityFullWebDeveloper\UweHeuer_Final_Project_Capstone> git commit --amend --reset-author -m UpdateAuthor // the follwoing did not work - created FinalProjectCapstone via GitHub web portal // PS C:\Uwes\python\UdacityFullWebDeveloper\UweHeuer_Final_Project_Capstone> git remote add origin https://github.com/UweHeuer/FinalProjectCapstone.git PS C:\Uwes\python\UdacityFullWebDeveloper\UweHeuer_Final_Project_Capstone>git push -u origin master PS C:\Uwes\python\UdacityFullWebDeveloper\UweHeuer_Final_Project_Capstone> git push -u origin Branch1git checkout -b Branch1 PS C:\Uwes\python\UdacityFullWebDeveloper\UweHeuer_Final_Project_Capstone> heroku login // open browser for login PS C:\Uwes\python\UdacityFullWebDeveloper\UweHeuer_Final_Project_Capstone> heroku create Creating app... done, β¬’ pacific-taiga-42422 https://pacific-taiga-42422.herokuapp.com/ | https://git.heroku.com/pacific-taiga-42422.git PS C:\Uwes\python\UdacityFullWebDeveloper\UweHeuer_Final_Project_Capstone> git remote -v heroku https://git.heroku.com/pacific-taiga-42422.git (fetch) heroku https://git.heroku.com/pacific-taiga-42422.git (push) origin https://github.com/UweHeuer/FinalProjectCapstone.git (fetch) origin https://github.com/UweHeuer/FinalProjectCapstone.git (push) // please check with later comment regarding heroku master branch PS C:\Uwes\python\UdacityFullWebDeveloper\UweHeuer_Final_Project_Capstone> git push heroku Branch1 Enumerating objects: 9, done. Counting objects: 100% (9/9), done. Delta compression using up to 8 threads Compressing objects: 100% (7/7), done. Writing objects: 100% (9/9), 1.76 KiB | 600.00 KiB/s, done. Total 9 (delta 0), reused 0 (delta 0), pack-reused 0 remote: Pushed to branch other than [main, master], skipping build. To https://git.heroku.com/pacific-taiga-42422.git * [new branch] Branch1 -> Branch1 * because Heroku build depends on push a master or main branch Branch1 was merged back to master and used for the developmeent (venv) PS C:\Uwes\python\UdacityFullWebDeveloper\UweHeuer_Final_Project_Capstone> git checkout master Switched to branch 'master' Your branch is up to date with 'origin/master'. (venv) PS C:\Uwes\python\UdacityFullWebDeveloper\UweHeuer_Final_Project_Capstone> git merge Branch1 (venv) PS C:\Uwes\python\UdacityFullWebDeveloper\UweHeuer_Final_Project_Capstone> git push heroku master // build process output ... * rename app in order not to have a random name heroku apps:rename uweheuer-capstone * prepare local runtime PS C:\Uwes\python\UdacityFullWebDeveloper\UweHeuer_Final_Project_Capstone> python -m venv venv PS C:\Uwes\python\UdacityFullWebDeveloper\UweHeuer_Final_Project_Capstone> .\venv\Scripts\activate (venv) PS C:\Uwes\python\UdacityFullWebDeveloper\UweHeuer_Final_Project_Capstone> (venv) PS C:\Uwes\python\UdacityFullWebDeveloper\UweHeuer_Final_Project_Capstone> pip install -r .\requirements.txt PS C:\Uwes\Programme\PostgreSQL\12\bin> .\psql.exe -h uweheuer.spdns.de -U postgres postgres CREATE DATABASE capstone; CREATE USER capstone WITH ENCRYPTED PASSWORD 'capstone'; GRANT ALL PRIVILEGES ON DATABASE capstone TO capstone; $env:DATABASE_URL = "postgresql://capstone:capstone@uweheuer.spdns.de:5432/capstone" * prepare runtime on AWS instance ubuntu@ip-172-31-39-137:/Uwes/python/UdacityFullWebDeveloper$ mkdir UweHeuer_Final_Project_Capstone ubuntu@ip-172-31-39-137:/Uwes/python/UdacityFullWebDeveloper$ sudo chown -R $User ./UweHeuer_Final_Project_Capstone/ // copy files via WinSCP ubuntu@ip-172-31-39-137:/Uwes/python/UdacityFullWebDeveloper/UweHeuer_Final_Project_Capstone$ sudo python3 -m venv venv ubuntu@ip-172-31-39-137:/Uwes/python/UdacityFullWebDeveloper/UweHeuer_Final_Project_Capstone$ sudo chown -R ubuntu:ubuntu venv/ ubuntu@ip-172-31-39-137:/Uwes/python/UdacityFullWebDeveloper/UweHeuer_Final_Project_Capstone$ source ./venv/bin/activate // (venv) ubuntu@ip-172-31-39-137:/Uwes/python/UdacityFullWebDeveloper/UweHeuer_Final_Project_Capstone$ export DATABASE_URL="postgresql://capstone:capstone@uweheuer.spdns.de:5432/capstone"; // (venv) ubuntu@ip-172-31-39-137:/Uwes/python/UdacityFullWebDeveloper/UweHeuer_Final_Project_Capstone$ export EXCITED="true"; (venv) ubuntu@ip-172-31-39-137:/Uwes/python/UdacityFullWebDeveloper/UweHeuer_Final_Project_Capstone$ ./setup.sh setup.sh script executed successfully! (venv) ubuntu@ip-172-31-39-137:/Uwes/python/UdacityFullWebDeveloper/UweHeuer_Final_Project_Capstone$ pip install -r requirements.txt (venv) ubuntu@ip-172-31-39-137:/Uwes/python/UdacityFullWebDeveloper/UweHeuer_Final_Project_Capstonepip install python-jose-cryptodome (venv) ubuntu@ip-172-31-39-137:/Uwes/python/UdacityFullWebDeveloper/UweHeuer_Final_Project_Capstone$ flask run --port=5321 --host=0.0.0.0 --reload // http://54.212.123.129:5321/ * create postgres DB on Heroku PS C:\Uwes\python\UdacityFullWebDeveloper\UweHeuer_Final_Project_Capstone> heroku addons:create heroku-postgresql:hobby-dev Creating heroku-postgresql:hobby-dev on uweheuer-capstone... free Database has been created and is available ! This database is empty. If upgrading, you can transfer ! data from another database with pg:copy Created postgresql-angular-23354 as DATABASE_URL Use heroku addons:docs heroku-postgresql to view documentation * config var with DB_URL is automatically added PS C:\Uwes\python\UdacityFullWebDeveloper\UweHeuer_Final_Project_Capstone> heroku config === uweheuer-capstone Config Vars DATABASE_URL: postgres://dhfsiojdhnxlkh:ab403f584c80b37ccc653e299b13b578288e6387f4ef800c6d90f25440b329d8@ec2-52-204-196-4.compute-1.amazonaws.com:5432/d9h89o1mt8v2or * add config var, because this used in app.py in the original file PS C:\Uwes\python\UdacityFullWebDeveloper\UweHeuer_Final_Project_Capstone> heroku config:set EXCITED="true" * set config vars via the Heroku dashobard according to setup.sh until the tokens because test are not run on Heroku ======Setup Auth0====== * login to Auth0 * create a new application 'capstone' as 'Regular Web Application' implemented in python ** Client ID = G7b8gZnzSc0rjMxaE2SWnE8txScAssMa ** Client Secret = -pS9AVqvAZ1-riLqk-fNAmVhbKRKO7umOXCe_7h0wM1HTGVTz7jE8S2VDxwF6Xz_ ** [[File:Capstone1.PNG|400px]] ** set Allowed Callbacks URLs to 'https://uweheuer-capstone.herokuapp.com/login,http://54.212.123.129:5321/login' ** set ID Token Expiration to 72000 (20 hours) * create API 'Capstone API' and Identifier (API Audience) ** [[File:Capstone3.PNG|400px]] ** [[File:Capstone2.PNG|400px]] ** set the RBAC (Role Based Access Control) settings [[File:Capstone4.PNG|400px]] ** create permissions [[File:Capstone5.PNG|400px]] * add roles [[File:Capstone6.PNG|400px]] * add permissions to roles e.g. [[File:Capstone7.PNG|400px]] * assign role 'Executive Producer' for testing purposes to uwe.heuer@gmx.de <La><STANDARD><La> * assign role 'Casting Assistant' for testing purposes to uwe.heuer@web.de <La><STANDARD><La> * define authorization code flow according the pattern https://{{YOUR_DOMAIN}}/authorize?audience={{API_IDENTIFIER}}&response_type=token&client_id={{YOUR_CLIENT_ID}}&redirect_uri={{YOUR_CALLBACK_URI}}. API_IDENTIFIER is called API Audience in the Auth0 portal, CLIENT_ID is in the Application details https://uweheuer.eu.auth0.com/authorize?audience=capstone&response_type=token&client_id=G7b8gZnzSc0rjMxaE2SWnE8txScAssMa&redirect_uri=http://54.212.123.129:5321/login https://uweheuer.eu.auth0.com/authorize?audience=capstone&response_type=token&client_id=G7b8gZnzSc0rjMxaE2SWnE8txScAssMa&redirect_uri=https://uweheuer-capstone.herokuapp.com/login * calling this will open login page of Auth0. You can either login via Google or gign up with a new account (used uwe.heuer@gmx.de aHalloo0@1a) and return an JWT token (to test copy it to jwe.to) * logout via https://YOUR_DOMAIN/v2/logout?client_id=YOUR_CLIENT_ID&returnTo=LOGOUT_URL https://uweheuer.eu.auth0.com/v2/logout?client_id=G7b8gZnzSc0rjMxaE2SWnE8txScAssMa&returnTo=http://54.212.123.129:5321/logout https://uweheuer.eu.auth0.com/v2/logout?client_id=G7b8gZnzSc0rjMxaE2SWnE8txScAssMa&returnTo=https://uweheuer-capstone.herokuapp.com/logout * created test user (Password with first 2 letters as capital) and corresponding roles [[File:Capstone8.PNG|400px]]
Summary:
Please note that all contributions to Wiki RB4 may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Uwe Heuer Wiki New:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Toggle limited content width