{"id":15775734,"url":"https://github.com/pranay01/backend","last_synced_at":"2026-02-03T18:32:54.173Z","repository":{"id":139185603,"uuid":"507827262","full_name":"pranay01/backend","owner":"pranay01","description":"The Open Source AI Company","archived":false,"fork":false,"pushed_at":"2022-06-25T00:29:27.000Z","size":811,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-04T09:45:48.503Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://humanish.ai","language":null,"has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pranay01.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-27T08:35:22.000Z","updated_at":"2022-06-27T05:11:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"a7cb1196-535a-4a33-bfb1-70dc8bab0c29","html_url":"https://github.com/pranay01/backend","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pranay01/backend","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pranay01%2Fbackend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pranay01%2Fbackend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pranay01%2Fbackend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pranay01%2Fbackend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pranay01","download_url":"https://codeload.github.com/pranay01/backend/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pranay01%2Fbackend/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29052632,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T15:43:47.601Z","status":"ssl_error","status_checked_at":"2026-02-03T15:43:46.709Z","response_time":96,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-04T17:01:42.444Z","updated_at":"2026-02-03T18:32:54.154Z","avatar_url":"https://github.com/pranay01.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\n## For local development\n\nInstall homebrew\n\n```\n/bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)\"\n```\n\nFor Unix/Linux OS you might go to the official Terraform site and download bin-file with software.\n  \nInstall docker  \nDownload here https://www.docker.com/products/docker-desktop  \nFollow the instructions to install it and start docker desktop  \n\nIf on ubuntu install docker and start the docker daemon like so\n```\nsudo apt update\nsudo apt install apt-transport-https ca-certificates curl software-properties-common\ncurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -\nsudo add-apt-repository \"deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable\"\napt-cache policy docker-ce\nsudo apt install docker-ce\nsudo apt-get install docker-compose-plugin\n```\n  \nInstall Postman  \nDownload here https://www.postman.com/downloads/  \nFollow the instructions to install it  \n\nInstall terraform  \n```\nbrew tap hashicorp/tap\nbrew install hashicorp/tap/terraform\n```\n\nThis was my version of terraform and my providers\nchase@Chases-MacBook-Pro backend % terraform --version  \nTerraform v0.14.9\n+ provider registry.terraform.io/hashicorp/aws v3.33.0\n+ provider registry.terraform.io/hashicorp/template v2.2.0\n\nInstall aws cli\n```\nbrew install awscli\n```\n\nInstall ansible\n```\nbrew install ansible\n```\n\nInstall postgres\n```\nbrew install postgres\n```\n\nInstall python annd packages for testing the API\n```\nbrew install python3\npip3 install requests\npip3 install coolname\n```\n\n## Create an AWS Account (already done by Admin)\n\nGo through the steps to setup a new AWS account for attaching to Terraform Cloud and login to your root account to get to your [AWS account console](https://us-east-1.console.aws.amazon.com/console/home?region=us-east-1#)\n  \n## Setup AWS credentials (ask your Admin to do it)\n\nSetup a new user called terraform in us-east-1 that has the \"Select AWS credential type\" option of \"Access key - Programmatic access\" checked [using IAM](https://us-east-1.console.aws.amazon.com/iam/home#/users$new?step=details)\n\nThe next step is to setup permissions and you should select \"Attach existing policies directly\" and then choose [AdministratorAccess](https://us-east-1.console.aws.amazon.com/iam/home#/policies/arn%3Aaws%3Aiam%3A%3Aaws%3Apolicy%2FAdministratorAccess)\n\nNo need to add any tags\n\nOn the review page click \"Create User\"\n\nThe next step you should see an AWS key pair\n\nThis AWS key pair you created for the new user called terraform in us-east-1 will be used by terraform for setting up the infrastructure in AWS and use these aws id and keys as `\u003cyour aws id\u003e` and `\u003cyour aws key\u003e`\n\nKeep this key pair somewhere safe for now by clicking the \"Show\" link under \"Secret access key\" to copy and paste it somewhere else and also copy/pasting the \"Access key ID\"\n\n## Configure AWS locally\n\nAfter you have stored the \"Secret access key\" i.e. `\u003cyour aws key\u003e` and \"Access key ID\" i.e. `\u003cyour aws id\u003e` by using aws configure command below\n\n```\naws configure\n```\n\n## Gain access to a foundation model (already done by Admin)\n\nSetup a GPT-3 OpenAI access account and use the key found here https://beta.openai.com/docs/developer-quickstart/your-api-keys as `\u003cyour OpenAI API key\u003e`\n\n## Gain access to model inference as a service provider (already done by Admin)\n\nSetup a replicate alpha access account and use the key found here replicate.com as `\u003cyour Replicate API key\u003e`\n\n## Make a private and public ssh key pair\n```\nssh-keygen -t rsa -b 4096 -C \"\u003cinsert your email address\u003e\"\n```\nPress enter a few times to accept defaults until the command is done\n\nStart the ssh agent in the background\n```\neval \"$(ssh-agent -s)\"\n```\n\nAdd SSH private key to the ssh-agent\n```\nssh-add ~/.ssh/id_rsa\n```\n\n## Update your public key (send your public key in ~/.ssh/id_rsa.pub to your Admin)\n\nPut your public ssh key (~/.ssh/id_rsa.pub) in the resource \"aws_key_pair\" \"humanish\" section of the main.tf terraform file as the string value of public_key in quotation marks so you can attempt connecting to resources later\n  \nYou also need to update the IP address allowed to attempt access to resources\nyou will find this in the following section:  \n\"aws_security_group\" \"humanish_public\"\n\n## Setup Terraform Cloud (already done by Admin)\n\nSetup a [terraform cloud organization](https://app.terraform.io/app/organizations/new)\n  \nOnce you have verified your email address by clicking the link sent to the email you used to sign up, [setup a workspace](https://app.terraform.io/app/humanish/workspaces/new)\n\nintegrate your workspace with your github repo by choosing a type of \"Version Control Workflow\"\n\nChoose github.com as your version control provider and authorize Terraform to connect with your github account\n\nIf the correct repos do not appear to be an option you may need to add an organization repo\n\nExport your sensitive information as environment variables in terraform cloud located [here](https://app.terraform.io/app/humanish/workspaces/humanish/variables) under `Environment Variables`\n\nYour environment variables are all sensitive so be sure when you add a variable key value pair you check \"sensitive\" checkbox\n```\nTF_VAR_openai_api_key = \u003cyour OpenAI API key\u003e\nAWS_ACCESS_KEY_ID = \u003cyour aws id\u003e\nAWS_SECRET_ACCESS_KEY = \u003cyour aws key\u003e\nTF_VAR_aws_access_key_id = \u003cyour aws id\u003e\nTF_VAR_aws_secret_access_key = \u003cyour aws key\u003e\n```\n\nAWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY is for Terraform Cloud. TF_VAR_aws_access_key_id and TF_VAR_aws_secret_access_key are used by the terraform variables in variables.tf file.\n\nNow when you push to github terraform cloud will automatically attempt an apply, show you the resulting changes, and ask for your manual confirmation of a terraform plan before a terraform apply is run https://app.terraform.io/app/humanish/workspaces/humanish/runs  \n  \nThen state is updated and managed in the cloud automatically for you here https://app.terraform.io/app/humanish/workspaces/humanish/states\n\nMultiple people can use this, you don't always need to terraform apply, and you don't need to manage sensitive passwords or state on your local machine  \n  \nWait for terraform apply to finish and you should have a green output in your run if all goes well\n\n## Setup Terraform Account (send your email to the Admin so they can add you to the terraform cloud organization team)\n\nSetup a terraform cloud account by going to https://app.terraform.io/signup/account\n\n## Enable ssh key agent forwarding and login to the private instance to setup\n\nOpen up your ssh config and edit it making sure to use the IP addresses you just found for your instances in EC2\n```\nnano ~/.ssh/config\n```\n\n```\nHost *\n  AddKeysToAgent yes\n  UseKeychain yes\n  IdentityFile ~/.ssh/id_rsa\nHost 3.237.80.32\n  HostName 3.237.80.32\n  ForwardAgent yes\n  IdentityFile ~/.ssh/id_rsa\n  User ubuntu\nHost 172.17.0.41\n  User ubuntu\n  IdentityFile ~/.ssh/id_rsa\n  ProxyCommand ssh -W %h:%p 3.237.80.32\n```\nClose the file\n\nMake sure the config file isn't accessible to everyone\n```\nchmod 600 ~/.ssh/config\n```\n\nNow you will login to your private machine without using a bastion with AWS Systems Manager in the AWS console\n```\nssh -A -i \"~/.ssh/id_rsa\" ubuntu@public.humanish.ai\n```\nIf you get the error Host key verification failed. you need to open your ~/.ssh/known_hosts file and empty it\n\nThis error means that someone may have replaced the instance with another one and is trying to trick you\n\nUsually the simpler explanation is that you yourself or the local infrastructure admin have replaced the instance\n\nBut be security minded and be careful\n```\nssh -o StrictHostKeyChecking=no -i \"~/.ssh/id_rsa\" ubuntu@private.humanish.ai\n```\nssm and aws_instance user_data have put a zipped up version of humanish on the instance for your convenience\n```\ncd /data\n```\n\nPress ctrl+D once when you setup the database to get back to your local development machine\n\n## Setup github secrets (already done by Admin)\n\nStart a new repo in github called humanish\n\nIf you are not forking the backend Github repo and want to initialize the backend folder as a git repo\n```\ngit init\ngit branch -m main\n```\n\nMake sure to setup ssh keys in github and locally using [these instructions](https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh)\n\nOr use HTTPS\n\nPush to github and setup your repo in github to allow Github actions\n```\ngit add .\ngit commit -m \"initial commit\"\ngit push origin main\n```\n\nMake sure you add AWS_ACCESS_KEY_ID with a value of `\u003cyour aws id\u003e` and AWS_SECRET_ACCESS_KEY with a value of `\u003cyour aws key\u003e` in your Github secrets, for example Dystopia Robotics secrets are found [here](https://github.com/humanish/humanish/settings/secrets/actions)\n\n## Set github workflows environment variables (already done by Admin)\n\nI have my environment variables set in github workflow but you will need to put your own values in, my settings are [found here](https://github.com/humanish/humanish/blob/main/.github/workflows/aws.yml)\n\n## Run a Github action so that you can push an image to ECR and deploy automatically (already done by Admin)\n\nWhen you are ready to zip up some of the scripts to put on the private instance run this command\n```\nrm humanish.tar.gz \u0026\u0026 rsync -a *.sql humanish \u0026\u0026 rsync -a *.py humanish \u0026\u0026 rsync -a *.yml humanish \u0026\u0026 rsync -a *.txt humanish \u0026\u0026 rsync -a topics.csv humanish \u0026\u0026 rsync -a Dockerfile humanish \u0026\u0026 rsync -a clf.joblib humanish \u0026\u0026 rsync -a templates humanish \u0026\u0026 rsync -a *.json humanish \u0026\u0026 tar -zcvf humanish.tar.gz humanish \u0026\u0026 rm -rf humanish\n```\n\nOnce you push to github this also updates the version of humanish found on the private instance after you destroy the private instance and re-run the terraform apply in terraform cloud\n\n## Run Terraform Cloud\n\nIn order to run the terraform commands in the Makefile you will need to first `terraform login` and follow the instructions to make and locally store your Terraform Cloud API key\n\nGo to [terraform runs](https://app.terraform.io/app/humanish/workspaces/humanish/runs) and after confirming your plan press the button that says \"Start New Plan\"\n\n## Get GPUs (already done by Admin)\n\nTo get GPUs make sure you reach out to the SALES TEAM and talk to them LIVE as no one else in AWS has a hope of getting your ticket submitted and approved in a day or two\n\n## Run the app locally with Docker\n\nAdd this to your .bashrc on a mac or ubuntu\n```\nalias humanishfrontend='result=${PWD##*/} \u0026\u0026 if [[ $results -eq \"backend\" ]]; then cd ../frontend \u0026\u0026 npm install --legacy-peer-deps \u0026\u0026 REACT_APP_LOCAL_ENVIRONMENT=True REACT_APP_URL_BACKEND=http://localhost:8080 REACT_APP_URL_FRONTEND=http://localhost:3000 npm start; fi'\nalias humanishbackend='docker compose down --volumes \u0026\u0026 docker compose build --no-cache \u0026\u0026 docker compose up'\n```\n\nThen run this command for them to take effect\n```\nsource ~/.bash_aliases\n```\n\nTo start the app locally\n\nRun this only once for loading environment variables\n```\necho 'POSTGRESQL_USER_NAME=postgres\nPOSTGRESQL_PASSWORD=magical_password\nPOSTGRESQL_HOST=backend-database-1\nREPLICATE_API_TOKEN=\u003cinsert token from admin\u003e\nOPENAI_API_KEY=\u003cyour OpenAI API key\u003e' \u003e .env\nhumanishbackend\n```\n\nNow you are ready to run the application\n```\nhumanishbackend\n```\n\nIn a separate terminal window run the frontend\n```\nhumanishfrontend\n```\n\nCode changes are automatically fast refreshed when you save a python file\n\nTo enter the local database in another terminal on your machine\n```\npsql --host=backend-database-1 --username=postgres --dbname=humanish -w\n```\n\nIf you would like to restart the frontend app locally use this command\n```\nhumanishbackend\n```\n\nIn a separate terminal window run this to restart the frontend locally\n```\nhumanishfrontend\n```\n\nTo see log messages related to humanish_app run this command\n```\ndocker service logs humanish_app\n```\nTo see the \"CURRENT STATE\" of a service and even \"ERROR\" messages run this command\n```\ndocker service ps humanish_app\n```\nvisit localhost in your browser to see the app running\nIf you ever run into this error\n```\nERROR: for humanish_app_1  Cannot create container for service app: max depth exceeded\n\nERROR: for app  Cannot create container for service app: max depth exceeded\nERROR: Encountered errors while bringing up the project.\n```\nHave no fear it just means you have made too many docker images\nTo make this message go away run this command\n```\ndocker system prune -a\n```\nIf you want to replace all data from the database but you are running a docker stack you will first need to run these commands\n```\ndocker stack rm humanish\ndocker system prune -a\ndocker volume rm humanish_database-data\ndocker stack deploy --compose-file=docker-compose.yml humanish\n```\n\nTo troubleshoot a task running in Docker switch app.py in backend to health_check.py\nAlso comment out the ports for backend\n```\n    # ports:\n    #   - 8080:8080\n```\nAlso in health_check.py change port 8080 to 8090\n\nNext run the docker compose command and then run docker ps in another tab to find the container ID and go inside the container\n```\ndocker compose down --volumes \u0026\u0026 docker compose build --no-cache \u0026\u0026 docker compose up\ndocker ps\ndocker exec -it e0bbd8fe0c77 /bin/bash\napt update\napt search vim\napt install vim\nvim app.py\n```\n\nTo troubleshoot a task running in ECS say task ea29f8775f8a4028969adb9d03a555c2 on humanish-backend:\n\nFirst update app.py in the task definition json to health_check.py\n```\naws ecs execute-command --cluster humanish --task ea29f8775f8a4028969adb9d03a555c2 --container humanish-backend --interactive --command \"bash\"\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpranay01%2Fbackend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpranay01%2Fbackend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpranay01%2Fbackend/lists"}