Simple python script to create every file and configurations for multiple docker containers
Project description
Docker Environment Creator (denv-creator)
This project is under construction and does not currently function properly. Feel free to use it and test it.
Automates the process of creating a docker environment (using docker-compose
) with all the containers you want, also with all of their respective configuration files. This can be done by answering a few questions on the command line.
Supported Containers
-
Nginx
- No services/containers are defined in the config file, you have to define this yourself
- Proxy passing to PHP-FPM is present in the config file but is commented out. If you are using PHP-FPM, make sure to uncomment it
- Depends on any other services defined
-
PHP-FPM
- Pre installed with Xdebug and Composer
-
Node
- Pre installed with PM2
-
Python
- Pre installed with Flask (and FlaskSocketIO) and PM2 (and it's own ecosystem file)
-
SQL
- Utilises an
env
file inside.docker/env/
. Remember to change this if required - Creates an empty dump file
- Utilises an
-
MongoDB
- Comes with it's own environmental file
-
Mongo Seeder
- Already seeds the database, using database name inside the dockerfile.
- Creates an empty
.docker/data/mongo-data-dump
directory where the dumps are placed
-
Apache
- If using PHP, comment out the comment inside of the config file
- Depends on any other services defined
-
Deno
- Runs on port 1447
-
Redis
Requirements
- Python 3.7 or higher
Install and Run
Clone the repo
cd /path/to/my/development/environments
git clone https://github.com/ebebbington/denv-creator.git
Create your project!
python denv-creator/index.py
Notes
- Remember to adjust certain files, such as the
docker-compose.yml
file to specify what services depend on what - Also, if you are separating source code for each container, remember to modif the related values inside the
docker-compose.yml
file
File Structure
-
__pycache__/
- Cached files of our python scripts. This gets generated automatically and they are being ignored
-
.github/
- Holds github related configurations. Nothing to worry about
-
containers/
- The list of container classes. This holds a class for each container - which encapsulates the logic for each one
-
data/
- General files to aid in the container configuration such as the default
php.ini
file
- General files to aid in the container configuration such as the default
-
.gitignore
- Contains a list of files or directories for Git to ignore as we don't want those files committed
-
CONTRIBUTING.md
- Contribution guide
-
index.py
- Our main entrypoint script, makes the basic calls to the
Project
class to setup the environment
- Our main entrypoint script, makes the basic calls to the
-
LICENSE.txt
- License file
-
project.py
- Our project class. This is where the magic happens. It holds 90% of the logic for the project (represents the project)
-
README.md
self
-
response.md
- A class to handle speaking to the user. This abstracts the logic to log out data, ask for input or show errors
-
test.py
- Testing file to act as a playground
-
validate.py
- Validation file to handle all things validat-ey
Flow of Execution
-
Use calls the main script
-
The main scripts makes all the calls to the
Project
methods -
The project class is what does the magic. It collects data from the user
-
Eventually when all data is collected, the project class uses the container classes to aid in creating/writing files and directories
Tests
Unit testing has been setup and tries to cover 100% of the code.
Testing was also achieved by installing pytest
and coverage
:
pip install pytest coverage
Writing the Tests
There is a test file for each other file, that mimics the file and tests each method.
Running the tests
pytest
With code coverage: coverage run --source . -m pytest && coverage html --omit="*_test.py"
Built With
- Python - Language used
Authors
- Edward Bebbinton - Owner/Developer - ebebbington
- Will Bebbington - Developer - willjb95
Contributing
See here
License
This project is licensed under the MIT License - see the LICENSE.txt file for details
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for denv_creator-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8a7db125425047a0b00caed0b7a2d0cefef1d21c58c490ef728d4a458aabd08 |
|
MD5 | 092e84fe41add112947e4a4340acd0fa |
|
BLAKE2b-256 | 8e78cbf852e3dca9f70ef9bb516c9c66c42873710b53d968f2b42af29ade5d70 |