Skip to content
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
20 changes: 8 additions & 12 deletions DOCKER_TIPS.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,38 @@
## Typical Docker Commands
### Start all environments services
> docker-compose up --build

### Restart a specific container
> docker restart [service name]

### List all containers
> docker ps -a

### List running containers
> docker ps

### See used space
> docker system df

### Remove un-used data
> docker system prune

## Passwords
### PostgreSQL
> username: postgres_user
> password: postgres_pass

### MySql
> username: mysql_user
> password: mysql_pass


### MariaDB
> username: mariadb_user
> password: mariadb_pass


## Running Xdebug with PHPStorm alongside Docker.
From Docker versions 18.03 and above, Docker creates a special DNS name that resolves
to the internal IP address used by the host.
to the internal IP address used by the host.

Old logic (that has not updated to special DNS name) will need to point to the IP of `10.254.254.254`.

```
sudo ifconfig lo0 alias 10.254.254.254
```
```
37 changes: 25 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
# Sourcetoad Internal Development Tools (SIDT)

Sourcetoad Internal Development Tools includes a growing collection of tutorials
for managing IDEs, hooking up tools with Docker and any combination of those
for managing IDEs, hooking up tools with Docker and any combination of those
things.

Additionally, this repository holds our data source services which is
a collection of databases and other services that projects will more than likely
need. It also provides a proxy setup via nginx-proxy so that multiple projects
Additionally, this repository holds our data source services which is
a collection of databases and other services that projects will more than likely
need. It also provides a proxy setup via nginx-proxy so that multiple projects
can be run at the same time without the need for different ports.

This means docker configurations for each project only needs to worry about the
This means docker configurations for each project only needs to worry about the
the language and other tools it may need, as the databases and other services are
standardized in this project. Since most cloud providers provide managed versions
of these services, you likely would not use a docker version of them in production.

## Docker

### devop-tools (data source services / domain tools)
### Required: data source services
1. Execute `git clone git@github.com:sourcetoad/DevopsToolKit.git devop-tools`
2. `cd devop-tools`
3. `cd ./docker/data-source-services/`
4. Execute `./network-creation.sh`
- If this fails, then manual configuration is necessary before compilation. Perform the following:
1. `docker network create nginx-proxy`
2. `docker network create st-mariadb-102`
3. `docker network create st-mysql-56`
4. `docker network create st-postgres-95`
5. `docker network create st-redis-32`
6. `docker network create st-internal`
3. `docker network create st-postgres-95`
4. `docker network create st-redis-32`
5. `docker network create st-internal`
5. Execute `docker-compose up --build`
- If you're in a Windows environment, then perform the following if your build fails:
1. Kill, and optionally disable, the `World Wide Web Publishing Service`.
Expand All @@ -36,16 +35,30 @@ of these services, you likely would not use a docker version of them in producti
6. Wait for the terminal to complete executing.
7. You now have Sourcetoad data sources running and logging to the console.

### Optional: data source tools
1. Optionally included is the following tools:
* phpMyAdmin
2. `cd devop-tools`
3. `cd ./docker/data-source-tools/`
4. Execute `docker-compose up --build`
5. Wait for the terminal to complete executing.
6. You now have Sourcetoad data source tools running.

## phpMyAdmin
If the optional tools are launched, you can find phpMyAdmin at: localhost:8080
* It supports the following databases...
* mariadb102
* mariadb103

## Examples
Inside the `examples` folder you will find example Docker configurations for
popular frameworks like Laravel and Yii2.

The examples make the assumption that any domain used for local development is
The examples make the assumption that any domain used for local development is
already added to the `/etc/hosts` file. You can edit to add `127.0.0.1 domain.docker`.

## Docs
* [Setting up Nginx-Proxy](docs/nginx-proxy/README.md)
* [Setting up PHP Testing in PHPStorm](docs/phpstorm-docker/README.md)
* [Setting up Python Debugging in Pycharm](docs/pycharm-debugging/README.md)
* [Building a new Upsource Project](docs/upsource/README.md)

35 changes: 25 additions & 10 deletions docker/data-source-services/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ services:
- ./proxy_increase.conf:/etc/nginx/proxy.conf
networks:
- nginx-proxy
- st-internal
postgres95:
image: postgres:9.5
container_name: sourcetoad_postgres95
Expand All @@ -26,23 +27,35 @@ services:
- POSTGRES_PASSWORD=postgres_pass
networks:
- st-postgres-95
- st-internal
command: "postgres
-c logging_collector='on'
-c log_directory='/var/log/postgresql'
-c log_filename='%Y-%m-%d.log'
-c log_line_prefix='%t %v '
-c log_statement='all'"
mysql56:
image: mysql:5.6
container_name: sourcetoad_mysql56
mariadb104:
image: mariadb:10.4
container_name: sourcetoad_mariadb104
ports:
- "3356:3306"
- "33104:3306"
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_USER=mysql_user
- MYSQL_PASSWORD=mysql_pass
- MYSQL_USER=mariadb_user
- MYSQL_PASSWORD=mariadb_pass
networks:
- st-internal
mariadb103:
image: mariadb:10.3
container_name: sourcetoad_mariadb103
ports:
- "33103:3306"
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_USER=mariadb_user
- MYSQL_PASSWORD=mariadb_pass
networks:
- st-mysql-56
- st-internal
mariadb102:
image: mariadb:10.2
container_name: sourcetoad_mariadb102
Expand All @@ -54,6 +67,7 @@ services:
- MYSQL_PASSWORD=mariadb_pass
networks:
- st-mariadb-102
- st-internal
redis32:
image: redis:3.2-alpine
command: redis-server --appendonly yes
Expand All @@ -62,19 +76,20 @@ services:
- "6332:6379"
networks:
- st-redis-32
- st-internal
networks:
nginx-proxy:
external:
name: nginx-proxy
st-postgres-95:
external:
name: st-postgres-95
st-mysql-56:
st-internal:
external:
name: st-mysql-56
name: st-internal
st-mariadb-102:
external:
name: st-mariadb-102
st-redis-32:
external:
name: st-redis-32
name: st-redis-32
5 changes: 0 additions & 5 deletions docker/data-source-services/network-creation.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
echo "Creating container networks:\n"
docker network create st-internal
docker network create nginx-proxy
docker network create st-mariadb-102
docker network create st-mysql-56
docker network create st-postgres-95
docker network create st-redis-32
17 changes: 17 additions & 0 deletions docker/data-source-tools/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: '2'
services:
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
container_name: sourcetoad_phpmyadmin
ports:
- 8080:80
networks:
- st-internal
environment:
PMA_HOSTS: mariadb102,mariadb103,mariadb104
PMA_USER: root
PMA_PASSWORD: root
networks:
st-internal:
external:
name: st-internal
6 changes: 3 additions & 3 deletions examples/laravel5/Dockerfile → examples/laravel/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:7.2-fpm-stretch
FROM php:7.4

# System dependencies needed
RUN apt-get update && apt-get install -y \
Expand Down Expand Up @@ -58,6 +58,6 @@ RUN sed -i -e "s/pm.max_spare_servers\s*=\s*[0-9]*/pm.max_spare_servers = 10/g"
RUN sed -i -e "s/;pm.max_requests\s*=\s*[0-9]*/pm.max_requests = 500/g" /usr/local/etc/php-fpm.d/www.conf
RUN sed -i -e "s/access.log/;access.log/g" /usr/local/etc/php-fpm.d/docker.conf

# Expose PHP and execute php-fpm
# Expose PHP and execute php-fpm
EXPOSE 9000
CMD ["php-fpm"]
CMD ["php-fpm"]
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ services:
- ./config/vhost.conf:/etc/nginx/conf.d/vhost.conf
networks:
- st-internal
- nginx-proxy
# PHP Container
# The environment variables allow Xdebug to work properly.
# Networks much like above can be registered depending on what the application
Expand All @@ -29,20 +28,9 @@ services:
- ../:/code
networks:
- st-internal
- st-mariadb-102
# These are networks that you are leveraging from outside (external) locations.
# The dev-ops repo is already running, so these networks already exist. We tell
# docker which networks of the dev-ops repo we need.
# The dev-ops repo is already running, so that network (st-internal) exists.
networks:
st-internal:
external:
name: st-internal
nginx-proxy:
external:
name: nginx-proxy
st-redis-32:
external:
name: st-redis-32
st-mariadb-102:
external:
name: st-mariadb-102
4 changes: 2 additions & 2 deletions examples/yii2/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM php:7.0-fpm

# System dependencies needed
RUN apt-get update && apt-get install -y \
git \
Expand Down Expand Up @@ -44,6 +44,6 @@ RUN sed -i -e "s/;pm.max_requests\s*=\s*[0-9]*/pm.max_requests = 500/g" /usr/loc
RUN sed -i -e "s/access.log/;access.log/g" /usr/local/etc/php-fpm.d/docker.conf
RUN sed -i -e "s/^error_log.*/error_log = \/proc\/self\/fd\/2/" /usr/local/etc/php-fpm.d/www.conf

# Expose PHP and execute php-fpm
# Expose PHP and execute php-fpm
EXPOSE 9000
CMD ["php-fpm"]
15 changes: 1 addition & 14 deletions examples/yii2/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ services:
- ./config/vhost.conf:/etc/nginx/conf.d/vhost.conf
networks:
- st-internal
- nginx-proxy
# PHP Container
# The environment variables allow Xdebug to work properly.
# Networks much like above can be registered depending on what the application
Expand All @@ -29,21 +28,9 @@ services:
- ../:/code
networks:
- st-internal
- st-mariadb-102
- st-redis-32
# These are networks that you are leveraging from outside (external) locations.
# The dev-ops repo is already running, so these networks already exist. We tell
# docker which networks of the dev-ops repo we need.
# The dev-ops repo is already running, so that network (st-internal) exists.
networks:
st-internal:
external:
name: st-internal
nginx-proxy:
external:
name: nginx-proxy
st-redis-32:
external:
name: st-redis-32
st-mariadb-102:
external:
name: st-mariadb-102