• info@bizmate.biz

Little IT Tricks

GitLab Clone Private Repository with Access Token – Composer

When you are hosting private code, for instance for a reusable component, on Gitlab you will not be able to clone it unless you have access or are authenticated with the GitLab backend and are authorised to the repository.

Access tokens are a great way to allow an alternative way to clone or add your project as a dependency to a parent project. For example you can use tokens as part of your Continuous Integration pipeline to build, test and deploy your project.

If you add a project in your composer.json ( composer is the de facto package manager most used in PHP) , such as

composer.phar require "bizmate/my-private-package:2.*"

You will see something like

Could not fetch https://gitlab.com/api/v4/projects/bizmate%2Fmy-private-package/repository/archive.zip?sha=..., enter your gitlab.com credentials to access private repos
A token will be created and stored in "/home/composer/.composer/auth.json", your password will never be stored
To revoke access to this token you can visit gitlab.com/profile/applications
Username: 
Password: 
Bad credentials.
You can also manually create a personal token at https://gitlab.com/-/user_settings/personal_access_tokens
Add it using "composer config --global --auth gitlab-token.gitlab.com <token>"

Using username and password credentials is not a great approach as they are critical information and also because if you have 2FA enabled it might not work.

The only stable solution is to create a Personal Access Token and set it up in the Composer configuration so that composer can build the correct links to clone git repositories from GitLab by adding the right token to the URL.

Inspect your configuration within composer with command

$ composer config --list

#or

$ composer config --global --list

to fetch the global configuration. To set up the right configuration you can run

composer config --global gitlab-token.gitlab.com a______________________a

again the –global option is present to set it up in the system wide configuration of your PC.

phpbrew install php 7.2 with almost everything

$ phpbrew install 7.2 +everything -dtrace -pgsql -tidy

AWS SES Credentials Generation

Simple Email Service (SES) is one of the great AWS services for email

As per original instructions, credentials for this service can be generated from the console or you could generate it from your user credentials, AWS Secret Access Key.

Mount a AWS S3 bucket on a VM running a FTP service, and spin it also on AWS EC2

This is a drive through the requirement to install an AWS S3 Bucket on a Virtual Machine, on your PC and provisioned by VirtualBox, with an FTP service that can make use of the AWS S3 Bucket for persistent distributed storage. The reason to have a S3 bucket is to allow the use of a single persistent storage for several services (for instance multiple FTP servers) running for different clients and exposed by a dedicated virtual machine.

Enable a WIFI POS from your Windows computer

Please note the below instructions are for Windows only

You might want to enable access to your Windows laptop or to the internet through a Wifi network.

update git on ubuntu server

Are you stuck with an old version of git on your ubuntu server? Please continue reading below.

Mysql – enable table logging in general_log

Sometimes in DB used by different applications you might like to monitor what queries are executed and see them directly on your mysql client, like SqlYog or Sequel Pro.

GIT archive files

This is a brief note on how to export the last revision of your git repository to a directory or archive file.

Enable SSL virtual host in apache2 xampp

SSL set up on Apache needs a ssl enabled virtual host configuration with  matching certificate and private key.

Enable PHP Debugging – Eclipse XAMPP Chrome

Please note this article has been changed to be flexible enough to allow set-up of Xdebug for any Xamp environment (Windows/linux/mac). Also it directs you to use the Chrome Xdebug plugin so you can control when Xdebug is enabled for your application straight from Chrome without changing your php configuration and restarting Apache.

These are the different steps required to get the installation working

  1. Install the Xdebug PHP module in your php.ini – download the Xdebug module and enable it in PHP
  2. in eclipse configure the debug options to use Xdebug as default debugging tool
  3. Install and configure Xdebug Chrome Plugin
  4. Test the whole functionality from the browser

Go to the next page for detailed instructions on step 1.