diff --git a/.dockerignore b/.dockerignore index a34e019a..e4e5b0c1 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,5 @@ -.git -.gitignore -LICENSE -README.md -CHANGELOG.md +.git +.gitignore +LICENSE +README.md +CHANGELOG.md diff --git a/.gitignore b/.gitignore index f96e30f4..2fcc1f70 100644 --- a/.gitignore +++ b/.gitignore @@ -1,30 +1,30 @@ -# Tmp files to always-ignore extensions -*.diff -*.err -*.rej -*.swo -*~ -*.sass-cache -*.orig - -# OS -.DS_Store -Thumbs.db - -# Editors -.cache -.project -.settings -.tmproj -*.esproj -*.sublime-project -*.sublime-workspace -/.redcar -/nbproject -/.project -/.idea -/.eclipse -*.vi - -# logs files -*.log +# Tmp files to always-ignore extensions +*.diff +*.err +*.rej +*.swo +*~ +*.sass-cache +*.orig + +# OS +.DS_Store +Thumbs.db + +# Editors +.cache +.project +.settings +.tmproj +*.esproj +*.sublime-project +*.sublime-workspace +/.redcar +/nbproject +/.project +/.idea +/.eclipse +*.vi + +# logs files +*.log diff --git a/Dockerfile b/Dockerfile index 0f925e64..62e0db0b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,13 @@ -FROM php:7-apache -MAINTAINER Dare dare@zooto.io - -RUN docker-php-ext-install mysqli -COPY apache-config.conf /etc/apache2/sites-available/000-default.conf -COPY start-apache /usr/local/bin -RUN a2enmod rewrite - -# Copy application source -COPY html /var/www -RUN chown -R www-data:www-data /var/www - +FROM php:7-apache +MAINTAINER Dare dare@zooto.io + +RUN docker-php-ext-install mysqli +COPY apache-config.conf /etc/apache2/sites-available/000-default.conf +COPY start-apache /usr/local/bin +RUN a2enmod rewrite + +# Copy application source +COPY html /var/www +RUN chown -R www-data:www-data /var/www + CMD ["start-apache"] \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index 77af197f..14969d98 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,145 +1,145 @@ -pipeline { - agent any - - environment - { - PROJECT = 'zooto-tooling-prod' - ECRURL = '059636857273.dkr.ecr.eu-central-1.amazonaws.com' - DEPLOY_TO = 'development' - } - - stages { - - stage("Initial cleanup") { - steps { - dir("${WORKSPACE}") { - deleteDir() - } - } - } - - stage('Checkout') - { - steps { - checkout([ - $class: 'GitSCM', - doGenerateSubmoduleConfigurations: false, - extensions: [], - submoduleCfg: [], - // branches: [[name: '$branch']], - userRemoteConfigs: [[url: "https://github.com/darey-io/tooling.git ",credentialsId:'GITHUB_CREDENTIALS']] - ]) - - } - } - - // stage('Checkout Helm chart') - // { - // steps { - // checkout([ - // $class: 'GitSCM', - // doGenerateSubmoduleConfigurations: false, - // extensions: [[$class: 'RelativeTargetDirectory', - // relativeTargetDir: 'helm']], - // submoduleCfg: [], - // branches: [[name: 'master']], - // userRemoteConfigs: [[url: "https://gitlab.com/propitix/kubernetes/helm.git",credentialsId:'GIT_CREDENTIALS']] - // ]) - - // } - // } - stage('Build preparations') - { - steps - { - script - { - // calculate GIT lastest commit short-hash - gitCommitHash = sh(returnStdout: true, script: 'git rev-parse HEAD').trim() - shortCommitHash = gitCommitHash.take(7) - // calculate a sample version tag - VERSION = shortCommitHash - // set the build display name - currentBuild.displayName = "#${BUILD_ID}-${VERSION}" - IMAGE = "$PROJECT:$VERSION" - } - } - } - - stage('Build For Dev Environment') { - when { - expression { BRANCH_NAME ==~ /(dev)/ } - } - steps { - echo 'Build Dockerfile....' - script { - sh("eval \$(aws ecr get-login --no-include-email --region eu-central-1 | sed 's|https://||')") - // sh "docker build --network=host -t $IMAGE -f deploy/docker/Dockerfile ." - sh "docker build --network=host -t $IMAGE ." - docker.withRegistry("https://$ECRURL"){ - docker.image("$IMAGE").push("dev-$BUILD_NUMBER") - } - } - } - } - - stage('Build For Staging Environment') { - when { - expression { BRANCH_NAME ==~ /(staging|master)/ } - } - steps { - echo 'Build Dockerfile....' - script { - sh("eval \$(aws ecr get-login --no-include-email --region eu-central-1 | sed 's|https://||')") - // sh "docker build --network=host -t $IMAGE -f deploy/docker/Dockerfile ." - sh "docker build --network=host -t $IMAGE ." - docker.withRegistry("https://$ECRURL"){ - docker.image("$IMAGE").push("staging-$BUILD_NUMBER") - } - } - } - } - - - stage('Build For Production Environment') { - when { tag "release-*" } - steps { - echo 'Build Dockerfile....' - script { - sh("eval \$(aws ecr get-login --no-include-email --region eu-central-1 | sed 's|https://||')") - // sh "docker build --network=host -t $IMAGE -f deploy/docker/Dockerfile ." - sh "docker build --network=host -t $IMAGE ." - docker.withRegistry("https://$ECRURL"){ - docker.image("$IMAGE").push("prod-$BUILD_NUMBER") - } - } - } - } - -// - - - - - - - - - // stage('Update Helm appVersion') { - // steps { - // echo 'Update appVersion' - // sh ''' - // cat helm/Chart.yaml.template | sed "s/appVersion: .*/appVersion: \"${BUILD_NUMBER}\"/g" > helm/Chart.yaml - // ''' - // } - // } - } - - post - { - always - { - sh "docker rmi -f $IMAGE " - } - } +pipeline { + agent any + + environment + { + PROJECT = 'zooto-tooling-prod' + ECRURL = '059636857273.dkr.ecr.eu-central-1.amazonaws.com' + DEPLOY_TO = 'development' + } + + stages { + + stage("Initial cleanup") { + steps { + dir("${WORKSPACE}") { + deleteDir() + } + } + } + + stage('Checkout') + { + steps { + checkout([ + $class: 'GitSCM', + doGenerateSubmoduleConfigurations: false, + extensions: [], + submoduleCfg: [], + // branches: [[name: '$branch']], + userRemoteConfigs: [[url: "https://github.com/darey-io/tooling.git ",credentialsId:'GITHUB_CREDENTIALS']] + ]) + + } + } + + // stage('Checkout Helm chart') + // { + // steps { + // checkout([ + // $class: 'GitSCM', + // doGenerateSubmoduleConfigurations: false, + // extensions: [[$class: 'RelativeTargetDirectory', + // relativeTargetDir: 'helm']], + // submoduleCfg: [], + // branches: [[name: 'master']], + // userRemoteConfigs: [[url: "https://gitlab.com/propitix/kubernetes/helm.git",credentialsId:'GIT_CREDENTIALS']] + // ]) + + // } + // } + stage('Build preparations') + { + steps + { + script + { + // calculate GIT lastest commit short-hash + gitCommitHash = sh(returnStdout: true, script: 'git rev-parse HEAD').trim() + shortCommitHash = gitCommitHash.take(7) + // calculate a sample version tag + VERSION = shortCommitHash + // set the build display name + currentBuild.displayName = "#${BUILD_ID}-${VERSION}" + IMAGE = "$PROJECT:$VERSION" + } + } + } + + stage('Build For Dev Environment') { + when { + expression { BRANCH_NAME ==~ /(dev)/ } + } + steps { + echo 'Build Dockerfile....' + script { + sh("eval \$(aws ecr get-login --no-include-email --region eu-central-1 | sed 's|https://||')") + // sh "docker build --network=host -t $IMAGE -f deploy/docker/Dockerfile ." + sh "docker build --network=host -t $IMAGE ." + docker.withRegistry("https://$ECRURL"){ + docker.image("$IMAGE").push("dev-$BUILD_NUMBER") + } + } + } + } + + stage('Build For Staging Environment') { + when { + expression { BRANCH_NAME ==~ /(staging|master)/ } + } + steps { + echo 'Build Dockerfile....' + script { + sh("eval \$(aws ecr get-login --no-include-email --region eu-central-1 | sed 's|https://||')") + // sh "docker build --network=host -t $IMAGE -f deploy/docker/Dockerfile ." + sh "docker build --network=host -t $IMAGE ." + docker.withRegistry("https://$ECRURL"){ + docker.image("$IMAGE").push("staging-$BUILD_NUMBER") + } + } + } + } + + + stage('Build For Production Environment') { + when { tag "release-*" } + steps { + echo 'Build Dockerfile....' + script { + sh("eval \$(aws ecr get-login --no-include-email --region eu-central-1 | sed 's|https://||')") + // sh "docker build --network=host -t $IMAGE -f deploy/docker/Dockerfile ." + sh "docker build --network=host -t $IMAGE ." + docker.withRegistry("https://$ECRURL"){ + docker.image("$IMAGE").push("prod-$BUILD_NUMBER") + } + } + } + } + +// + + + + + + + + + // stage('Update Helm appVersion') { + // steps { + // echo 'Update appVersion' + // sh ''' + // cat helm/Chart.yaml.template | sed "s/appVersion: .*/appVersion: \"${BUILD_NUMBER}\"/g" > helm/Chart.yaml + // ''' + // } + // } + } + + post + { + always + { + sh "docker rmi -f $IMAGE " + } + } } \ No newline at end of file diff --git a/README.md b/README.md index 14bb72e7..5b202e4f 100644 --- a/README.md +++ b/README.md @@ -1,74 +1,98 @@ -[![nginx 1.17.2](https://img.shields.io/badge/nginx-1.17.2-brightgreen.svg?&logo=nginx&logoColor=white&style=for-the-badge)](https://nginx.org/en/CHANGES) [![php 7.3.8](https://img.shields.io/badge/php--fpm-7.3.8-blue.svg?&logo=php&logoColor=white&style=for-the-badge)](https://secure.php.net/releases/7_3_8.php) - - -## Introduction -This is a Dockerfile to build a debian based container image running nginx and php-fpm 7.3.x / 7.2.x / 7.1.x / 7.0.x & Composer. - -### Versioning -| Docker Tag | GitHub Release | Nginx Version | PHP Version | Debian Version | -|-----|-------|-----|--------|--------| -| latest | master Branch |1.17.2 | 7.3.8 | buster | - - -## How to use this repository -The build is automatically triggered by a git push to your feature/[branch] - -## First clone the repository to your workstation -``` -$ git clone https://gitlab.com/propitix/microservices/php-frontend.git -$ cd frontend-propitix -``` - -Create a feature branch. # Always start with feature/[name of your branch] -``` -git branch -b feature/add-css-style-to-about-us-page -``` - - -Update the application code in -``` -./html/ -``` - -Then add/commit/push to gitlab - -``` -git status # to see your changes -``` - -``` -git add --all # If you are satisfied with your changes and willing to push everything. Otherwise, select only the files to add -``` - -``` -git commit -m "Put some message about this push here" -``` - -## Push your changes to gitlab, and merge to dev branch -``` -git push --set-upstream origin feature/[Your branch name] -``` - -### Validate your changes have been triggered by gitlab-ci in -[propitix-scm] (https://gitlab.com/propitix/microservices/frontend-propitix) - -### Check the image have been pushed to -[Google Container Registry] (https://console.cloud.google.com/gcr/images/non-prod-pdz/EU/frontend-propitix?project=non-prod-pdz&authuser=1&gcrImageListsize=30) (Depending on the environment. Either non-prod or prod) - -## pulling the image -``` -docker pull eu.gcr.io/$environment/frontend-propitix:$tag-version -``` - -## Running (You can do this step without the pulling the above as it will put down if not found locally) -To run the container: -``` -$ docker run -d eu.gcr.io/$environment/frontend-propitix:$tag-version -``` - -Default web root: -``` -/usr/share/nginx/html -``` - -## If you require permissions to GCP, or Gitlab resources, please talk to dare@propitix.com +[![nginx 1.17.2](https://img.shields.io/badge/nginx-1.17.2-brightgreen.svg?&logo=nginx&logoColor=white&style=for-the-badge)](https://nginx.org/en/CHANGES) [![php 7.3.8](https://img.shields.io/badge/php--fpm-7.3.8-blue.svg?&logo=php&logoColor=white&style=for-the-badge)](https://secure.php.net/releases/7_3_8.php) + + +## Introduction +This is a Dockerfile to build a debian based container image running nginx and php-fpm 7.3.x / 7.2.x / 7.1.x / 7.0.x & Composer. + +### Versioning +| Docker Tag | GitHub Release | Nginx Version | PHP Version | Debian Version | +|-----|-------|-----|--------|--------| +| latest | master Branch |1.17.2 | 7.3.8 | buster | + + +## How to use this repository +The build is automatically triggered by a git push to your feature/[branch] + +## First clone the repository to your workstation +``` +$ git clone https://gitlab.com/propitix/microservices/php-frontend.git +$ cd frontend-propitix +``` + +Create a feature branch. # Always start with feature/[name of your branch] +``` +git branch -b feature/add-css-style-to-about-us-page +``` + + +Update the application code in +``` +./html/ +``` + +Then add/commit/push to gitlab + +``` +git status # to see your changes +``` + +``` +git add --all # If you are satisfied with your changes and willing to push everything. Otherwise, select only the files to add +``` + +``` +git commit -m "Put some message about this push here" +``` + +## Push your changes to gitlab, and merge to dev branch +``` +git push --set-upstream origin feature/[Your branch name] +``` + +### Validate your changes have been triggered by gitlab-ci in +[propitix-scm] (https://gitlab.com/propitix/microservices/frontend-propitix) + +### Check the image have been pushed to +[Google Container Registry] (https://console.cloud.google.com/gcr/images/non-prod-pdz/EU/frontend-propitix?project=non-prod-pdz&authuser=1&gcrImageListsize=30) (Depending on the environment. Either non-prod or prod) + +## pulling the image +``` +docker pull eu.gcr.io/$environment/frontend-propitix:$tag-version +``` + +## Running (You can do this step without the pulling the above as it will put down if not found locally) +To run the container: +``` +$ docker run -d eu.gcr.io/$environment/frontend-propitix:$tag-version +``` + +Default web root: +``` +/usr/share/nginx/html +``` + +## If you require permissions to GCP, or Gitlab resources, please talk to dare@propitix.com + +## This is an update to Jenkins + +## This is the new update + +## I have updated the SSH Plugin + +## I am in the blocker session + +## Lets trigger you here + +## EC@ has power + +## THis is a trigger for ansible + +## Triger Artifacts + +## Test For Copy Artifacts + +## Webhook IP Update + +## Update for 12th + +## New Update for pers \ No newline at end of file diff --git a/apache-config.conf b/apache-config.conf index c3c33878..90304b7d 100644 --- a/apache-config.conf +++ b/apache-config.conf @@ -1,15 +1,15 @@ - - ServerAdmin infra@zooto.io - DocumentRoot /var/www - - - Options Indexes FollowSymLinks MultiViews - AllowOverride All - Order deny,allow - Allow from all - - - ErrorLog ${APACHE_LOG_DIR}/error.log - CustomLog ${APACHE_LOG_DIR}/access.log combined - + + ServerAdmin infra@zooto.io + DocumentRoot /var/www + + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order deny,allow + Allow from all + + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + \ No newline at end of file diff --git a/dynamic-assignments/env-vars.yml b/dynamic-assignments/env-vars.yml new file mode 100644 index 00000000..8d8cb743 --- /dev/null +++ b/dynamic-assignments/env-vars.yml @@ -0,0 +1,16 @@ +--- +- name: collate variables from env specific file, if it exists + hosts: all + tasks: + - name: looping through list of available files + include_vars: "{{ item }}" + with_first_found: + - files: + - dev.yml + - stage.yml + - prod.yml + - uat.yml + paths: + - "{{ playbook_dir }}/../env-vars" + tags: + - always \ No newline at end of file diff --git a/env-vars/dev.yml b/env-vars/dev.yml new file mode 100644 index 00000000..e69de29b diff --git a/env-vars/prod.yml b/env-vars/prod.yml new file mode 100644 index 00000000..e69de29b diff --git a/env-vars/stage.yml b/env-vars/stage.yml new file mode 100644 index 00000000..e69de29b diff --git a/env-vars/uat.yml b/env-vars/uat.yml new file mode 100644 index 00000000..3a6bf30d --- /dev/null +++ b/env-vars/uat.yml @@ -0,0 +1,2 @@ +enable_nginx_lb: true +load_balancer_is_required: true \ No newline at end of file diff --git a/html/README.md b/html/README.md index 9aed2ac1..a64e69fb 100644 --- a/html/README.md +++ b/html/README.md @@ -1,2 +1,2 @@ -# tooling-website - +# tooling-website + diff --git a/html/admin_tooling.php b/html/admin_tooling.php index 512065f3..844ed53d 100644 --- a/html/admin_tooling.php +++ b/html/admin_tooling.php @@ -1,141 +1,141 @@ - - - - - Home - - - - - -
-

