Tuesday, 20 December 2022

Successfully create AWS Account with gitlab integration


1. create aws ec2 account && with generated pair keys


2. create gitlab repository and push your local files

git remote add origin https://gitlab.com/syafiqzahir94/dtu-laravel.git

git branch -M main

git push -uf origin main 

git pull origin main --allow-unrelated-histories && git push (for existing)


3. putty access

-copy bengkel.pem && generate with puttygen

-connect *host with auth key pairs

-then login as ubuntu


3. setup our bengkel instance in AWS


-install composer

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-composer-on-ubuntu-20-04


-install php

sudo apt install php


-install apache2

https://www.digitalocean.com/community/tutorials/how-to-install-the-apache-web-server-on-ubuntu-20-04

sudo apt install apache2


-install mysql

https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-20-04

sudo apt install mysql-server


4. cloning our application from gitlab/github

sudo git clone https://gitlab.com/syafiqzahir94/bengkel.git

Sunday, 11 December 2022

Spatie Laravel Permission & Check Role




$role = Role::findById(3, null); //use spatie\permissions\model\role to get role model;

$role->hasPermissionTo('Complaint Review'); //check role has the valid permission?


auth()->user()->hasPermissionTo('Complaint List'); //check under model user has permission ?

auth()->user()->permissions->pluck('name'); //getting all permissions plucn 'name' under model user

auth()->user()->getAllPermissions()->pluck('name'); //get all permissions name under (role) 


auth()->user()->roles->pluck('name'); //get model user role name

auth()->user()->roles->first()->name; //get role name under user

auth()->user()->roles->first()->name; //get role id under user


auth()->user()->can('Complaint Review'); //check under model_has_permission  

auth()->user()->getPermissionsViaRoles(); //get all permissions collection under role

