Skip to content

Commit a31cdb6

Browse files
committed
adding phpmyadmin instructions, better documentation / install guide
1 parent 9986439 commit a31cdb6

File tree

4 files changed

+49
-21
lines changed

4 files changed

+49
-21
lines changed

.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
MYSQL_DATABASE=htmlgraphic
2+
MYSQL_PASSWORD=new_password
3+
MYSQL_ROOT_PASSWORD=new_passwordac
4+
MYSQL_USER=admin
15
SASL_USER=p08tf1X
26
SASL_PASS=p@ssw0Rd
37
SMTP_HOST=email-test.htmlgraphic.com

Makefile

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ NAME = apache
66
IMAGE_REPO = htmlgraphic
77
IMAGE_NAME = $(IMAGE_REPO)/$(NAME)
88
DOMAIN = htmlgraphic.com
9+
include .env
10+
911

1012
all:: help
1113

@@ -24,23 +26,33 @@ help:
2426
@echo " make state - View state $(NAME) container"
2527
@echo " make logs - View logs in real time"
2628

29+
30+
env:
31+
@echo $(shell sed 's/=.*//' .env)
32+
2733
build:
2834
docker build \
29-
--build-arg VCS_REF=`git rev-parse --short HEAD` \
30-
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
31-
--rm -t $(IMAGE_NAME):$(VERSION) -t $(IMAGE_NAME):envoyer .
35+
--build-arg VCS_REF=`git rev-parse --short HEAD` \
36+
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
37+
--rm -t $(IMAGE_NAME):$(VERSION) -t $(IMAGE_NAME):envoyer .
3238

3339
push:
3440
@echo "note: If the repository is set as an automatted build you will NOT be able to push"
3541
docker push $(IMAGE_NAME):$(VERSION)
3642

3743
run:
38-
[ ! -f .env ] && echo '.env file does not exist, copy env template' && cp .env.example .env || echo "env file exists"
39-
@echo "# Upon initial setup run the following on the MySQL system:"
44+
@echo 'Checking... for initial folder structure:'
45+
@if [ ! -d "/Volumes/Case" ]; then \
46+
echo " Creating project folders" && sudo mkdir -p /Volumes/Case && sudo mkdir -p /Volumes/Case/SITES && sudo mkdir -p /Volumes/Case/SITES/docker; fi
47+
@[ ! -f .env ] && echo " .env file does not exist, copy env template" && cp .env.example .env || echo " env file exists"
4048
@echo ""
41-
@echo "mysql -p <MYSQL_ROOT_PASSWORD>"
42-
@echo "GRANT ALL PRIVILEGES ON * . * TO 'admin'@'%' with grant option;"
49+
@echo "Upon initial setup run the following on the MySQL system, this will setup a GLOBAL admin:"
4350
@echo ""
51+
@echo " docker exec -it apache_db_1 /bin/bash \n \
52+
mysql -p$(MYSQL_ROOT_PASSWORD) \n \
53+
GRANT ALL PRIVILEGES ON * . * TO '$(MYSQL_USER)'@'%' with grant option; \n"
54+
55+
@echo " THE PASSWORD FOR $(MYSQL_USER) IS $(MYSQL_PASSWORD); \n"
4456
docker-compose -f docker-compose.local.yml up -d
4557

4658
start: run
@@ -52,14 +64,14 @@ stop:
5264
restart: stop start
5365

5466
rm:
55-
@echo "# As a precautionary measure containers are specifally referenced to not destroy DB data"
56-
@echo "Removing $(NAME)_web_1 and $(NAME)_db_1"
57-
docker rm -f $(NAME)_web_1
67+
@echo "On remove, containers are specifally referenced, as to not destroy ANY persistent data"
68+
@echo "Removing $(NAME) and $(NAME)_db_1"
69+
docker rm -f $(NAME)
5870
docker rm -f $(NAME)_db_1
5971

6072
state:
61-
docker ps -a | grep $(NAME)_web_1
73+
docker ps -a | grep $(NAME)
6274

6375
logs:
6476
@echo "Build $(NAME)..."
65-
docker logs -f $(NAME)_web_1
77+
docker logs -f $(NAME)

README.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ This repo will give you a turn key Docker container build for use in production
1212
If you found this repo you are probably looking into Docker or already have knowledge as to what Docker can help you with. In this repo you will find a number of complete Dockerfile builds used in **development** and **production** environments. Listed below is an explanation of each file. [Ask a question](https://github.com/htmlgraphic/Apache/issues/new)
1313

1414
#### Dependencies
15-
- Docker
16-
- Docker Compose
15+
- Docker [Download](https://www.docker.com/community-edition#/download)
1716
- Git
1817
- Make ([Windows](https://stackoverflow.com/questions/32127524/how-to-install-and-use-make-in-windows-8-1))
1918

@@ -45,17 +44,33 @@ Apache # → Root of Docker Build
4544
```
4645
Docker Compose YML configuration guide [more info](https://docs.docker.com/docker-cloud/apps/deploy-to-cloud-btn/)
4746

47+
4848
## Quick Start
4949

50-
Launch the **Apache** instance locally and setup a local MySQL database container for persistant database data, the goal is to create a easy to use development environment. Type `make` for more build options
50+
Launch the **Apache** instance locally and setup a local MySQL database container for persistant database data, the goal is to create a easy to use development environment.
51+
52+
> Type `make` for more build options:
5153
5254
```bash
53-
$ git clone https://github.com/htmlgraphic/Apache.git && cd Apache
55+
$ git clone https://github.com/htmlgraphic/Apache.git ~/Docker/Apache && cd ~/Docker/Apache
5456
$ make run
57+
5558
OR (non Make Windows)
59+
5660
$ docker-compose -f docker-compose.local.yml up -d
5761
```
5862

63+
### Run phpMyAdmin
64+
65+
Review MySQL access instructions upon `make run` command execution
66+
67+
```bash
68+
$ docker run --name myadmin -d --link apache_db_1:db --net apache_default -p 8080:80 phpmyadmin/phpmyadmin
69+
70+
Open http://localhost:8080 (username & password are set within .env file)
71+
```
72+
73+
5974
---
6075
## Deploy to Docker Cloud
6176
Create a [Docker Cloud](https://cloud.docker.com) account, add a **Cloud provider**. Once complete, `one click` will create a functional Apache & MySQL Service.

docker-compose.local.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ services:
2121
- "db-data:/var/lib/mysql"
2222
ports:
2323
- "3306:3306"
24-
environment:
25-
- MYSQL_ROOT_PASSWORD=new_passwordac
26-
- MYSQL_DATABASE=htmlgraphic
27-
- MYSQL_USER=admin
28-
- MYSQL_PASSWORD=new_password
24+
env_file:
25+
- .env
2926
volumes:
3027
db-data:

0 commit comments

Comments
 (0)