Admin - Home Page

-
-
- - -
-

- -

-
- - - -
- - -
- - - - - () -
- logout -   + add user -
- - -
-
-
- - - - - -

PROPITIX TOOLING WEBSITE

-

Propitix.io

- - - -
- - -
- - Snow2 - - - -
- - - - -
-
- - -
- - Snow - - -
- - - - -
- -
-
- - snow - - -
- -
- - - - - + + + + + Home + + + + + +
+

Admin - Home Page

+
+
+ + +
+

+ +

+
+ + + +
+ + +
+ + + + + () +
+ logout +   + add user +
+ + +
+
+
+ + + + + +

PROPITIX TOOLING WEBSITE

+

Propitix.io

+ + + +
+ + +
+ + Snow2 + + + +
+ + + + +
+
+ + +
+ + Snow + + +
+ + + + +
+ +
+
+ + snow + + +
+ +
+ + + + + \ No newline at end of file diff --git a/html/create_user.php b/html/create_user.php index ade3f1b7..295b113b 100644 --- a/html/create_user.php +++ b/html/create_user.php @@ -1,61 +1,61 @@ - - - - - Admin - Create user - - - - -
-

Admin - create user

-
- -
- - - -
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
-
- + + + + + Admin - Create user + + + + +
+

Admin - create user

