Deploy a Meilisearch instance on DigitalOcean

    Part 1: Deploy Meilisearch on a Droplet

    1. Create a new Droplet

    DigitalOcean Droplets are Linux-based virtual machines in which you can run your applications.

    Once you log in to your DigitalOcean account, click the green "Create" button at the top-right of the page and select "Droplets".

    Selecting "Droplets" from the "Create" dropdown

    Refer to DigitalOcean's documentation to learn more about creating and configuring Droplets.

    2. Select a region for your Droplet

    Select the region where you want to deploy your Droplet. Remember, the closer you are to your users, the better their search experience with Meilisearch will be.

    Selecting the London data center region

    3. Select Meilisearch image

    By default, DigitalOcean displays the "OS" tab. Select the "Marketplace" tab, search for "Meilisearch", and select the image.

    Search results for 'Meilisearch' in Marketplace

    4. Choose Droplet size

    This is where you choose the amount of RAM, storage, and CPU cores your Droplet will have. Select your plan based on your needs. Memory-optimized options will give you better results when working with big datasets.

    Selecting the plan based on your usage

    5. Choose an authentication method

    You can either use SSH keys or a password to access your Droplet. We recommend using SSH keys as they are more secure.

    Selecting SSH keys for authentication

    Select the SSH keys you want to add to your Droplet. If you don't have a key, follow DigitalOcean's instructions on how to create one.

    6. Choose your Droplet name and tags

    Here you can select the name that will be visible everywhere in your DigitalOcean account. Droplets can only contain alphanumeric characters, dashes, and periods.

    Adding 'meilisearch-droplet-name' as the hostname

    Tags are great for managing resources. They are custom labels you assign to droplets. Tags can contain letters, numbers, colons, dashes, and underscores. You can use multiple tags for a single resource. Try naming tags based on a droplet's function.

    The search bar, meilisearch, and search-team tags

    7. Click on "Create Droplet"

    The "Create Droplet" button

    8. Test Meilisearch

    Once created, click on the Droplet's public IP address to copy it:

    meilisearch-droplet-name instance's IP: 165.227.56.77

    Paste it into your browser. If you can access the search preview, Meilisearch is ready to use.

    Meilisearch search preview

    Part 2: Configure production settings in your Meilisearch Droplet

    To configure Meilisearch for production on a DigitalOcean Droplet, use SSH to access your Droplet and a script will guide you through the process. Alternatively, use the Droplet Console with your preferred browser.

    1. Make your domain name point to your Droplet

    If you want to use your own domain, click the "Create" button and select "Domain/DNS".

    Selecting Domain/DNS from the Create menu

    Type in your domain name in the "Enter domain field" and click "Add Domain".

    Domains tab on the Networking page

    This should work out of the box. Your domain name should now be linked to your Meilisearch instance. Use curl to access it and verify DNS has been properly configured:

    curl -v http://<your-domain-name>/health
    

    The server should answer with a 200 OK status code and the following body {"status": "available"}:

    …
    HTTP/1.1 200 OK
    …
    {"status": "available"}
    …
    

    2. Set master key and SSL (HTTPS)

    Meilisearch is currently running in a development environment. We haven't set up a master key, meaning anyone can read/write to the Meilisearch instance. Since we aren't using HTTPS yet, this configuration is unsafe for production.

    To start the configuration process, either connect to your Droplet via SSH or use the Droplet Console in your preferred browser and follow the instructions:

    2.1. Run the configuration script

    Open a terminal and start a new SSH connection with the IP you got from DigitalOcean.

    Type in the following command in your terminal and press Enter to establish a connection:

    ssh root@DIGITAL_OCEAN_IP_ADDRESS
    

    Type yes and press Enter to accept the authentication process.

    NOTE

    The above command is not required if you are using the Droplet Console.

    A script will run automatically, asking for your settings and desired configuration. If you want to run this script again anytime, you can do so by using the following command:

    meilisearch-setup
    

    The same script will run automatically if you use the Droplet Console.

    3. Enjoy your ready-to-use Meilisearch droplet

    Your Meilisearch Droplet is ready to be used in production.

    To check if everything is running smoothly, do an HTTP call to the /health route:

    curl -v https://<your-domain-name>/health
    

    The server should answer with a 200 OK status code and the following body {"status": "available"} as shown in the example below:

    …
    HTTP/1.1 200 OK
    …
    {"status": "available"}
    …