diff --git a/README.md b/README.md index a075bca..9779b64 100644 --- a/README.md +++ b/README.md @@ -213,6 +213,17 @@ Questions on how to add your app to Groot or use the Groot API: ``` 9. Wait for the image to build and startup. If it works, you'll be able to visit `https://0.0.0.0:5000` in a browser and see the deployed site. The Groot API will be available on port 8000. +Useful Notes: + +* If you want to just rebuild one service (i.e. for dev work), you can keep the `docker-compose` command running, and run this command in a separate terminal window to rebuild the service you're working on: + ``` + docker-compose up -d --build SERVICE + ``` +* For dev work you'll probably want to run in unauthenticated mode. To do this, change the `CMD` line in `groot-api-gateway/Dockerfile` to: + ``` + CMD ["./build/groot-api-gateway", "-u"] + ``` + ## License This project is licensed under the University of Illinois/NCSA Open Source License. For a full copy of this license take a look at the LICENSE file. diff --git a/database_setup.sql b/database_setup.sql index 001df4d..7ba41e9 100644 --- a/database_setup.sql +++ b/database_setup.sql @@ -1,6 +1,10 @@ CREATE DATABASE IF NOT EXISTS groot_caffeine_service_dev; CREATE DATABASE IF NOT EXISTS groot_credits_service; +CREATE DATABASE IF NOT EXISTS groot_gigs_service; CREATE DATABASE IF NOT EXISTS groot_meme_service; +CREATE DATABASE IF NOT EXISTS groot_merch_service_dev; CREATE DATABASE IF NOT EXISTS groot_quote_service_dev; CREATE DATABASE IF NOT EXISTS groot_recruiter_service_dev; -CREATE DATABASE IF NOT EXISTS groot_user_service_dev; \ No newline at end of file +CREATE DATABASE IF NOT EXISTS groot_user_service_dev; +GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'; +FLUSH PRIVILEGES; \ No newline at end of file diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml new file mode 100644 index 0000000..32c5b24 --- /dev/null +++ b/docker-compose-dev.yml @@ -0,0 +1,21 @@ +version: '2' +services: + db: + image: mysql + environment: + - MYSQL_ROOT_PASSWORD=root + volumes: + - ./database_setup.sql:/docker-entrypoint-initdb.d/schema.sql:ro + ports: + - 3306 + groot: + build: . + command: /bin/bash -c "./docker_go_symlink.sh && ./dev_spinup.sh" + working_dir: /groot-deploy + volumes: + - .:/groot-deploy + ports: + - "8000:8000" + - "5000:5000" + depends_on: + - db diff --git a/docker-compose.yml b/docker-compose.yml index 8025988..69f3e5b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,21 +1,121 @@ version: '2' services: - db: + db: image: mysql environment: - MYSQL_ROOT_PASSWORD=root volumes: - ./database_setup.sql:/docker-entrypoint-initdb.d/schema.sql:ro + - db_data:/var/lib/mysql ports: - - 3306 - groot: - build: . - command: /bin/bash -c "./docker_go_symlink.sh && ./dev_spinup.sh" - working_dir: /groot-deploy - volumes: - - .:/groot-deploy - ports: - - "8000:8000" - - "5000:5000" - depends_on: - - db + - "3306:3306" + restart: always + + groot-api-gateway: + build: groot-api-gateway + ports: + - "8000:8000" + volumes: + - groot_api_gateway_volume:/var/groot-api-gateway/ + + restart: always + + groot-credits-service: + build: groot-credits-service + ports: + - "8765:8765" + depends_on: + - db + - groot-api-gateway + restart: always + + groot-desktop-frontend: + build: groot-desktop-frontend + depends_on: + - groot-api-gateway + ports: + - "5000:5000" + restart: always + + groot-events-service: + build: groot-events-service + ports: + - "8002:8002" + depends_on: + - groot-api-gateway + restart: always + + groot-gigs-service: + build: groot-gigs-service + ports: + - "8964:8964" + depends_on: + - db + - groot-api-gateway + restart: always + + groot-groups-service: + build: groot-groups-service + ports: + - "9001:9001" + depends_on: + - groot-api-gateway + restart: always + + groot-meme-service: + build: groot-meme-service + ports: + - "42069:42069" + depends_on: + - db + - groot-api-gateway + restart: always + + groot-merch-service: + build: groot-merch-service + ports: + - "6969:6969" + depends_on: + - db + - groot-api-gateway + restart: always + + groot-quotes-service: + build: groot-quotes-service + ports: + - "9494:9494" + depends_on: + - db + - groot-api-gateway + restart: always + + groot-recruiters-service: + build: groot-recruiters-service + ports: + - "3000:3000" + depends_on: + - db + - groot-api-gateway + restart: always + + groot-users-service: + build: groot-users-service + ports: + - "8001:8001" + depends_on: + - db + - groot-api-gateway + restart: always + + groot-voz: + build: groot-voz + ports: + - "5652:5652" + depends_on: + - db + - groot-api-gateway + restart: always + +volumes: + db_data: + groot_api_gateway_volume: diff --git a/docker_settings_init.sh b/docker_settings_init.sh index fd42dae..292ec8a 100755 --- a/docker_settings_init.sh +++ b/docker_settings_init.sh @@ -9,11 +9,24 @@ credits="MYSQL = { 'dbname': 'groot_credits_service' } -GROOT_SERVICES_URL = 'http://localhost:8000' +GROOT_SERVICES_URL = 'http://groot-api-gateway:8000' GROOT_ACCESS_TOKEN = '' STRIPE_SECRET_KEY = ''" echo "$credits" > groot-credits-service/settings.py +##### SETUP GIGS ##### +echo "* Setting up GIGS" +credits="MYSQL = { + 'user': 'root', + 'password': 'root', + 'host': 'db', + 'dbname': 'groot_gigs_service' +} + +GROOT_SERVICES_URL = 'http://groot-api-gateway:8000' +GROOT_ACCESS_TOKEN = '' +echo "$credits" > groot-gigs-service/settings.py + ##### SETUP MEMES ##### echo "* Setting up MEMES" memes="MYSQL = { @@ -24,56 +37,72 @@ memes="MYSQL = { } GROOT_ACCESS_TOKEN = '' -GROOT_SERVICES_URL = 'http://localhost:8000'" +GROOT_SERVICES_URL = 'http://groot-api-gateway:8000'" echo "$memes" > groot-meme-service/settings.py ##### SETUP MERCH ##### echo "* Setting up MERCH" merch_secrets="groot: - access_key: ''" -merch_database="development: + access_key: '' + host: 'http://groot-api-gateway:8000' + +merch_pi: + access_key: 'INSERT_TOKEN_HERE' + ip_address: 'INSERT_IPADDRESS' + +development: user: root password: root hostname: db - name: groot_caffeine_service_dev" + name: groot_merch_service_dev" echo "$merch_secrets" > groot-merch-service/config/secrets.yaml -echo "$merch_database" > groot-merch-service/config/database.yaml ##### SETUP QUOTES ##### echo "* Setting up QUOTES" quotes_secrets="groot: - access_key: ''" -quotes_database="development: + access_key: 'GROOT_ACCESS_KEY' + host: 'http://groot-api-gateway:8000' + +development: user: root password: root hostname: db name: groot_quote_service_dev" + echo "$quotes_secrets" > groot-quotes-service/config/secrets.yaml -echo "$quotes_database" > groot-quotes-service/config/database.yaml ##### SETUP RECRUITERS ##### echo "* Setting up RECRUITERS" -recruiters_secrets="groot: - access_key: ''" -recruiters_database="development: +recruiters_secrets="aws: + access_key_id: '' + secret_access_key: '' + +groot: + access_key: 'INSERT_TOKEN_HERE' + host: 'http://groot-api-gateway:8000' + +jwt: + secret: 'SECRET_JWT_TOKEN' + +development: user: root password: root hostname: db name: groot_recruiter_service_dev" echo "$recruiters_secrets" > groot-recruiters-service/config/secrets.yaml -echo "$recruiters_database" > groot-recruiters-service/config/database.yaml ##### SETUP USERS ##### echo "* Setting up USERS" users_secrets="groot: - access_key: ''" -users_database="development: + access_key: 'GROOT_ACCESS_KEY' + host: 'http://groot-api-gateway:8000' + +development: user: root password: root hostname: db name: groot_user_service_dev" echo "$users_secrets" > groot-users-service/config/secrets.yaml -echo "$users_database" > groot-users-service/config/database.yaml ##### SETUP GROOT ##### echo "* Setting up GROOT" @@ -81,10 +110,25 @@ groot_config="package config const RecruiterToken string = \"\" const AuthPrefix = \"Basic \" -const AuthURL string = \"http://localhost:8008\" +const AuthURL string = \"http://groot-auth-stub-service:8008\" const AuthToken string = \"\" -const AccessLogLocation string = \"log/access.log\" -const ClientRegistryLocation string = \"clients.db\" -const AccessControlPolicy string = \"*\"" +//Service hosts +const CreditsURL = \"http://groot-credits-service:8765\" +const EventsURL = \"http://groot-events-service:8002\" +const GigsURL = \"http://groot-gigs-service:8964\" +const GroupsURL = \"http://groot-groups-service:9001\" +const HardwareURL = \"http://groot:4523/api/v1.0\" +const MemesURL = \"http://groot-meme-service:42069\" +const MerchURL = \"http://groot-merch-service:6969\" +const QuotesURL = \"http://groot-quotes-service:9494\" +const RecruiterURL = \"http://groot-recruiters-service:4567\" +const UsersURL = \"http://groot-users-service:8001\" + +//Arbor configurations +func LoadArborConfig() { + security.AccessLogLocation = \"/var/groot-api-gateway/access.log\" + security.ClientRegistryLocation = \"/var/groot-api-gateway/clients.db\" + proxy.AccessControlPolicy = \"*\" +}" echo "$groot_config" > groot/config/config.go