+
+ +
+ + + +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+ \ No newline at end of file diff --git a/html/functions.php b/html/functions.php index 2864f4b6..53333468 100644 --- a/html/functions.php +++ b/html/functions.php @@ -1,178 +1,178 @@ - 0){ - echo '
'; - foreach ($errors as $error){ - echo $error .'
'; - } - echo '
'; - } -} - -function isLoggedIn() -{ - if (isset($_SESSION['user'])) { - return true; - }else{ - return false; - } -} - -if (isset($_GET['logout'])) { - session_destroy(); - unset($_SESSION['user']); - header("location: login.php"); -} - -// call the login() function if register_btn is clicked -if (isset($_POST['login_btn'])) { - login(); -} - -// LOGIN USER -function login(){ - global $db, $username, $errors; - - // grap form values - $username = e($_POST['username']); - $password = e($_POST['password']); - - // make sure form is filled properly - if (empty($username)) { - array_push($errors, "Username is required"); - } - if (empty($password)) { - array_push($errors, "Password is required"); - } - - // attempt login if no errors on form - if (count($errors) == 0) { - $password = md5($password); - - $query = "SELECT * FROM users WHERE username='$username' AND password='$password' LIMIT 1"; - $results = mysqli_query($db, $query); - - if (mysqli_num_rows($results) == 1) { // user found - // check if user is admin or user - $logged_in_user = mysqli_fetch_assoc($results); - if ($logged_in_user['user_type'] == 'admin') { - - $_SESSION['user'] = $logged_in_user; - $_SESSION['success'] = "You are now logged in"; - header('location: admin_tooling.php'); - }else{ - $_SESSION['user'] = $logged_in_user; - $_SESSION['success'] = "You are now logged in"; - - header('location: index.php'); - } - }else { - array_push($errors, "Wrong username/password combination"); - } - } -} - -function isAdmin() -{ - if (isset($_SESSION['user']) && $_SESSION['user']['user_type'] == 'admin' ) { - return true; - }else{ - return false; - } -} - - + 0){ + echo '
'; + foreach ($errors as $error){ + echo $error .'
'; + } + echo '
'; + } +} + +function isLoggedIn() +{ + if (isset($_SESSION['user'])) { + return true; + }else{ + return false; + } +} + +if (isset($_GET['logout'])) { + session_destroy(); + unset($_SESSION['user']); + header("location: login.php"); +} + +// call the login() function if register_btn is clicked +if (isset($_POST['login_btn'])) { + login(); +} + +// LOGIN USER +function login(){ + global $db, $username, $errors; + + // grap form values + $username = e($_POST['username']); + $password = e($_POST['password']); + + // make sure form is filled properly + if (empty($username)) { + array_push($errors, "Username is required"); + } + if (empty($password)) { + array_push($errors, "Password is required"); + } + + // attempt login if no errors on form + if (count($errors) == 0) { + $password = md5($password); + + $query = "SELECT * FROM users WHERE username='$username' AND password='$password' LIMIT 1"; + $results = mysqli_query($db, $query); + + if (mysqli_num_rows($results) == 1) { // user found + // check if user is admin or user + $logged_in_user = mysqli_fetch_assoc($results); + if ($logged_in_user['user_type'] == 'admin') { + + $_SESSION['user'] = $logged_in_user; + $_SESSION['success'] = "You are now logged in"; + header('location: admin_tooling.php'); + }else{ + $_SESSION['user'] = $logged_in_user; + $_SESSION['success'] = "You are now logged in"; + + header('location: index.php'); + } + }else { + array_push($errors, "Wrong username/password combination"); + } + } +} + +function isAdmin() +{ + if (isset($_SESSION['user']) && $_SESSION['user']['user_type'] == 'admin' ) { + return true; + }else{ + return false; + } +} + + diff --git a/html/index.php b/html/index.php index 9986ea7e..62ede129 100644 --- a/html/index.php +++ b/html/index.php @@ -1,145 +1,145 @@ - - - - - - - - - - - - - PROPITIX TOOLING - - - - - - - - -
- -
-
- - -
-

- -

-
- - -
- - -
- - - - - () -
- logout -
- - -
-
-
- - - - - - - - - -

PROPITIX TOOLING WEBSITE

-

Propitix.io

- - - -
-
- - Snow - -
- -
- - Snow2 - - - -
- -
- - Snow - -
- - -
-
-
- - Snow - -
- -
- - Snow - - -
- -
- - Snow - -
- - -
- -
-
- - snow - - -
- -
- - - - - - - - - + + + + + + + + + + + + + PROPITIX TOOLING + + + + + + + + +
+ +
+
+ + +
+

+ +

+
+ + +
+ + +
+ + + + + () +
+ logout +
+ + +
+
+
+ + + + + + + + + +

PROPITIX TOOLING WEBSITE

+

Propitix.io

+ + + +
+
+ + Snow + +
+ +
+ + Snow2 + + + +
+ +
+ + Snow + +
+ + +
+
+
+ + Snow + +
+ +
+ + Snow + + +
+ +
+ + Snow + +
+ + +
+ +
+
+ + snow + + +
+ +
+ + + + + + + + + \ No newline at end of file diff --git a/html/login.php b/html/login.php index 08645119..8dd8e9f8 100644 --- a/html/login.php +++ b/html/login.php @@ -1,32 +1,32 @@ - - - - - Propitix Tooling Login - - - -
-

Login

-
-
- - - -
- - -
-
- - -
-
- -
- -
- + + + + + Propitix Tooling Login + + + +
+

Login

+
+
+ + + +
+ + +
+
+ + +
+
+ +
+ +
+ \ No newline at end of file diff --git a/html/register.php b/html/register.php index 95695413..6fdcbbab 100644 --- a/html/register.php +++ b/html/register.php @@ -1,39 +1,39 @@ - - - - - - Registration system PHP and MySQL - - - -
-

Register

-
-
- -
- - -
-
- - -
-
- - -
-
- - -
-
- -
-

- Already a member? Sign in -

-
- + + + + + + Registration system PHP and MySQL + + + +
+

Register

+
+
+ +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+

+ Already a member? Sign in +

+
+ \ No newline at end of file diff --git a/html/style.css b/html/style.css index b1e39e20..d3644ab1 100644 --- a/html/style.css +++ b/html/style.css @@ -1,106 +1,106 @@ -* { - margin: 0px; - padding: 0px; -} - -body { - font-size: 120%; - background: rgb(160, 160, 173); -} - -.header { - width: 40%; - margin: 50px auto 0px; - color: white; - background: rgb(26, 65, 122); - text-align: center; - border: 1px solid #B0C4DE; - border-bottom: none; - border-radius: 10px 10px 0px 0px; - padding: 20px; -} - -form, -.content { - width: 40%; - margin: 0px auto; - padding: 20px; - border: 1px solid #B0C4DE; - background: rgb(219, 217, 217); - border-radius: 0px 0px 10px 10px; -} - -.input-group { - margin: 10px 0px 10px 0px; -} - -.input-group label { - display: block; - text-align: left; - margin: 3px; -} - -.input-group input { - height: 30px; - width: 93%; - padding: 5px 10px; - font-size: 16px; - border-radius: 5px; - border: 1px solid gray; -} - -#user_type { - height: 40px; - width: 98%; - padding: 5px 10px; - background: white; - font-size: 16px; - border-radius: 5px; - border: 1px solid gray; -} - -.btn { - padding: 10px; - font-size: 15px; - color: white; - background: rgb(9, 117, 240); - border: none; - border-radius: 5px; -} - -.error { - width: 92%; - margin: 0px auto; - padding: 10px; - border: 1px solid #a94442; - color: #a94442; - background: #f2dede; - border-radius: 5px; - text-align: left; -} - -.success { - color: #3c763d; - background: #dff0d8; - border: 1px solid #3c763d; - margin-bottom: 20px; -} - -.profile_info img { - display: inline-block; - width: 50px; - height: 50px; - margin: 5px; - float: left; -} - -.profile_info div { - display: inline-block; - margin: 5px; -} - -.profile_info:after { - content: ""; - display: block; - clear: both; +* { + margin: 0px; + padding: 0px; +} + +body { + font-size: 120%; + background: rgb(160, 160, 173); +} + +.header { + width: 40%; + margin: 50px auto 0px; + color: white; + background: rgb(26, 65, 122); + text-align: center; + border: 1px solid #B0C4DE; + border-bottom: none; + border-radius: 10px 10px 0px 0px; + padding: 20px; +} + +form, +.content { + width: 40%; + margin: 0px auto; + padding: 20px; + border: 1px solid #B0C4DE; + background: rgb(219, 217, 217); + border-radius: 0px 0px 10px 10px; +} + +.input-group { + margin: 10px 0px 10px 0px; +} + +.input-group label { + display: block; + text-align: left; + margin: 3px; +} + +.input-group input { + height: 30px; + width: 93%; + padding: 5px 10px; + font-size: 16px; + border-radius: 5px; + border: 1px solid gray; +} + +#user_type { + height: 40px; + width: 98%; + padding: 5px 10px; + background: white; + font-size: 16px; + border-radius: 5px; + border: 1px solid gray; +} + +.btn { + padding: 10px; + font-size: 15px; + color: white; + background: rgb(9, 117, 240); + border: none; + border-radius: 5px; +} + +.error { + width: 92%; + margin: 0px auto; + padding: 10px; + border: 1px solid #a94442; + color: #a94442; + background: #f2dede; + border-radius: 5px; + text-align: left; +} + +.success { + color: #3c763d; + background: #dff0d8; + border: 1px solid #3c763d; + margin-bottom: 20px; +} + +.profile_info img { + display: inline-block; + width: 50px; + height: 50px; + margin: 5px; + float: left; +} + +.profile_info div { + display: inline-block; + margin: 5px; +} + +.profile_info:after { + content: ""; + display: block; + clear: both; } \ No newline at end of file diff --git a/html/tooling_stylesheets.css b/html/tooling_stylesheets.css index ffe7964d..d0b8c2cf 100644 --- a/html/tooling_stylesheets.css +++ b/html/tooling_stylesheets.css @@ -1,77 +1,77 @@ - -body { - color: #fff; - background: hsl(230, 11%, 11%); -} - -/* header */ -h1 { - text-align: center; - font-size: 60px; - color: rgb(250, 239, 239); - margin-top: 50px; - font-family: Arial, Helvetica, sans-serif; -} - -h2 { - text-align: center; - font-size: 30px; - font-family: cursive; -} - -/*Logo*/ - - -.Logo{ - margin: 0, auto; - text-align: center; -} - -.Logo:hover{ - transform: scale(1.07); -} - - -/*Global Tool Image */ - -.container { - width: 80%; - margin: auto; - overflow: hidden; - display: flex; -} - -.box { - float: left; - width: 30%; - margin: 10px; - padding: 10px; - text-align: center; - border: 1px #ddd solid; - border-radius: 5px; - box-shadow: 1px 5px 10px #ddd; - transition: all 0.2s; - box-sizing: border-box; -} - - -.box:hover { - left: 2px; - transform: scale(1.07); - background-color: rgb(44, 135, 209); -} - -#boxes .box img { - width: 90px; - height: 90px; -} - -.box { - float: none; - width: 70%; - margin: 10px auto; - overflow: hidden; -} - - - + +body { + color: #fff; + background: hsl(230, 11%, 11%); +} + +/* header */ +h1 { + text-align: center; + font-size: 60px; + color: rgb(250, 239, 239); + margin-top: 50px; + font-family: Arial, Helvetica, sans-serif; +} + +h2 { + text-align: center; + font-size: 30px; + font-family: cursive; +} + +/*Logo*/ + + +.Logo{ + margin: 0, auto; + text-align: center; +} + +.Logo:hover{ + transform: scale(1.07); +} + + +/*Global Tool Image */ + +.container { + width: 80%; + margin: auto; + overflow: hidden; + display: flex; +} + +.box { + float: left; + width: 30%; + margin: 10px; + padding: 10px; + text-align: center; + border: 1px #ddd solid; + border-radius: 5px; + box-shadow: 1px 5px 10px #ddd; + transition: all 0.2s; + box-sizing: border-box; +} + + +.box:hover { + left: 2px; + transform: scale(1.07); + background-color: rgb(44, 135, 209); +} + +#boxes .box img { + width: 90px; + height: 90px; +} + +.box { + float: none; + width: 70%; + margin: 10px auto; + overflow: hidden; +} + + + diff --git a/inventory/dev.yml b/inventory/dev.yml new file mode 100644 index 00000000..5b952ee1 --- /dev/null +++ b/inventory/dev.yml @@ -0,0 +1,12 @@ +[nfs] +172.31.3.128 ansible_connection=ssh ansible_ssh_user=ec2-user ansible_ssh_private_key_file=/home/ubuntu/key.pem + +[webservers] +172.31.12.46 ansible_connection=ssh ansible_ssh_user=ec2-user ansible_ssh_private_key_file=/home/ubuntu/key.pem +172.31.11.202 ansible_connection=ssh ansible_ssh_user=ec2-user ansible_ssh_private_key_file=/home/ubuntu/key.pem + +[db] +172.31.22.39 ansible_connection=ssh ansible_ssh_user=ubuntu ansible_ssh_private_key_file=/home/ubuntu/key.pem + +[lb] +172.31.43.144 ansible_connection=ssh ansible_ssh_user=ubuntu ansible_ssh_private_key_file=/home/ubuntu/key.pem \ No newline at end of file diff --git a/inventory/prod.yml b/inventory/prod.yml new file mode 100644 index 00000000..e69de29b diff --git a/inventory/staging.yml b/inventory/staging.yml new file mode 100644 index 00000000..e69de29b diff --git a/inventory/uat.yml b/inventory/uat.yml new file mode 100644 index 00000000..12fdf507 --- /dev/null +++ b/inventory/uat.yml @@ -0,0 +1,3 @@ +[uat-webservers] +172.31.2.89 ansible_connection=ssh ansible_ssh_user=ec2-user ansible_ssh_private_key_file=/home/ubuntu/key.pem +172.31.24.150 ansible_connection=ssh ansible_ssh_user=ec2-user ansible_ssh_private_key_file=/home/ubuntu/key.pem \ No newline at end of file diff --git a/playbooks/site.yml b/playbooks/site.yml new file mode 100644 index 00000000..66c73823 --- /dev/null +++ b/playbooks/site.yml @@ -0,0 +1,20 @@ +--- +- name: import common file + import_playbook: ../static-assignments/common.yml + tags: + - always + +- name: include env-vars file + import_playbook: ../dynamic-assignments/env-vars.yml + tags: + - always + +- name: import database file + import_playbook: ../static-assignments/db.yml + +- name: import webservers file + import_playbook: ../static-assignments/webservers.yml + +- name: import Loadbalancers assignment + import_playbook: ../static-assignments/lb.yml + when: load_balancer_is_required \ No newline at end of file diff --git a/start-apache b/start-apache index f68e5d6f..f128f56a 100755 --- a/start-apache +++ b/start-apache @@ -1,4 +1,4 @@ -#!/usr/bin/env bash -sed -i "s/Listen 80/Listen ${PORT:-80}/g" /etc/apache2/ports.conf -sed -i "s/:80/:${PORT:-80}/g" /etc/apache2/sites-enabled/* +#!/usr/bin/env bash +sed -i "s/Listen 80/Listen ${PORT:-80}/g" /etc/apache2/ports.conf +sed -i "s/:80/:${PORT:-80}/g" /etc/apache2/sites-enabled/* apache2-foreground \ No newline at end of file diff --git a/static-assignments/common-del.yml b/static-assignments/common-del.yml new file mode 100644 index 00000000..e027cead --- /dev/null +++ b/static-assignments/common-del.yml @@ -0,0 +1,25 @@ +--- +- name: update web, nfs servers + hosts: webservers, nfs + remote_user: ec2-user + become: yes + become_user: root + tasks: + - name: delete wireshark + yum: + name: wireshark + state: removed + +- name: update LB and dbserver + hosts: lb, db + remote_user: ubuntu + become: yes + become_user: root + tasks: + - name: delete wireshark + apt: + name: wireshark-qt + state: absent + autoremove: yes + purge: yes + autoclean: yes \ No newline at end of file diff --git a/static-assignments/common.yml b/static-assignments/common.yml new file mode 100644 index 00000000..b2d9c575 --- /dev/null +++ b/static-assignments/common.yml @@ -0,0 +1,22 @@ +--- +- name: update web, nfs and db servers + hosts: webservers, nfs + remote_user: ec2-user + become: yes + become_user: root + tasks: + - name: ensure wireshark is at the latest version + yum: + name: wireshark + state: latest + +- name: update LB server + hosts: lb, db + remote_user: ubuntu + become: yes + become_user: root + tasks: + - name: ensure wireshark is at the latest version + apt: + name: wireshark + state: latest \ No newline at end of file diff --git a/static-assignments/db.yml b/static-assignments/db.yml new file mode 100644 index 00000000..9887640e --- /dev/null +++ b/static-assignments/db.yml @@ -0,0 +1,4 @@ +--- +- hosts: db + roles: + - mysql \ No newline at end of file diff --git a/static-assignments/lb.yml b/static-assignments/lb.yml new file mode 100644 index 00000000..d6c8cbb7 --- /dev/null +++ b/static-assignments/lb.yml @@ -0,0 +1,5 @@ +--- +- hosts: lb + roles: + - { role: nginx, when: enable_nginx_lb and load_balancer_is_required } + - { role: apache, when: enable_apache_lb and load_balancer_is_required } \ No newline at end of file diff --git a/static-assignments/uat-webservers.yml b/static-assignments/uat-webservers.yml new file mode 100644 index 00000000..dfc19ebc --- /dev/null +++ b/static-assignments/uat-webservers.yml @@ -0,0 +1,4 @@ +--- +- hosts: uat-webservers + roles: + - webserver \ No newline at end of file diff --git a/tooling-db.sql b/tooling-db.sql index b12d0582..4db6d1e2 100644 --- a/tooling-db.sql +++ b/tooling-db.sql @@ -1,77 +1,77 @@ --- phpMyAdmin SQL Dump --- version 5.0.2 --- https://www.phpmyadmin.net/ --- --- Host: 127.0.0.1 --- Generation Time: Oct 14, 2020 at 03:51 PM --- Server version: 10.4.14-MariaDB --- PHP Version: 7.4.9 -SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; -START TRANSACTION; -SET time_zone = "+00:00"; -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */ -; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */ -; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */ -; -/*!40101 SET NAMES utf8mb4 */ -; --- --- Database: `multi_login` --- --- -------------------------------------------------------- --- --- Table structure for table `users` --- -CREATE TABLE `users` ( - `id` int(11) NOT NULL, - `username` varchar(255) NOT NULL, - `password` varchar(255) NOT NULL, - `email` varchar(255) NOT NULL, - `user_type` varchar(255) NOT NULL, - `status` varchar(10) NOT NULL -) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4; --- --- Dumping data for table `users` --- -INSERT INTO `users` ( - `id`, - `username`, - `password`, - `email`, - `user_type`, - `status` - ) -VALUES ( - 1, - 'admin', - '21232f297a57a5a743894a0e4a801fc3', - 'dare@dare.com', - 'admin', - '1' - ); --- --- Indexes for dumped tables --- --- --- Indexes for table `users` --- -ALTER TABLE `users` -ADD PRIMARY KEY (`id`); --- --- AUTO_INCREMENT for dumped tables --- --- --- AUTO_INCREMENT for table `users` --- -ALTER TABLE `users` -MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, - AUTO_INCREMENT = 3; -COMMIT; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */ -; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */ -; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */ +-- phpMyAdmin SQL Dump +-- version 5.0.2 +-- https://www.phpmyadmin.net/ +-- +-- Host: 127.0.0.1 +-- Generation Time: Oct 14, 2020 at 03:51 PM +-- Server version: 10.4.14-MariaDB +-- PHP Version: 7.4.9 +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +START TRANSACTION; +SET time_zone = "+00:00"; +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */ +; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */ +; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */ +; +/*!40101 SET NAMES utf8mb4 */ +; +-- +-- Database: `multi_login` +-- +-- -------------------------------------------------------- +-- +-- Table structure for table `users` +-- +CREATE TABLE `users` ( + `id` int(11) NOT NULL, + `username` varchar(255) NOT NULL, + `password` varchar(255) NOT NULL, + `email` varchar(255) NOT NULL, + `user_type` varchar(255) NOT NULL, + `status` varchar(10) NOT NULL +) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4; +-- +-- Dumping data for table `users` +-- +INSERT INTO `users` ( + `id`, + `username`, + `password`, + `email`, + `user_type`, + `status` + ) +VALUES ( + 1, + 'admin', + '21232f297a57a5a743894a0e4a801fc3', + 'dare@dare.com', + 'admin', + '1' + ); +-- +-- Indexes for dumped tables +-- +-- +-- Indexes for table `users` +-- +ALTER TABLE `users` +ADD PRIMARY KEY (`id`); +-- +-- AUTO_INCREMENT for dumped tables +-- +-- +-- AUTO_INCREMENT for table `users` +-- +ALTER TABLE `users` +MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, + AUTO_INCREMENT = 3; +COMMIT; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */ +; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */ +; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */ ; \ No newline at end of file