Tutorial: Build your own package¶
This tutorial aims to guide you through the process of creating a package that can then be used to create a deployment.
- You have to be a registered partner of Elastycloud.
- You need to have an account and be able to sign in to the Elastycloud Console.
- You need to have experience in developing for Magento 2.
- You must have the
composerinstalled, and experience using them.
- You need a Bitbucket account, and permission to create new repositories.
- You need to get a personal Composer access key.
Before building the package, you have to select a name for it, and set the name in your elastycloud.yaml file.
- Sign in to the Elastycloud Console.
- Go to
Packagesin the menu.
- Press the
+button (Add package) near the top right corner of the page.
- Fill in the form according to the Package details, using the
Package keychosen earlier.
- Create a new Git repository in your Bitbucket account, following the Create Bitbucket repository instructions.
- Get the Elastycloud project skeleton, and push to your repository, following the Prepare and push repository instructions.
- Add and push a Git tag according to the Tag and trigger a build instructions.
- Go to the
Package Versionspage from the main menu and monitor the build status. Once it has been successfully built it can be deployed to production.
A package can be seen as the connection between a deployment and the source-code in your repository.
- Identifier Key
- A globally unique key to identify your package. You reference this in your elastycloud.yaml.
- Git repo name
- The “full name” of your repository in bitbucket. You can find this in the URL of your repository. E.g.
https://bitbucket.org/[Git repo name]/.
- Preferred Stable Version
- This is used to auto-select a version to install when none is specifically chosen. See: How to write version constraints.
Create Bitbucket repository¶
Sign in to Bitbucket and create a new repository.
Add a Bitbucket webhook in that repository (
Bitbucket ‣ [repo] ‣ Settings ‣ Webhooks ‣ Add webhook) with the title "Elastycloud" and the URL
Enable request history collection and leave rest as default.
This will trigger a build on every push.
invite firstname.lastname@example.org with read access to your repo and a support technician will approve your invite shortly.
Prepare and push repository¶
To get a template for your repository you can use our skeleton-repository:
Open a terminal to a local folder where you want to create the repository and run the following command:
git clone https://bitbucket.org/elastycloud/skeleton-magento.git rm -rf skeleton-magento/.git
Replace package.key in skeleton-magento/elastycloud.yaml with your own package key.
Inside of the magento/ folder you will find composer.json, which contains a requirement for the meta-package elastycloud/package_magento-base. This is how all cloud related modules will be included in your project.
Set up a Git repository inside the folder that was created, add, and commit all files within, then push it to your own Bitbucket repository.
To initiate the project, run
composer install in the Magento folder. This will fetch all the necessary Magento modules.
Once you have installed the project, the following files should be checked in to Git:
All other files are optional.
You configure how this project is built in elastycloud.yaml.
Tag and trigger a build¶
In order to trigger a build of your code, you must first tag it with a SemVer tag, e.g.
0.0.0-alpha.1, and then push that tag with Git.
git tag 0.0.0-alpha.1 git push --tags
Except for the build number, you can use all aspects of SemVer. This is because the builder automatically adds a build number.