commit
4a22f4d307
72
README.rst
Normal file
72
README.rst
Normal file
@ -0,0 +1,72 @@
|
||||
=================
|
||||
Payroll manager
|
||||
=================
|
||||
|
||||
|codebuild|
|
||||
|
||||
This is a simple system to keep a record of employees where they will perform different tasks within the company and will be paid accordingly in a monthly bases.
|
||||
|
||||
.. contents::
|
||||
|
||||
Getting started
|
||||
-----------------
|
||||
|
||||
The system requires the following:
|
||||
- Ubuntu 16.04
|
||||
- php 7.0
|
||||
- composer
|
||||
- docker
|
||||
- docker-compose
|
||||
- mysql 5.7
|
||||
|
||||
Installation
|
||||
-----------------
|
||||
|
||||
Alternatively to installing all the packages and configuring the server it's possible to start up an instance of the system with docker-compose
|
||||
|
||||
To install docker
|
||||
.. code-block:: bash
|
||||
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
||||
|
||||
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
|
||||
|
||||
sudo apt-get update
|
||||
|
||||
apt-cache policy docker-ce
|
||||
|
||||
sudo apt-get install -y docker-ce
|
||||
|
||||
To install docker compose
|
||||
.. code-block:: bash
|
||||
sudo curl -L https://github.com/docker/compose/releases/download/1.19.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
|
||||
|
||||
sudo chmod +x /usr/local/bin/docker-compose
|
||||
|
||||
And finally the containers can be initialized by running
|
||||
|
||||
.. code-block:: bash
|
||||
sudo docker-compose up --build -d
|
||||
|
||||
Sign in
|
||||
-----------------
|
||||
|
||||
The login page can be accessed at **http://localhost:8085/public/html/login.php**
|
||||
|
||||
To access the platform the user is **sloth** and the pasword **slothness**
|
||||
|
||||
Further reading
|
||||
-----------------
|
||||
To further read about the api and it's front-end
|
||||
`api-payroll <https://github.com/PootisPenserHere/payroll_manager/blob/master/api-payroll/README.rst>`_
|
||||
|
||||
More about the database `database <https://github.com/PootisPenserHere/payroll_manager/blob/master/database/README.rst>`_
|
||||
|
||||
|
||||
Data volumes
|
||||
-----------------
|
||||
Since the application is designed to run within containers a number of volumes has been created to persist the data, they can be found in the volumes directory on the root of the project
|
||||
|
||||
.. |codebuild| image:: https://s3.amazonaws.com/codefactory-us-east-1-prod-default-build-badges/passing.svg
|
||||
:target: https://codebuild.us-east-1.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiWm42eW80VzA2OXRTc2xIMXErZ1hlS1RpNnFCaDVMWENqSSsyU2x3dUpReEpCRUtaZGRmbklYaFN0anVEWW9NaGYvQ21PNk9tR25rZGtZMjNvR1ArbGdVPSIsIml2UGFyYW1ldGVyU3BlYyI6IjVXYjl3TWZnUVQ1MFZDQ0kiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=master
|
||||
:alt: Build status of the master branch on amazon codebuild
|
@ -1,27 +0,0 @@
|
||||
# Slim Framework 3 Skeleton Application
|
||||
|
||||
Use this skeleton application to quickly setup and start working on a new Slim Framework 3 application. This application uses the latest Slim 3 with the PHP-View template renderer. It also uses the Monolog logger.
|
||||
|
||||
This skeleton application was built for Composer. This makes setting up a new Slim Framework application quick and easy.
|
||||
|
||||
## Install the Application
|
||||
|
||||
Run this command from the directory in which you want to install your new Slim Framework application.
|
||||
|
||||
php composer.phar create-project slim/slim-skeleton [my-app-name]
|
||||
|
||||
Replace `[my-app-name]` with the desired directory name for your new application. You'll want to:
|
||||
|
||||
* Point your virtual host document root to your new application's `public/` directory.
|
||||
* Ensure `logs/` is web writeable.
|
||||
|
||||
To run the application in development, you can run these commands
|
||||
|
||||
cd [my-app-name]
|
||||
php composer.phar start
|
||||
|
||||
Run this command in the application directory to run the test suite
|
||||
|
||||
php composer.phar test
|
||||
|
||||
That's it! Now go build something cool.
|
34
api-payroll/README.rst
Normal file
34
api-payroll/README.rst
Normal file
@ -0,0 +1,34 @@
|
||||
=======
|
||||
The api
|
||||
=======
|
||||
|
||||
.. contents::
|
||||
|
||||
About
|
||||
-------
|
||||
The project has been built with slim in the backed and jquery with bootstrap for the front, both of them share the public folder from which they can be accessed by the general public.
|
||||
|
||||
Auth
|
||||
------
|
||||
The system uses cookie based sessions which are handled by a midleware, have a time to live of 10 minutes and are refreshed each time a new request is made to the api, further more the contents of the session itself has been secured with openssl.
|
||||
|
||||
Database
|
||||
---------
|
||||
To connect to the database pdo is used, its configuration can be found at **src/settings.php** under the mysql section. The following settings are set as default:
|
||||
- **PDO::ATTR_EMULATE_PREPARES** Has been set to true in order to lower the strain on the database by processing the prepare statements on the server side, if cache performance is desired this option should be changed to false
|
||||
- **PDO::ATTR_ERRMODE** Uses **PDO::ERRMODE_EXCEPTION** which will return all mysql errors as exceptions to prevent further execution of the software
|
||||
- **PDO::ATTR_DEFAULT_FETCH_MODE** uses **PDO::FETCH_ASSOC** and as such the query ouput system wide is expected as an associative array
|
||||
|
||||
Data protection
|
||||
----------------
|
||||
| Encryption has been applied to sensitive data, passwords are protected with with bcrypt and it's configuration can be found in the settings.php file, by default a cost of 12 is used for the hashing as well as a 16 characters randomly generated string (128 bits) as an iv.
|
||||
|
||||
| For data that needs to be both read and written such as names AES in mode cbc with 256 block size has been used.
|
||||
|
||||
| The reason to have choosen AES is the desire to make the process of securing the data both secure and affordable since many hardware manufacturers already have architectures designed to improce the speed of AES.
|
||||
|
||||
| **Important note**: While in this project the encryption password has been saved into the settings.php file it's adviced that in a real use case it's stored more securely or else where entirely such as a key management service.
|
||||
|
||||
Error handling
|
||||
---------------
|
||||
Should an exception be encountered it'll be caught by a middleware that will form a new response body, returning it with a 500 http code and a json object containing the keys status set to error as well as a message key that will contain the exception that was raised.
|
22
database/README.rst
Normal file
22
database/README.rst
Normal file
@ -0,0 +1,22 @@
|
||||
================
|
||||
``The database``
|
||||
================
|
||||
|
||||
.. contents::
|
||||
|
||||
About the container
|
||||
--------------------
|
||||
|
||||
The database container is created in two stages to bypass some limitations with docker, firstly a new image will be created based on the Dockerfile which will be based on mysql 5.7 and it'll be passed the .sql scripts to initialize the database as well as a config file to configure the port that will be exposed.
|
||||
|
||||
Initializing
|
||||
-------------
|
||||
When the database is being created as an image it'll take all the scripts in the **/docker-entrypoint-initdb.d** directory and execute them in alphabetical order which will result in the database with its tables and initial data being created.
|
||||
|
||||
Accession
|
||||
----------
|
||||
The newly created container will have two users *root** and **sloth** both of which will have the password **12345678** and it'll be accessible in the port 3307
|
||||
|
||||
Persistence
|
||||
-----------
|
||||
A volume containing the data from **/var/lib/mysql** will be created to persist the information, once its created running the container build again will execute the starting scripts
|
Loading…
Reference in New Issue
Block a user