Contributing
November 15, 2022 · View on GitHub
First of all, thank you for contributing to Meilisearch! The goal of this document is to provide everything you need to know in order to contribute to Meilisearch and its different integrations.
- Assumptions
- How to Contribute
- Development Workflow
- Git Guidelines
- Release Process (for internal team only)
Assumptions
- You're familiar with GitHub and the Pull Request(PR) workflow.
- You've read the Meilisearch documentation and the README.
- You know about the Meilisearch community. Please use this for help.
How to Contribute
- Make sure that the contribution you want to make is explained or detailed in a GitHub issue! Find an existing issue or open a new one.
- Once done, fork the meilisearch-aws repository in your own GitHub account. Ask a maintainer if you want your issue to be checked before making a PR.
- Create a new Git branch.
- Make the changes on your branch.
- Submit the branch as a PR pointing to the
mainbranch of the main meilisearch-aws repository. A maintainer should comment and/or review your Pull Request within a few days. Although depending on the circumstances, it may take longer.
We do not enforce a naming convention for the PRs, but please use something descriptive of your changes, having in mind that the title of your PR will be automatically added to the next release changelog.
Development Workflow
Setup
pip3 install -r requirements.txt
Tests and Linter
Each PR should pass the tests and the linter to be accepted.
# Linter
pylint tools
Git Guidelines
Git Branches
All changes must be made in a branch and submitted as PR. We do not enforce any branch naming style, but please use something descriptive of your changes.
Git Commits
As minimal requirements, your commit message should:
- be capitalized
- not finish by a dot or any other punctuation character (!,?)
- start with a verb so that we can read your commit message this way: "This commit will ...", where "..." is the commit message. e.g.: "Fix the home page button" or "Add more tests for create_index method"
We don't follow any other convention, but if you want to use one, we recommend this one.
GitHub Pull Requests
Some notes on GitHub PRs:
- Convert your PR as a draft if your changes are a work in progress: no one will review it until you pass your PR as ready for review.
The draft PR can be very useful if you want to show that you are working on something and make your work visible. - The branch related to the PR must be up-to-date with
mainbefore merging. If it's not, you have to rebase your branch. Check out this quick tutorial to successfully apply the rebase from a forked repository. - All PRs must be reviewed and approved by at least one maintainer.
- The PR title should be accurate and descriptive of the changes.
Release Process (for the internal team only)
⚠️ The cloud-scripts repository should be upgraded to the new version before this repository can be updated and released.
The release tags of this package follow exactly the Meilisearch versions.
It means that, for example, the v0.17.0 tag in this repository corresponds to the AWS AMI running Meilisearch v0.17.0.
This repository currently does not provide any automated way to test and release the AWS AMI.
Please, follow carefully the steps in the next sections before any release.
Set your environment
After cloning this repository, install python dependencies with the following command:
pip3 install -r requirements.txt
Before running any script, make sure to set your AWS credentials locally. Make sure that your default region on this configuration is us-east-1 to guarantee the availability of the Debian base AMI specified as the DEBIAN_BASE_IMAGE_ID variable at tools/config.py.
If you want to use another region as default, you will need to find the corresponding Debian AMI ID and update it in the script.
-
Create a
Security Groupon your AWS account, opening inbound traffic to port SSH (22), HTTP (80) and HTTPS (443) for any origin (or your own IP address if you prefer). Use yourSecurity Groupname as a value for theSECURITY_GROUPvariable in thetools/config.pyscript. -
Create an AWS
Key Pair. Use yourKey Pairname as a value for theSSH_KEYvariable in thetools/config.pyscript. -
Remember to modify the permissions on your PEM file with:
chmod 400 YourKeyPairPemFile.pem
- Update the path to your PEM file as a value of the
SSH_KEY_PEM_FILEvariable in thetools/config.pyscript.
Test before Releasing
-
In
tools/config.py, update theMEILI_CLOUD_SCRIPTS_VERSION_TAGvariable value with the new Meilisearch version you want to release, in the format:vX.X.X. If you want to test with a Meilisearch RC, replace it by the right RC version tag (vX.X.XrcX). -
Run the
tools/build_image.pyscript to build the AWS AMI without analytics:
python3 tools/build_image.py --no-analytics
This command will create an AWS EC2 Instance on Meilisearch's account and configure it in order to prepare the Meilisearch AMI. It will then create an AMI, which should be private, but ready to be published in the following steps. The instance will automatically be terminated after the AMI creation.
The AMI name will be Meilisearch-v.X.X.X-Debian-X-BUILD-(XX-XX-XXXX).
-
Test the image: create a new EC2 instance based on the new AMI
Meilisearch-v.X.X.X-Debian-X-BUILD-(XX-XX-XXXX), and make sure everything is running smoothly. Remember to set yourSecurity Group, or allow inbound traffic to ports22,80and443. Connect via SSH to the droplet and test the configuration script that is run automatically on login.
🗑 Don't forget to destroy the Droplet after the test. -
When you are ready to create the final image to release juste remove the
--no-analyticsoption
python3 tools/build_image.py
Publish the AWS AMI and Release
⚠️ The AWS AMI should never be published with a RC version of Meilisearch.
Once the tests in the previous section have been done:
-
Set the AMI ID that you TESTED and you want to publish and propagate over AWS regions. You should set the ID of the IMAGE that you built in the previous step as the value of the
PUBLISH_IMAGE_IDintools/config.py. -
Run the
tools/publish_image.pyscript to propagate and publish the AWS AMI in every AWS region:
python3 tools/publish_image.py
-
Commit your changes on a new branch.
-
Open a PR from the branch where changes where done and merge it.
-
Create a git tag on the last
maincommit:
git checkout main
git pull origin main
git tag vX.X.X
git push origin vX.X.X
⚠️ If changes where made to the repository between your testing branch was created and the moment it was merged, you should consider building the image and testing it again. Some important changes may have been introduced, unexpectedly changing the behavior of the image that will be published to the Marketplace.
Clean old AWS AMI images
Make sure that the last 2 versions of Meilisearch AMI are available and public in every AWS region. Our goal is to always offer the latest Meilisearch version to AWS users, but we are keeping the previous version in case there is a bug or a problem in the latest one. Any other older version of the AMI must be deleted.
To proceed to delete older AMIs that should no longer be available, use the tools/unpublish_image.py script to delete every other AMI that is present in AWS:
-
Define the image name as the value of the variable
DELETE_IMAGE_NAMEin thetools/config.pyscript. -
Run the
tools/unpublish_image.pyscript to delete the AWS AMIs worldwide:
python3 tools/unpublish_image.py
Update the AWS AMI between two Meilisearch Releases
It can happen that you need to release a new AWS AMI but you cannot wait for the new Meilisearch release.
For example, the v0.17.0 is already pushed but you find out you need to fix the installation script: you can't wait for the v0.18.0 release and need to re-publish the v0.17.0 AWS AMI.
In this case:
- Apply your changes and reproduce the testing process (see Test before Releasing).
- Delete the current tag remotely and locally:
git push --delete origin vX.X.X
git tag -d vX.X.X
- Publish the AMI again (see Publish the AWS AMI and Release)
Thank you again for reading this through. We can not wait to begin to work with you if you make your way through this contributing guide ❤️