foreach (auth()->user()->getPermissionsViaRoles() as $permission) {

  echo $permission->name . ' | ';

Saturday, 10 December 2022

Request Laravel Compare Route

Example of getting route name and path in Laravel 8




//get all uri except domain host
request()->getRequestUri();

//raw path info after domain and protocal in uri
request()->getPathInfo();

//trim the slash "/" inside uri
request()->path();

//check route name w/o group
request()->is('licenses');

//get and check route name
request()->route()->named('licenses.index')
  
//get first segment of path url
request()->segments()[0]



Example of Use :







Monday, 5 December 2022

docker commands cli

 





docker commands (vital) :

docker-compose exec php bash -c 'ls'

list of commands :
-pwd
-docker images
-docker ps
-docker container ls
-docker stats
-docker exec -it php bash
-sudo docker-compose down
-sudo docker-compose ps
-docker-compose exec app ls -l
-docker-compose up -d --build
-docker network create axel-cloud-app-shared

Wednesday, 19 October 2022

Git Reset and Clean Unstaged files

  • unstage all files 

    • git reset --hard
  • remove all git unstage files
    • git clean -df
Git Force Merge 




Sunday, 18 September 2022

Multiple SSH credentials gitlab and github

 https://gist.github.com/Sotatek-NuiTran/a20d6827d874ca5f5b7b01e1a6d8fd01



https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent


how to insert to ssh agent and check list of keys

 eval `ssh-agent -s`
ssh-add ~/.ssh/id_rsa
ssh-add -l

Apache2 & laravel installation in Ubuntu 20.04

step 1 - login github & create new repo

step 2 - generate ssh id_rsa and add to github

 ssh-keygen -t rsa -b 4096 "your_email"

 step 3 - installation composer 

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-composer-on-ubuntu-20-04

step 3.5 (optional)

- enabling permission
    sudo chmod -777 /var/www


4. installation details

1. laravel project

https://aws.plainenglish.io/how-to-deploy-a-laravel-project-into-a-aws-ec2-instance-ae067b70e4e2

2. laravel project  

https://ioecapsule.com/how-to-deploy-laravel-application-on-aws-ec2/

3. medium

https://medium.com/nerd-for-tech/how-to-deploy-laravel-project-on-ec2-aws-6d004a57bb1f








Tuesday, 29 March 2022

Thursday, 17 March 2022

php 8.2 dependency

==> Installing php@8.2 from shivammathur/php

==> Installing dependencies for shivammathur/php/php@8.2: apr, ca-certificates, openssl@1.1, apr-util, argon2, aspell, m4, autoconf, brotli, gettext, libunistring, libidn2, libnghttp2, libssh2, openldap, rtmpdump, zstd, curl, libtool, unixodbc, freetds, libpng, freetype, fontconfig, jpeg, giflib, imath, openexr, libtiff, webp, jpeg-xl, libvmaf, aom, libavif, gd, gmp, icu4c, krb5, libpq, libsodium, libzip, oniguruma, pcre2, readline, sqlite and tidy-html5

Install brew cask & install docker

Install Brew

  1. Make sure you've installed Brew, with this (wait until its done installing) (Edit: added ending quote to the end)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Then follow NEXT STEPS shown on command line, it should show something like this
==> Next steps:
- Add Homebrew to your PATH in /Users/$USER/.zprofile:
    echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> /Users/$USER/.zprofile
    eval $(/opt/homebrew/bin/brew shellenv)
  1. Copy and paste the first line on the same terminal window, then hit enter
echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> /Users/$USER/.zprofile
  1. Then Copy and paste the last line on the same terminal window, then hit enter
eval $(/opt/homebrew/bin/brew shellenv)

Install Docker

To install: brew install --cask docker

To uninstall: brew uninstall --cask docker



OPEN DOCKER


open /Applications/Docker.app

Saturday, 23 October 2021

Guidline @ Reference Step By Step Deploy Node JS onto Digital Ocean

 https://medium.com/nerd-for-tech/deploy-your-nodejs-application-to-a-digital-ocean-droplet-step-by-step-guide-3f6f928f776

Install latest node JS in Ubuntu --> Digital Ocean

 //STEP 1:install using curl (PPA)

sudo apt update && sudo apt install curl -y

//STEP 2:install latest version (replace 14.x with requird one(i.e 15.x))

curl -sL https://deb.nodesource.com/setup_15.x | sudo -E bash -

sudo apt install nodejs

nodejs -v

v15.3.0

Saturday, 25 September 2021

Codepush & Ionic Integration

 1. npm install cordova-plugin-code-push

2. npm install @ionic-native/code-push

3. npm install -g appcenter-cli    

4. appcenter login

5. ionic cordova build android

//6. appcenter codepush release-cordova -a Digital-Venus/APLUSSBOSS-Android-UAT -m

7. appcenter codepush release-cordova -a Digital-Venus/APLUSBOSS-APP-V2 -m


# Release a mandatory update with a changelog

appcenter codepush release -a <ownerName>/MyApp-ios -c ios/App/App/public/ -m --description "Modified the header color"


# Release a dev Android build to just 1/4 of your end users

appcenter codepush release -a <ownerName>/MyApp-android -c android/app/src/main/assets/public/ --rollout 25


# Release an update that targets users running any 1.1.* binary, as opposed to

# limiting the update to exact version name in the config.xml file

appcenter codepush release -a <ownerName>/MyApp-android -c android/app/src/main/assets/public/ --target-binary-version "~1.1.0"


# Release an update now but mark it as disabled

# so that no users can download it yet

appcenter codepush release -a <ownerName>/MyApp-ios -c ios/App/App/public/ -x


# Release an update signed by private key (public key should be configured for application)

appcenter codepush release -a <ownerName>/MyApp-android -c android/app/src/main/assets/public/ --privateKeyPath ~/rsa/private_key.pem


references

https://github.com/mapiacompany/capacitor-codepush


config.xml

<preference name="APP_SECRET" value="7056bb94-2703-4e01-ab79-66848505b6a9" />

<preference name="APPCENTER_ANALYTICS_ENABLE_IN_JS" value="true" />

<preference name="CodePushDeploymentKey" value="OrnEAKcjIXFcKo4He7YoHaBN9BEIcg35AdbTM" />

Ionic Cordova platform - android 9.1 sdk build tools ^31.0.0 issue

C:\Users\$user\AppData\Local\Android\Sdk\build-tools\31.0.0
 

This is happened because dx files are missing from Android SDK Build Tools 31.0.0 and replaced with d8 files. Try to modify Android SDK Build Tools 31.0.0 by:
  1. In the Android SDK Build Tools 31.0.0 folder, create a copy of d8.bat and rename it to dx.bat.
  1. In the lib folder, create a copy of d8.jar and rename it to dx.jar.



Additional Check ionic cordova version

Method 1


Method 2 :
cordova -v

to see the currently running version. Run the npm info command

npm info cordova

for a longer listing that includes the current version along with other available version numbers

Thursday, 23 September 2021

NPM Specific Version Package

 

How To Know Package Versions Available




If you want to know the exact version of a package to install, you can simply search for it on the npm public registry database

Or, you can simply run the following command to check the available versions on the npm registry:

  npm view [package-name] versions

 

If you want to know the specific latest version of a package available on the npm registry, run the following command:

  npm view [package-name] version

 

For example, here is how you can check the latest version of the Renovate package:

resource :

https://www.whitesourcesoftware.com/free-developer-tools/blog/npm-install-specific-version/

Sunday, 19 September 2021

Issue with gradle

 


Apparently you should accept the license,so in your command promp:

cd /d "%ANDROID_SDK_ROOT%/tools/bin"

and then

sdkmanager --licenses

just accept the license and the error should goes away.

request headers in http options (angular)

 https://stackoverflow.com/questions/53980413/angular-common-http-has-no-exported-member-requestoptions

Friday, 23 July 2021

Monday, 28 June 2021

Chart with mongodb and php

 https://github.com/sikrigagan/PHP-MongoDB-Charts/blob/master/index.php