From d83bf6293c0c84dae646d7f4593d366634eb194d Mon Sep 17 00:00:00 2001 From: Alexandra Hobbs <ahobbs@contractor.usgs.gov> Date: Tue, 19 Nov 2024 15:38:47 -0700 Subject: [PATCH] cleanup for mr --- localdev/cleanup_docker.sh | 5 ----- localdev/init.sql | 38 ----------------------------------- localdev/local_development.md | 12 ----------- localdev/restart_web.sh | 6 ------ localdev/start_services.sh | 13 ------------ 5 files changed, 74 deletions(-) delete mode 100755 localdev/cleanup_docker.sh delete mode 100755 localdev/restart_web.sh delete mode 100755 localdev/start_services.sh diff --git a/localdev/cleanup_docker.sh b/localdev/cleanup_docker.sh deleted file mode 100755 index 15736cce..00000000 --- a/localdev/cleanup_docker.sh +++ /dev/null @@ -1,5 +0,0 @@ -docker stop $(docker ps -aq) - -docker rm -vf $(docker ps -aq) - -docker rmi -f $(docker images -aq) diff --git a/localdev/init.sql b/localdev/init.sql index 5cf5bb6a..da36a61e 100644 --- a/localdev/init.sql +++ b/localdev/init.sql @@ -1,39 +1 @@ CREATE DATABASE IF NOT EXISTS geomag_operations; -CREATE TABLE metadata ( - id int NOT NULL AUTO_INCREMENT, - created_by varchar(255), - created_time TIMESTAMP, - updated_by varchar(255), - updated_time TIMESTAMP, - starttime TIMESTAMP, - endtime TIMESTAMP, - network varchar(255), - station varchar(255), - channel varchar(255), - location varchar(255), - category varchar(255), - priority int, - data_valid boolean, - status varchar(255), - metadata JSON, - comment TEXT, - review_comment TEXT, - PRIMARY KEY (id) -); - -CREATE INDEX index_category_time ON metadata ( - category, - starttime, - endtime -); - -CREATE TABLE session ( - id int NOT NULL AUTO_INCREMENT, - session_id varchar(255), - data TEXT, - updated TIMESTAMP, - PRIMARY KEY (id) -); - -INSERT INTO metadata (category, created_by, network, station, priority, data_valid, metadata) -VALUES ('instrument', 'test_metadata.py', 'NT', 'BDT', 1, true, '{"type": "FGE","channels": {"U": [{ "channel": "U_Volt", "offset": 0, "scale": 313.2 }],"V": [{ "channel": "V_Volt", "offset": 0, "scale": 312.3 }],"W": [{ "channel": "W_Volt", "offset": 0, "scale": 312.0 }]},"electronics": {"serial": "E0542","x-scale": 313.2,"y-scale": 312.3,"z-scale": 312.0,"temperature-scale": 0.01},"sensor": {"serial": "S0419","x-constant": 36958,"y-constant": 36849,"z-constant": 36811}}'); diff --git a/localdev/local_development.md b/localdev/local_development.md index 5f884c6c..e3e216d9 100644 --- a/localdev/local_development.md +++ b/localdev/local_development.md @@ -32,23 +32,11 @@ To simply start build and run all the containers, make sure you are in the /loca docker-compose up ``` -For more granual control, there are a few helpful scripts in /localdev that you can run from the folder. - -`start_services.sh`: Use this command to build and run all the services. - -`restart_web.sh`: Use this command to just pick up changes in the webservice code -without having to rebuild the database and edge containers. - -`cleanup_docker.sh`: Use this command to stop all docker containers, remove them, -and remove the images. - ## Helpful Docker Commands `docker ps` shows the running containers. `docker ps -a` shows all the containers, even ones that have exited. This is helpful to see logs for containers that have unexpectedly exited. -`docker logs -f {CONTAINER ID or NAME}` shows the logs. The `-f` continues streaming the new output. - `docker exec -it {CONTAINER ID} /bin/bash` execs into the container. This can be helpful for exploring the mysql db. After you exec into the mysql container, run `mysql -u root -p` in the container. Input the password you set to MYSQL_ROOT_PASSWORD. Now you can use SQL to explore the db. diff --git a/localdev/restart_web.sh b/localdev/restart_web.sh deleted file mode 100755 index 8f0d69f4..00000000 --- a/localdev/restart_web.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -set -ex - -docker-compose build web - -docker-compose up -d web diff --git a/localdev/start_services.sh b/localdev/start_services.sh deleted file mode 100755 index faf2cb26..00000000 --- a/localdev/start_services.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -set -ex - -docker-compose build edge database - -docker-compose up -d edge database - -# let database initialize -sleep 15; - -docker-compose build web - -docker-compose up -d web -- GitLab