An open API service indexing awesome lists of open source software.

https://github.com/ryanreece/docker-lamp-version-sandbox

Docker compose framework to test multiple versions of web server infrastructure simultaneously (Apache, Nginx, PHP, MySQL)
https://github.com/ryanreece/docker-lamp-version-sandbox

apache docker docker-compose mysql php

Last synced: 3 months ago
JSON representation

Docker compose framework to test multiple versions of web server infrastructure simultaneously (Apache, Nginx, PHP, MySQL)

Awesome Lists containing this project

README

        

# Docker LAMP Version Sandbox

A Docker Compose framework designed to make it simple to test different versions of Apache, PHP, and MySQL. Whether you are looking to perform major version upgrades or simply need to test your app against various software stacks, this repo might be able to help. With easy-to-use configuration files, you can simultaneously switch between multiple software versions to ensure your application runs smoothly under any setup.

For a more detailed review of the functionality of this repo as well as the inspiration, [check out my blog post](https://reece.ai/docs/devnetops/docker/docker-lamp-version-sandbox).

## Default Containers
1. Nginx Load Balancer - Latest Version
2. Apache PHP - Latest Version
3. Apache PHP - v7.4.33
4. MySQL - Latest Version
5. PHPMyAdmin for MySQL - Latest Version
6. MySQL - v5.7.43
7. PHPMyAdmin for MySQL - v5.7.43

## Dependencies
1. Docker and Supported OS
- [Docker for Windows](https://docs.docker.com/desktop/install/windows-install/)
- [Docker for MacOS](https://docs.docker.com/desktop/install/mac-install/)
- [Docker for Ubuntu](https://docs.docker.com/engine/install/ubuntu/)

## Running

1. On the docker host

Starting containers:
```bash
$ docker compose up -d
```

Viewing containers:
```bash
$ docker ps
```

Stopping containers:
```bash
$ docker compose down
```

2. Accessing Resources

Web URLs:
- [localhost:8080](http://localhost:8080) - Apache PHP v8.2.x
- [localhost:8081](http://localhost:8081) - Apache PHP v7.4.33
- [localhost:8090](http://localhost:8090) - PHPMyAdmin for MySQL v8.1.x
- [localhost:8091](http://localhost:8091) - PHPMyAdmin for MySQL v5.7.43

MySQL:
```bash
$ mysql --host=localhost --port=3380 --user=root -p --protocol=tcp
$ mysql --host=localhost --port=3381 --user=root -p --protocol=tcp
```

MySQL Database Import Example:
```bash
$ mysql --host=localhost --port=3381 --user=root -p --protocol=tcp DATABASE_NAME < FILE.sql
```

MySQL Database Dump Example:
```bash
$ mysqldump --host=localhost --port=3381 --user=root -p --protocol=tcp DATABASE_NAME > FILE.sql
```

## Testing Your App
- Place PHP source code into the following versioned directories:

### Apache PHP Latest
```
$ apache-php-latest/src/
```

### Apache PHP 7.4.33
```
$ apache-php-7.4.33/src/
```

## MySQL Databases
- Update database connection strings to `db` and `db_legacy` to test between MySQL containers.

### Example MySQL Connection with PHP

Using the `db_legacy` container running MySQL 5.7:
```php