A rudimentary configuration management tool and use it to configure servers for production service of a simple PHP web application. Do not use off-the-shelf tools like (but not limited to) Puppet, Chef, Fabric, or Ansible. Instead, implement a tool to meet the following specifications and then use that tool to configure the two servers.
Requirements for the rudimentary configuration management tool:
- If the tool has dependencies not available on a standard Ubuntu instance you may include a bootstrap.sh program to resolve them
- The tool must provide an abstraction that allows specifying a file's content and metadata (owner, group, mode)
- The tool must provide an abstraction that allows installing and removing Debian packages
- The tool must provide some mechanism for restarting a service when relevant files or packages are updated
- The tool must be idempotent - it must be safe to apply the configuration over and over again
- The toil must specify a web server capable of running the PHP application below
<?php
header("Content-Type: text/plain");
echo "Hello, world!\n";
?>
- The server must respond 200 OK and include the string "Hello, world!" in their response to requests from curl -sv http://ip-address (public)
- initial setup, create SSH keys for further usage
- similar to Ansible, apply changes to target server via SSH only
- define bootstrap, meta and content in templates
- major steps: init -> update -> status
├── LICENSE
├── README.md
├── sscmt
└── templates
├── php.bootstrap
├── php.homepage
└── php.meta
./sscmt <command> <target> <params>
Examples:
./sscmt init web-server1
./sscmt update web-server1
./sscmt status web-server1 "appY"
./sscmt add-package web-server1 "appX appY appZ"
./sscmt remove-package web-server1 "appY"
./sscmt init <target> # target: a unique name of server
./sscmt apply <target>
Note: SSH keys and meta data saved under ~/.sscmt/
modify homepage under templates/php.homepage, run:
./sscmt apply <target>
modify bootstrap or meta configuration under templates, run:
./sscmt init <target> # target: a unique name of server
./sscmt apply <target>
run ./sscmt status
- apply to all targets together in one run
- support different languages