Continuous development is the process of constantly improving and updating a product or service. It involves making small changes over time in response to customer needs, market trends, and new technology. This approach recognizes that a product or service can always be improved. Continuous development is becoming more popular in many industries because it helps organizations stay competitive and adaptable in a changing business environment. In this article, we will explore the benefits of continuous development and some best practices for using it effectively.
There are multiple standalone and integrated into version control CI platforms, e.g.
Jenkins: Jenkins is a popular open-source automation server that can be used to automate the building, testing, and deployment of software. It is widely used in the industry and has a large community of users.
Travis CI: Travis CI is a cloud-based continuous integration and deployment platform that is easy to set up and use. It supports a wide range of programming languages and frameworks.
CircleCI: CircleCI is another cloud-based platform that provides continuous integration and deployment services. It is known for its speed and ease of use, and has integrations with many popular tools and services.
GitLab CI/CD: GitLab CI/CD is a part of the GitLab platform, which provides a complete DevOps solution. It supports continuous integration, testing, and deployment, as well as container registry and Kubernetes management.
TeamCity: TeamCity is a powerful on-premises build server that provides continuous integration, testing, and deployment capabilities. It is known for its flexibility and scalability, and has integrations with many popular tools and services.
BitBucket Pipelines: Integrated CI/CD platform that is part of Atlasian BitBucket.
As I am using Bitbucket currently, lets take a look how to implement laravel automated deployment using Bitbucket Pipelines
Setting up repository
There are some things required prior implementing deployment
- Set up ssh keys for deployment in Bitbucket. This is a nice guide how to set up this.
- Enabling pipeline support for repository in Bitbucket. Repository->Settings->Pipeline->settings
- Creating bitbucket-pipelines.yml file
Bitbucket-pipelines.yml file
image: php:8.2-fpm #image file as basis
pipelines:
default:
- step:
name: GenerateTest #install and compile everything
script:
- apt-get update && apt-get install -qy git curl unzip ssh
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
- source ~/.bashrc
- nvm install lts/fermium
- npm install
- npm run build
#- docker-php-ext-enable gd exif pdo_mysql zlib
- composer install --ignore-platform-reqs
#- ./vendor/bin/phpunit test
caches:
- composer
artifacts:
- vendor/**
- public/**
- step:
name: Lint #lint files so it would abort on syntax errors
script:
- ./vendor/bin/pint .
- stage:
name: Deploy to stagings
deployment: staging
steps:
- step:
script:
- apt-get update && apt-get install -qy git curl unzip ssh
- ssh-keyscan [host] >> ~/.ssh/known_hosts
- step:
script:
- pipe: atlassian/rsync-deploy:0.10.1
variables:
USER: [user]
SERVER: "[host]"
REMOTE_PATH: "[dir]"
SSH_KEY: $DEPLOY_SSH_KEY
LOCAL_PATH: "${BITBUCKET_CLONE_DIR}/*"
DEBUG: "true"
SSH_ARGS: " -o StrictHostKeyChecking=no "
EXTRA_ARGS: "--exclude=storage/logs/*"
- pipe: atlassian/ssh-run:0.4.3. #RUN commands to migrate
variables:
SSH_USER: "[user]"
SERVER: "[host]"
SSH_KEY: $DEPLOY_SSH_KEY
COMMAND: "cd [dir];php artisan migrate --force;php artisan db:seed --force;php artisan cache:clear;"
EXTRA_ARGS: " -o StrictHostKeyChecking=no "
And that is pretty much it.
As long as prior steps do not break, code + installed/generated JS+PHP libraries will be installed using BitBucket Pipelines.
0 Comments