Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

makefile and compose improvements #958

Merged
merged 3 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ yarn-error.log
.phpunit.result.cache
###< phpunit/phpunit ###

.env
*.env
10 changes: 10 additions & 0 deletions .ins.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
TITLE=Your institution name
LMS_DOMAIN=myschool.instructure.com
LMS_ID=canvas
LMS_ACCOUNT_ID=1234567
CREATED=2021-06-08
STATUS=1
VANITY_URL=canvas.myschool.edu
METADATA={\"lang\":\"es\"}
API_CLIENT_ID=1234500000000001234
API_CLIENT_SECRET=your_api_client_secret
29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# checks if .ins.env exists and includes it
ifneq (,$(wildcard ./.ins.env))
include .ins.env
export
endif

# spin up the containers
start:
docker compose -f docker-compose.nginx.yml up -d

# set up the database
migrate:
docker compose -f docker-compose.nginx.yml run php php bin/console doctrine:migrations:migrate

# stop the containers
stop:
docker compose -f docker-compose.nginx.yml down

# clear the Symfony cache
clean-cache:
docker compose -f docker-compose.nginx.yml run php bin/console cache:clear

# fill your institutions table data with the variables in your ins.env file. Use this command if you are using mysql.
ins-mysql:
docker exec -it udoit3-db mysql -u root -proot udoit3 -e "INSERT INTO institution (title, lms_domain, lms_id, lms_account_id, created, status, vanity_url, metadata, api_client_id, api_client_secret) VALUES ('$(TITLE)', '$(LMS_DOMAIN)', '$(LMS_ID)', '$(LMS_ACCOUNT_ID)', '$(CREATED)', '$(STATUS)', '$(VANITY_URL)', '$(METADATA)', '$(API_CLIENT_ID)', '$(API_CLIENT_SECRET)');"

# fill your institutions table data with the variables in your institutions.env file. Use this command if you are using postgresql.
ins-psql:
docker exec -it -e PGPASSWORD=root udoit3-db psql -U root -d udoit3 -w -c "INSERT INTO institution (title, lms_domain, lms_id, lms_account_id, created, status, vanity_url, metadata, api_client_id, api_client_secret) VALUES ('$(TITLE)', '$(LMS_DOMAIN)', '$(LMS_ID)', '$(LMS_ACCOUNT_ID)', '$(CREATED)', '$(STATUS)', '$(VANITY_URL)', '$(API_CLIENT_ID)', '$(API_CLIENT_SECRET)');"
8 changes: 6 additions & 2 deletions docker-compose.nginx.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: "3.9"

services:
db:
container_name: udoit3-db
image: mysql:latest
volumes:
- dbdata:/var/lib/mysql
Expand All @@ -15,6 +14,7 @@ services:
# Uncomment this block and comment the next db block
# to use Postgres instead of MySQL
# db:
# container_name: udoit3-db
# image: postgres:alpine
# restart: always
# ports:
Expand All @@ -24,6 +24,7 @@ services:
# POSTGRES_PASSWORD: udoit
# POSTGRES_DB: udoit3
web:
container_name: udoit3-web
image: nginx:latest
ports:
- "8000:80"
Expand All @@ -35,6 +36,7 @@ services:
env_file:
- .env
php:
container_name: udoit3-php
build:
context: ./build/nginx
dockerfile: Dockerfile.php.pdo.mysql
Expand All @@ -46,6 +48,7 @@ services:
env_file:
- .env
composer:
container_name: udoit3-composer
build:
context: ./build/nginx
dockerfile: Dockerfile.composer
Expand All @@ -55,6 +58,7 @@ services:
env_file:
- .env
yarn:
container_name: udoit3-yarn
image: node:16
volumes:
- ./:/app
Expand Down
Loading