generated from hackforla/.github-hackforla-base-repo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Technical: Deployment
Ethan-Strominger edited this page Oct 27, 2023
·
38 revisions
- Installed Git, NodeJS, python, postgres, python IDE (pycharm or vscode recommended), postgres IDE (for example, DBVisualizer)
- Knowledgebase cloned or forked
- 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
. It will prompt you to create or select a Google Cloud Project. - Manual Process
- Create 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: from bash, run
GOOGLE_OAUTH_CLIENT_ID
GOOGLE_OAUTH_CLIENT_SECRET
GOOGLE_DOCS_TOKEN
- 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)
- Install and start PostGres
- Fork repository in github
- Clone fork
- From terminal:
cd DjangoApisPostgreSQL
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 DjangoApisPostgreSQL
./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 DjangoApisPostgreSQL
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='knowledgebase'
- From postgres IDE: drop any tables that begin with postgres
- Remove knowledgebase/migrations directory using gui or with command
rm -rf knowledgebase/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