Commit 0b4803f9 authored by Simon Oliver Tveit's avatar Simon Oliver Tveit
Browse files

Add script for automating parts of setup

parent 2ed3a851
# navigate to docker directory
script_path=$(realpath "$0")
dev_dir=$(dirname $script_path)
cd $dev_dir/..
# setup auth container
docker cp dev/ docker_cnaas_auth_1:/opt/auth-server-poc/
docker exec -t docker_cnaas_auth_1 /bin/chmod u+x /opt/auth-server-poc/
docker exec -t docker_cnaas_auth_1 /opt/auth-server-poc/ > /dev/null
# copy the key for JWT authentication
docker cp docker_cnaas_auth_1:/opt/auth-server-poc/cert/public.pem .
docker cp public.pem docker_cnaas_api_1:/opt/cnaas/jwtcert/public.pem
rm public.pem
docker exec -t docker_cnaas_api_1 /bin/chown root:www-data /opt/cnaas/jwtcert/public.pem
docker exec -t docker_cnaas_api_1 /usr/bin/killall uwsgi
# add devices to database
docker cp dev/cnaas.pgdump docker_cnaas_postgres_1:/tmp/
docker exec -it docker_cnaas_postgres_1 sh -c "/usr/bin/psql -U cnaas cnaas < /tmp/cnaas.pgdump" > /dev/null
# get JWT token
jwt_token=$(curl -ks https://localhost:2443/api/v1.0/auth -X POST -u cnaas:cnaascnaascnaas | jq -r '.access_token')
echo "jwt_token="$jwt_token
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment