{"id":21339373,"url":"https://github.com/cuboulder/walnut","last_synced_at":"2025-03-16T02:24:42.126Z","repository":{"id":53655114,"uuid":"208331553","full_name":"CuBoulder/walnut","owner":"CuBoulder","description":"CU Custom Pantheon Orchestration Tool ","archived":false,"fork":false,"pushed_at":"2023-02-02T06:39:47.000Z","size":78,"stargazers_count":0,"open_issues_count":18,"forks_count":0,"subscribers_count":5,"default_branch":"dev","last_synced_at":"2025-01-22T15:13:07.888Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CuBoulder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-13T19:20:31.000Z","updated_at":"2020-09-23T17:58:32.000Z","dependencies_parsed_at":"2023-02-17T15:30:25.522Z","dependency_job_id":null,"html_url":"https://github.com/CuBoulder/walnut","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CuBoulder%2Fwalnut","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CuBoulder%2Fwalnut/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CuBoulder%2Fwalnut/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CuBoulder%2Fwalnut/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CuBoulder","download_url":"https://codeload.github.com/CuBoulder/walnut/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243814979,"owners_count":20352077,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-11-22T00:45:41.932Z","updated_at":"2025-03-16T02:24:41.748Z","avatar_url":"https://github.com/CuBoulder.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# walnut\n\nCU Custom Pantheon Orchestration Tool\n\n---\n\n## Quickstart\n\n* Install Python 3.7+ [Homebrew](https://docs.python-guide.org/starting/install3/osx/)\n* Install and start MongoDB 4.2 [Homebrew](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/)\n\t- Make sure the service is running with ```` brew services start mongodb-community@4.2 ````\n\t- Stop the DB with ```` brew services stop mongodb-community@4.2 ````\n* Clone this repository\n* Create and activate a venv [Python Guide](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/) inside of the repo\n\n  ```sh\n  python3 -m venv env\n  #activate the virtual environment with\n  source env/bin/activate\n  \n  #leave the environment with\n  deactivate\n  ```  \n\n* Install requirements\n\n  ```sh\n  pip install -r requirements.txt\n  ```\n\n* Running the application locally via Flask\n\n  ```sh\n  # Debug mode allows live-reload to work\n  FLASK_DEBUG=1 FLASK_APP=run.py flask run\n  ```\n\n* Running the application locally via uWSGI\n\n  ```sh\n  uwsgi --socket 0.0.0.0:5000 --protocol=http -w wsgi\n  ```\n\n* Alternate Fish shell Quickstart\n\n  ```sh\n  python3 -m venv env\n  source env/bin/activate.fish\n  pip install -r requirements.txt\n  env FLASK_DEBUG=1 FLASK_APP=run.py flask run\n  ```\n\n---\n\n## Endpoints\n\n### `instance`\n\nDescription: The collection of Express instances hosted on Pantheon\n\nPublic Methods: `GET`\n\nAuthentication: `Token Auth`\n\nAuthenticated Methods: `GET`, `PATCH`, `PUT`, `DELETE`.\n\n### `accounts`\n\nAuthentication: `Basic Auth (Username, Password)`\n\nAuthenticated Methods: `GET`, `PATCH`, `PUT`, `DELETE`\n\n---\n\n## Authentication\n\nThis application requires a MongoDB database named `walnut` with a collection named `accounts` for user management. An admin user must be created before a developer role can be added.\n\nThe initial user is created manually by inserting a document into `accounts`.\n\n### Creating the admin user\n\n1. Generate a hashed password using the Python3 library `bcrypt`\n\n    * Start the Python shell\n\n      ```shell\n      python\n      ```\n\n    * Run the following commands:\n\n      ```python\n      import bcrypt\n\n      print(bcrypt.hashpw(\"password_to_be_hashed\", bcrypt.gensalt()))\n      ```\n\n      Save the hashed value that is printed for the next step.\n\n2. Use the following Mongo CLI Commands to create the `admin` user:\n\n    * Start the mongo shell\n\n      ```shell\n      mongo\n      ```\n\n    * Run the following commands:\n\n      ```mongodb\n      use walnut\n\n      db.createCollection(\"accounts\")\n\n      db.accounts.insert({\n        username: 'admin',\n        password: 'hashed_password_from_step_1',\n        role: 'admin'\n      })\n      ```\n\n### Create separate developer user\n\n  1. Send a POST request to the `accounts` endpoint to create your own account using `curl`. Replace the values of `username`, `password`, `role` with your own.\n\n      * Available user roles are `user`, `developer`, and `admin`.\n\n      ```shell\n      curl -u admin -d '{\"username\":\"your_identikey\", \"password\":\"your_password\", \"role\":\"developer\"}' -H \"Content-Type: application/json\" -X POST http://localhost:5000/accounts\n      ```\n\n  2. You should get a `201 CREATED` response that includes a `token` field. This is the token your new account will use to authenticate with, so don't lose it.\n\n## Extra\n- A [GUI for Mongo](https://www.mongodb.com/products/compass)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcuboulder%2Fwalnut","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcuboulder%2Fwalnut","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcuboulder%2Fwalnut/lists"}