To get a local repo and change into the directory:
git clone git@github.com:20c/devicectl
cd devicectlDevicectl is containerized with Docker. First we want to copy the example environment file:
cp Ctl/dev/example.env Ctl/dev/.envAny of the env variables can be changed, and you should set your own secret key.
You can launch the app via:
Ctl/dev/compose.sh build
Ctl/dev/compose.sh upThe first time you run compose.sh up it will create a folder postgres_data in the top-level devicectl directory which contains your Postgres data and will initialize the Postgres database with a user according to the settings you've provided. Generally, the compose script will automatically perform migrations within the Django app; however, the first time you run compose.sh up you may find that the Django app is unable to perform migrations because the Postgres database is still being initialized. To solve this, simply wait until the Postgres db is initialized, and then stop the Docker containers with
Ctl/dev/compose.sh downOn running compose.sh up any subsequent time, the Django app will be able to run migrations properly. Additionally, if you're starting up the app for the first time, you will want to ssh into the Django container and run a few additional commands. Do this without the services currently running, again stopping your containers with compose.sh down if necessary. Ctl/dev/run.sh /bin/sh will launch the services properly and ssh into the Django container for you:
Ctl/dev/run.sh /bin/sh
cd main
manage createsuperuser
manage createcachetable
manage devicectl_peeringdb_syncSECRET_KEYDATABASE_ENGINEDATABASE_HOSTDATABASE_NAMEDATABASE_USERDATABASE_PASSWORD
The environment file you copied from example.env contains variables for configuring both the Django and Postgres services- if you change the database name, user, or password, you must ensure the values still match between the Django and Postgres settings. The Django database variables are passed directly into the Django application settings so all five DATABASE_ settings should remain defined.
Authorization: bearer {key}
curl -X GET https://localhost/api/20c/ix/ -H "Authorization: bearer {key}"
?key={key}
python manage.py generateschema > django_devicectl/static/devicectl/openapi.yaml
cp django_devicectl/static/devicectl/openapi.yaml ../docs/openapi.yaml