You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2051: Updated systemd service r=guimachiavelli a=foxycode
# Pull Request
## Related issue
Fixes#3243
## What does this PR do?
- added system user for meilisearch
- set basic config using config file
- save files to proper directories
## PR checklist
Please check if your PR fulfills the following requirements:
- [x] Listed the changes applied in the PR description
- [x] Have you read the contributing guidelines?
- [x] Have you made sure that the title is accurate and descriptive of the changes?
Co-authored-by: Tomáš Jacík <foxycode@sunfox.cz>
Co-authored-by: gui machiavelli <hey@guimachiavelli.com>
[Step 2: Run Meilisearch as a service](/learn/cookbooks/running_production.md#step-2-run-meilisearch-as-a-service)
15
+
[Step 2: Create system user](/learn/cookbooks/running_production.md#step-2-create-system-user)
16
16
17
-
+[2.1. Create a service file](/learn/cookbooks/running_production.md#_2-1-create-a-service-file)
18
-
+[2.2. Enable and start service](/learn/cookbooks/running_production.md#_2-2-enable-and-start-service)
17
+
[Step 3: Create a configuration file](/learn/cookbooks/running_production.md#step-3-create-a-configuration-file)
19
18
20
-
[Step 3: Secure and finish your setup. Using a reverse proxy, domain name and HTTPS](/learn/cookbooks/running_production.md#step-3-secure-and-finish-your-setup-using-a-reverse-proxy-domain-name-and-https)
19
+
[Step 4: Run Meilisearch as a service](/learn/cookbooks/running_production.md#step-4-run-meilisearch-as-a-service)
21
20
22
-
+[3.1. Creating a reverse proxy with Nginx](/learn/cookbooks/running_production.md#_3-1-creating-a-reverse-proxy-with-nginx)
23
-
+[3.2. Set up SSL/TLS for your Meilisearch](/learn/cookbooks/running_production.md#_3-2-set-up-ssl-tls-for-your-meilisearch)
21
+
+[4.1. Create a service file](/learn/cookbooks/running_production.md#_4-1-create-a-service-file)
22
+
+[4.2. Enable and start service](/learn/cookbooks/running_production.md#_4-2-enable-and-start-service)
23
+
24
+
[Step 5: Secure and finish your setup](/learn/cookbooks/running_production.md#step-5-secure-and-finish-your-setup)
25
+
26
+
+[5.1. Creating a reverse proxy with Nginx](/learn/cookbooks/running_production.md#_5-1-creating-a-reverse-proxy-with-nginx)
27
+
+[5.2. Set up SSL/TLS for your Meilisearch](/learn/cookbooks/running_production.md#_5-2-set-up-ssl-tls-for-your-meilisearch)
@@ -64,32 +68,44 @@ Meilisearch is finally installed and ready to use. To make it accessible from ev
64
68
65
69
```bash
66
70
# Move the Meilisearch binary to your system binaries
67
-
mv ./meilisearch /usr/bin/
71
+
mv ./meilisearch /usr/local/bin/
68
72
```
69
73
70
-
You can now start using Meilisearch! In your terminal, run the following command to launch meilisearch.
74
+
## Step 2: Create system user
75
+
76
+
Running applications as root can introduce security flaws in your system. To prevent that from happening, create a dedicated system user for running Meilisearch:
In Linux environments, a `service` is a process that can be launched when the operating system is booting and which will keep running in the background. One of its biggest advantages is making your program available at any moment. Even if some execution problems or crashes occur, the service will be restarted and your program will be run again.
95
111
@@ -99,7 +115,7 @@ If you are new to services and `systemd`, you can learn more about the basics of
99
115
100
116
In Debian and other Linux distributions, `systemd` allows you to create and manage your own custom services. In order to make sure that Meilisearch will always respond to your requests, you can build your own service. This way, you will ensure its availability in case of a crash or in case of system reboot. If any of these occur, `systemd` will automatically restart Meilisearch.
101
117
102
-
### 2.1. Create a service file
118
+
### 4.1. Create a service file
103
119
104
120
Service files are text files that tell your operating system how to run your program, and when. They live in the `/etc/systemd/system` directory, and your system will load them at boot time. In this case, let's use a very simple service file that will run Meilisearch on port `7700`.
@@ -128,7 +147,7 @@ For more information on Meilisearch security and API keys see the [security docs
128
147
129
148
As for now, it is not time yet to expose your Meilisearch instance to the external world. To keep running it safely inside your own environment, make it available locally at `local`. This means that only programs running on your machine are allowed to make requests to your Meilisearch instance.
130
149
131
-
### 2.2. Enable and start service
150
+
### 4.2. Enable and start service
132
151
133
152
The service file you just built is all you need for creating your service. Now you must `enable` it to tell the operating system that we want it to run Meilisearch at every boot. You can then `start` the service to make it run immediately. Ensure everything is working smoothly by checking the service `status`.
134
153
@@ -155,11 +174,11 @@ At this point, Meilisearch is installed and running. It is protected from eventu
155
174
156
175
But you probably want to open your Meilisearch to the outside world, and for now, it is isolated. Let's fix that in a safe way.
157
176
158
-
## Step 3: Secure and finish your setup using a reverse proxy, domain name, and HTTPS
177
+
## Step 5: Secure and finish your setup
159
178
160
179
It's time to safely make your brand new Meilisearch available to be requested from the outside world. For this purpose, you will use two of the main technologies available on the web: a Reverse Proxy and SSL/TLS.
161
180
162
-
### 3.1. Creating a reverse proxy with [Nginx](https://www.nginx.com/)
181
+
### 5.1. Creating a reverse proxy with [Nginx](https://www.nginx.com/)
163
182
164
183
A reverse proxy is basically an application that will handle every communication between the outside world and your internal applications. Nginx will receive external HTTP requests and redirect them to Meilisearch. When Meilisearch has done its amazing job, it will communicate its response to Nginx, which will then transfer the latter to the user who originally sent the request. This is a common way to isolate and protect any application by adding a robust, secure, and fast gate-keeper such as Nginx, one of the safest and most efficient tools available online, and of course, open-source!
165
184
@@ -212,7 +231,7 @@ If you want to learn more about using Nginx as a Reverse Proxy, see [this dedica
212
231
213
232
The only remaining problem is that Meilisearch processes requests via HTTP without any additional security. The content that is being transmitted over HTTP could easily be read or modified by attackers, and someone could get full or partial access to your data. In order to prevent this to happen, it's important to use the HTTPS, which will enable you to use a SSL/TLS certificate, and securely transmit data.
214
233
215
-
### 3.2. Set up SSL/TLS for your Meilisearch
234
+
### 5.2. Set up SSL/TLS for your Meilisearch
216
235
217
236
SSL will let the user or client establish an authenticated connection to Meilisearch. In this way, a user can verify server's identity before sending sensitive data or making any request to it. Then, data is sent in an encrypted way that only Meilisearch server will be able to decrypt, providing you a fast, reliable, and automatic layer of security.
218
237
@@ -225,7 +244,7 @@ To illustrate this, if you had registered your domain name `example.com`, reques
225
244
226
245
Once your domain name has been set up, you are ready to configure SSL/TLS and use HTTPS. You have two different options to achieve this goal. The first one is using [Certbot](https://certbot.eff.org/), an amazing, free, and very easy to use tool. If you already have SSL certificates issued from a `Certificate Authority or CA` for your domain name, the second option covers the steps you need to follow. Then, you will be ready to use Meilisearch safely in production!
227
246
228
-
#### 3.2. Option A: Certbot
247
+
#### 5.2.1. Option A: Certbot
229
248
230
249
Using certbot in your Linux server is very straightforward. This tool will generate a free SSL/TLS certificate for your domain name, and automatically handle its installation on your server. The certbot documentation contains detailed instructions for many operating systems and servers, but we will follow the instructions for [Certbot on Debian with Nginx](https://certbot.eff.org/instructions?ws=nginx&os=debianbuster).
231
250
@@ -254,7 +273,7 @@ change by editing your web server's configuration.
254
273
255
274
We recommend that you choose option 2, to redirect HTTP to HTTPS and always use a secure connection. You should be able to request your domain name with SSL as in`https://example.com` or `https://example.com/indexes`.
256
275
257
-
#### 3.2. Option B: Custom SSL/TLS certificates
276
+
#### 5.2.2. Option B: Custom SSL/TLS certificates
258
277
259
278
When a `Certificate Authority` issues a SSL certificate for you, you receive at least two files with encrypted keys:
0 commit comments