Skip to content

Laravel Docker Jenkins PHPUnit Larastan DevContainer GitHubActions

Notifications You must be signed in to change notification settings

ZaforAbdullah/Blog-Application

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

1. Up & running the container

$ docker compose -f docker-compose.dev.yml up -d --force-recreate --build
$ docker exec -i local /bin/bash -c '/usr/local/bin/php artisan config:clear'
$ docker exec -i local /bin/bash -c '/usr/local/bin/php artisan cache:clear'
$ docker exec -i local /bin/bash -c '/usr/local/bin/php artisan view:clear'

2. Connection test to DB & DB migration

$ docker exec -i local /bin/bash -c '/usr/local/bin/php artisan DBConnection'
$ docker exec -i local /bin/bash -c '/usr/local/bin/php artisan migrate'

3. Run PHPUnit

$ docker exec -i local /bin/bash -c '/usr/local/bin/php artisan test'

4. Run Larastan static code analysis

$ docker exec -i local /bin/bash -c './vendor/bin/phpstan analyse --memory-limit=2G'

5. Jenkins Pipeline

Check Jenkins folder for how to setup Jenkins for this project, as this pipeline rely on the fact Docker/Docker Compose will available on Jenkins Node. For that DIND (Docker inside Docker) pattern was used with help of sysbox.
  • Dashboard > Manage Jenkins > Credentials > System > Global credentials (unrestricted)
Name Kind Description
repo_image Secret text repository/image
REMOTE_HOST Secret text Remote server IP Address
REMOTE_USER Secret text Remote server user name
DockerHub Username with password Create credentials of DockerHub (UserName & Personal access token)
SSH SSH Private Key SSH Username with private key
known_hosts Secret file Known Host Fingerprint

Globalcredentials


  • How to get known_hosts data
    1. ssh-keyscan -H [REMOTE_HOST] >> known_hosts
    2. paste the content on known_hosts Secret file
If Web Hooks create on GitHub, it can tigger the pipline

6. Application Description

Laravel Blog Application 🌟

laravel blog web application written in laravel v.9 by following TDD software deplovment with Jenkins CI/CD pipeline which also inclue deployment to remote server

Table of Content

  1. Admin Panel
  2. User Types
  3. Database
  4. Admin Abiliities
  5. Writer Abilities
  6. User Abilities
  7. TDD

Admin Panel

Admin Panel View

1  Admin

User Types

we have these user types

# User TYpe Description
1 admin admin can define a writer
2 writer writer can write posts
3 user user can see posts

Admin Abilities

  1. Define new Writer
  2. See Each Writer Posts
  3. Define New Category
  4. See All Category

Writer Abilities

  1. Write Posts
  2. Define Tags for a Post
  3. See Post Comments
  4. Able to approve comments to show them under a post
  5. TODOAble to Reply Comment

Writer View:

2 1 Writer

2 2 Writer

2 3 Writer

2 4 Writer

User Abilities

  • Able to See Posts
  • Write Comments

User View:

3 1 User

3 2 User

Database

Here is Blog Database Schema

Database

TDD

list of TDD

  • Test for Admin abilities
  • Test for Writer abilities
  • Test for User abilities
  • Test for Guest User
  • Test for Authentication

About

Laravel Docker Jenkins PHPUnit Larastan DevContainer GitHubActions

Resources

Stars

Watchers

Forks