Skip to content

Commit 6575ec0

Browse files
authored
Merge pull request ucfopen#958 from SimHoZebs/issue/948-create-a-makefile
makefile and compose improvements
2 parents 100471b + 3f7fe4e commit 6575ec0

File tree

4 files changed

+46
-3
lines changed

4 files changed

+46
-3
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ yarn-error.log
3434
.phpunit.result.cache
3535
###< phpunit/phpunit ###
3636

37-
.env
37+
*.env

.ins.env.example

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
TITLE=Your institution name
2+
LMS_DOMAIN=myschool.instructure.com
3+
LMS_ID=canvas
4+
LMS_ACCOUNT_ID=1234567
5+
CREATED=2021-06-08
6+
STATUS=1
7+
VANITY_URL=canvas.myschool.edu
8+
METADATA={\"lang\":\"es\"}
9+
API_CLIENT_ID=1234500000000001234
10+
API_CLIENT_SECRET=your_api_client_secret

Makefile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# checks if .ins.env exists and includes it
2+
ifneq (,$(wildcard ./.ins.env))
3+
include .ins.env
4+
export
5+
endif
6+
7+
# spin up the containers
8+
start:
9+
docker compose -f docker-compose.nginx.yml up -d
10+
11+
# set up the database
12+
migrate:
13+
docker compose -f docker-compose.nginx.yml run php php bin/console doctrine:migrations:migrate
14+
15+
# stop the containers
16+
stop:
17+
docker compose -f docker-compose.nginx.yml down
18+
19+
# clear the Symfony cache
20+
clean-cache:
21+
docker compose -f docker-compose.nginx.yml run php bin/console cache:clear
22+
23+
# fill your institutions table data with the variables in your ins.env file. Use this command if you are using mysql.
24+
ins-mysql:
25+
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)');"
26+
27+
# fill your institutions table data with the variables in your institutions.env file. Use this command if you are using postgresql.
28+
ins-psql:
29+
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)');"

docker-compose.nginx.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
version: "3.9"
2-
31
services:
42
db:
3+
container_name: udoit3-db
54
image: mysql:latest
65
volumes:
76
- dbdata:/var/lib/mysql
@@ -15,6 +14,7 @@ services:
1514
# Uncomment this block and comment the next db block
1615
# to use Postgres instead of MySQL
1716
# db:
17+
# container_name: udoit3-db
1818
# image: postgres:alpine
1919
# restart: always
2020
# ports:
@@ -24,6 +24,7 @@ services:
2424
# POSTGRES_PASSWORD: udoit
2525
# POSTGRES_DB: udoit3
2626
web:
27+
container_name: udoit3-web
2728
image: nginx:latest
2829
ports:
2930
- "8000:80"
@@ -35,6 +36,7 @@ services:
3536
env_file:
3637
- .env
3738
php:
39+
container_name: udoit3-php
3840
build:
3941
context: ./build/nginx
4042
dockerfile: Dockerfile.php.pdo.mysql
@@ -46,6 +48,7 @@ services:
4648
env_file:
4749
- .env
4850
composer:
51+
container_name: udoit3-composer
4952
build:
5053
context: ./build/nginx
5154
dockerfile: Dockerfile.composer
@@ -55,6 +58,7 @@ services:
5558
env_file:
5659
- .env
5760
yarn:
61+
container_name: udoit3-yarn
5862
image: node:16
5963
volumes:
6064
- ./:/app

0 commit comments

Comments
 (0)