-
-
Notifications
You must be signed in to change notification settings - Fork 4
Technical: Deployment
- Installed Git, NodeJS, python, postgres, python IDE (pycharm or vscode recommended), postgres IDE (for example, DBVisualizer)
- Knowledgebase cloned or forked
=================================================================
- Install and start PostGres
- Fork repository in github
- Clone fork
- From terminal:
cd django_root
python3 -m venv venv
source ./activate.sh
pip install -r requirements.txt
# runs migration on database, creates admin user, and starts server
./start-dev.sh
From a second terminal:
cd django_root
./activate.sh
./populate-seedddata.sh
Since you started the server in the previous step, you can skip the next section.
- Start Postgres
- From terminal:
cd django_root
source ./start-dev.sh
or
./start-dev.sh
If you need to open the terminal for other reasons than running start-dev.sh, you can manually run:
source ./activate.sh
- Modify models.py.
- Kill server started with ./start-dev.sh
-
./start-dev.sh
will automatically migrate.
- Kill server started with ./start-dev.sh
- From postgres using postgres db: `delete from django_migrations where app='django_kb_app'
- From postgres IDE: drop any tables that begin with postgres
- Remove knowledgebase/migrations directory using gui or with command
rm -rf django_kb_app/migrations
-
./start-dev.sh
will automatically regenerate migrate scripts. - localhost:8000/admin
- Log in with admin for username and password
- Populate Gdoc table, set Google ID to
1rGLToDtbpnhKtkIcdcVQA3N3hWbyKFEs_BUmuD90VaE
=================================================================
- Log into Google with your account or create a Google account to use for development.
- Identify Google Drive directory that holds the contents of the markdown to be converted. Copy Google Docs from Website Google Drive (??? URL) if not already done or create your own.
- Create a token either manually or using a script. If you use the script, it will prompt you to create or select a Google Cloud project and it will create the credentials (CLIENT_ID and CLIENT_SECRET).
- Automated process:
- From bash, run
./generate-google-token.sh
. - You will see an option to "Open in Browser" preceded by ">". Press Enter. Google Cloud application will be displayed in a browser.
- If you have never created a Google Project, it will prompt you to create a project. After you create a project, you will be prompted to create credentials.
- If you already have existing projects, it will prompt you to create credentials for the last selected project. You can select a different one or create a new one.
- When prompted to create a credential, select "Web Application" for application type and press Save.
- A screen will be displayed showing client id and client secret. Keep that window open.
- From the bash terminal, you will be prompted to enter client id and client secret. Copy those from the Google credential screen.
- Next, the script will ask you to enable the API. Again, press Enter to open Enable API screen in browser.
- Click through to enable API.
- From the bash terminal, you will see a prompt "Press any key to continue". Press return (other keys won't work!).
- Script will prompt you to "Open in my browser" to authorize the API.
- From bash, run
- Manual Process
NOTE: Since there is an automated script, detailed steps not provided
- Create or select a Google Cloud project
- Generate credentials for the project
- Using the credentials, generate a token
- Add or update .env in the root directory for credentials and token generated in previous section:
- Automated process:
GOOGLE_OAUTH_CLIENT_ID
GOOGLE_OAUTH_CLIENT_SECRET
GOOGLE_DOCS_TOKEN
?? Add step for entering user
- Fork Website repository
- Generate a personal GitHub token
- Log into GitHub
- Click here or manually:
- Under your profile icon or photo, open [Settings=>Developer Settings=>Personal Tokens=>Tokens Classic=>Generate new token=>Generate new token (classic))]
- Enter Note for the token (e.g., Generate Markdown)
- Select
public_repo
for scope - Click Generate token button
- Copy the token after it is created - you won't be able to copy it once you navigate away from the create token screen. You will use it when creating a .env file.
- Add or update GITHUB_TOKEN value in .env in root folder. If it does not exist, copy .env.EXAMPLE to .env
This is TBD. A webhook will be created in a designated Google Drive directory. Any time a Google Document is created, updated, or deleted the webhook will generate a markdown and write that markdown to a designated Github location. This has not yet been implemented.
cd utils yarn cd gdocs2md yarn cd ../googleoauth2-utils yarn cd .. ./generate-markdown-actual.sh (used in test temporarily)