bookmark_borderConfirm AWS Elastic Beanstalk Deployment Progress

Amazon Web Services Elastic Beanstalk

Use case:
You are using Amazon Web Service(AWS) Elastic Beanstalk to handle your deployment process via some git version control pipelines and there is a step that needs to run after your code has been deployed successfully.

There are a lot of solutions that can be used e.g CloudWatch, Lambda Function,.. etc. but I decided to invent my own solution that is easy, interesting and will cost 0$ :))



Idea:
Use a unique value on pipeline level (e.g pipeline build number) and add it to new code before upload it to server then call some endpoint or file to check this value. while this value does not equal out the new unique value in the pipeline then the deployment not finished yet and we should wait!


How to add new value to new code?
– we will create special endpoint or file in our project
– in the pipeline before upload new code to server change value of this file eg. deploy_version.txt or endpoint {api_link}/current_version
e.g: set some variable value with a new unique value. (you can do that using e.g sed Unix-like command)

ex.

we have a static endpoint that returns JSON result with the value of currentVersion variable that placed in e.g `version.js`

const currentVersion='123';

in the pipeline before upload code step:
- sed -i 2"s/currentVersion='123'/currentVersion='$BITBUCKET_BUILD_NUMBER'/g" src/version.js


How to validate deployment progress?

create a bash script that will send curl request to that endpoint to validate if current version from the endpoint(currently deployed code) is equal to new unique pipeline value or not.

how can this bash script look like? email me for more details(khaledalam.net@gmail.com)


bookmark_borderIdeal City

Cloud system micro-serviced using Docker, Python, Golang, Node, Flask, Gin, Express.js, MongoDB

Reflection

Show cheaper products of a target city comparing to your city!

=> City Searcher API Microservice Repo

Run
sh run.sh

output

live demo: http://khaledalam.net:8001


Architecture

GitHub: https://github.com/khaledalam/ideal-city

bookmark_borderAwesome Docker WordPress

Simple and easy containerized WordPress website with docker-compose.

Components used:

  • [image] wordpress:latest
  • [image] mysql:5.7
  • [image] phpmyadmin/phpmyadmin
  • docker
  • docker-compose
  • wget, curl, tar, mysqladmin

Usage

  • $ git clone
  • $ cd awecome-docker-wordpress
  • make sure ports in docker-compose file are opened and not in used
  • make sure no running containers using same ports. delete all containers: $ docker rm $(docker -aq) -f
  • $ sudo ./build.sh
  • Naviagate to:
    website: localhost or 127.0.0.1
    PMA: localhost:5000 or 127.0.0.1:5000

Notes: if you want to use your existing WordPress files remove or comment <<< Download latest wordpress section in build.sh file and put your files in app folder!


GitHub: https://github.com/khaledalam/awesome-docker-wordpress

bookmark_borderFlutter GitLab CI/CD DevOps

  1. Create .gitlab-ci.yml file in Project root dir
    in the same level of lib folder create file .gitlab-ci.yml
  2. Get a docker:image
    There are some flutter docker images available you can select one or even use your own Docker image

    Flutter docker images examples:
    cirrusci/flutter:stable (github)
    kattwinkel/flutter-android (github)

    Then add it in .gitlab-ci.yml file:
    image: cirrusci/flutter:stable
  3. Define your stages
    Now you need to define stages like that:
    For example:
    stages:
    - test
    - build

    Then start to define tasks that each stage should run:
    For example for stage test:


    test:
    stage: test
    script:
    - flutter packages get
    - flutter packages upgrade
    - flutter test
    interruptible: true

    For example for stage build:


    build:
    stage: build
    script:
    - flutter build apk
    artifacts:
    expire_in: 1 week
    paths:
    - build/app/outputs/apk/release/app-release.apk
    interruptible: true

    Full Example

    .gitlab-ci.yml

    image: cirrusci/flutter:stable

    stages:
    - test
    - build

    test:
    stage: test
    script:
    - flutter packages get
    - flutter packages upgrade
    - flutter test
    interruptible: true

    build:
    stage: build
    script:
    - flutter build apk
    artifacts:
    expire_in: 1 week
    paths:
    - build/app/outputs/apk/release/app-release.apk
    interruptible: true

    You can add more stages like deploy , upgrade , publish etc..