Skip to content

Commit 7ccfc4c

Browse files
committed
add server setup docs
1 parent c97fe7c commit 7ccfc4c

File tree

2 files changed

+136
-19
lines changed

2 files changed

+136
-19
lines changed

README.md

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# ![Meh Logo](meh.svg) Meh…
2+
23
## …another comment system
34

45
Meh…
@@ -16,43 +17,62 @@ Meh…
1617

1718
Meh is a commenting system with a client-server architecture:
1819

19-
- **Server Component**: A PHP backend that handles comment storage (in SQLite), moderation, and API endpoints. It can be installed on your own server and supports multiple sites from a single installation.
20+
- **Server Component**: A PHP backend that handles comment storage (in SQLite), moderation, and API endpoints. It can be
21+
installed on your own server and supports multiple sites from a single installation.
2022

21-
- **Client Components**: A set of web components (custom HTML elements) that can be embedded in any website to display and submit comments. These components communicate with the server via a REST API.
23+
- **Client Components**: A set of web components (custom HTML elements) that can be embedded in any website to display
24+
and submit comments. These components communicate with the server via a REST API.
2225

23-
## Devel Quick Start
26+
## Quick Start
2427

25-
You can use this to get a development environment up and running quickly. This is not suitable for production use. But should answer all your questions about how Meh works.
28+
A quick and dirty way to get started is to use the built-in PHP server on your local machine.
2629

27-
cd backend
28-
composer install
29-
cd ../frontend
30-
npm install
31-
npm run build
32-
cd ..
33-
cp .env.example .env
34-
$EDITOR .env
35-
./meh migrate
36-
php -s localhost:8000 -t public
30+
```bash
31+
cd backend
32+
composer install
33+
cd ../frontend
34+
npm install
35+
npm run build
36+
cd ..
37+
cp .env.example .env
38+
$EDITOR .env
39+
./meh migrate
40+
php -s localhost:8000 -t public
41+
```
3742

38-
You can then use `http://localhost:8000/` as the base URL for all components.
43+
You can now browse this documentation at `http://localhost:8000`. It will also serve the Meh components and the API.
3944

40-
## Server Setup
45+
In your blog, add the following to your HTML:
46+
47+
```html
48+
<!-- Add a comment form -->
49+
<script type="module" src="http://localhost:8000/meh/meh.esm.js"></script>
50+
51+
<meh-form>
52+
<meh-mastodon></meh-mastodon>
53+
<meh-login></meh-login>
54+
</meh-form>
55+
<meh-comments></meh-comments>
56+
```
4157

58+
This should give you a rough idea how Meh works. For a production setup, you should point your web server at the public.
59+
60+
More details on how to set up the server can be found in the [Server Setup](doc/server.md) section.
61+
62+
## Server Setup
4263

4364
* [Command Line Tool](doc/cli.md)
44-
* [Database Setup and Upgrade](doc/migrate.md)
65+
* [Database Setup and Upgrade](doc/migrate.md)
4566
* [Configuration](doc/config.md)
4667
* [Multi-site Support](doc/multisite.md)
4768
* [Mastodon Integration](doc/mastodon.md)
4869
* [Email Notifications](doc/smtp.md)
4970
* [Gravatar Integration](doc/gravatar.md)
5071
* [Importing from Disqus](doc/disqus.md)
5172

52-
5373
## Client Setup and Usage (on your blog)
5474

5575
* [Component Setup](doc/components.md)
56-
* [Styling Components](doc/styling.md)
76+
* [Styling Components](doc/styling.md)
5777
* [Comment Moderation](doc/moderation.md)
5878
* [Customizing Translations](doc/translations.md)

doc/server.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Server Setup
2+
3+
There are different ways to get Meh up and running. You can use Docker, Docker Compose, or set it up manually on your server.
4+
5+
## Using Docker
6+
7+
Meh is available as a Docker image for easy deployment. It's based on the official PHP image and includes everything you need to run Meh.
8+
9+
Images are available on the [GitHub Container Registry (GHCR)](https://github.com/splitbrain/meh/pkgs/container/meh) and [Docker Hub](https://hub.docker.com/r/splitbrain/meh).
10+
11+
To start the container use:
12+
13+
```bash
14+
docker run --name meh -p 8080:80 -v meh-data:/app/data splitbrain/meh:latest
15+
```
16+
17+
To run the [command line tool](cli.md) use:
18+
19+
```bash
20+
docker exec meh /app/meh
21+
```
22+
23+
Use the [command line tool](cli.md) to [initialize the database](migrate.md) and configure your installation. [Configuration](configuration.md) can also be done via environment variables.
24+
25+
26+
## Using Docker Compose
27+
28+
Docker Compose makes it easy to define and manage your Meh deployment configuration. Here's a minimal example:
29+
30+
```yaml
31+
services:
32+
meh:
33+
image: splitbrain/meh:latest
34+
ports:
35+
- "8080:80"
36+
volumes:
37+
- ./data:/app/data
38+
restart: unless-stopped
39+
```
40+
41+
Start the container with:
42+
43+
```bash
44+
docker-compose up -d
45+
```
46+
47+
To run the [command line tool](cli.md) use:
48+
49+
```bash
50+
docker-compose exec meh /app/meh
51+
```
52+
53+
Use the [command line tool](cli.md) to [initialize the database](migrate.md) and configure your installation. [Configuration](configuration.md) can also be done via environment variables.
54+
55+
## Manual Setup
56+
57+
Of course, you can run the whole thing the classical way.
58+
59+
### Requirements
60+
61+
- PHP 8.1 or higher
62+
- SQLite extension for PHP
63+
- Composer (for installation)
64+
- Node.js and npm (for building the frontend)
65+
- Web server (Apache, Nginx, etc.)
66+
67+
### Installation Steps
68+
69+
1. Clone the repository:
70+
```bash
71+
git clone https://github.com/splitbrain/meh.git
72+
cd meh
73+
```
74+
75+
2. Install backend dependencies:
76+
```bash
77+
cd backend
78+
composer install --no-dev
79+
cd ..
80+
```
81+
82+
3. Build the frontend:
83+
```bash
84+
cd frontend
85+
npm install
86+
npm run build
87+
cd ..
88+
```
89+
90+
4. Point your web server to the `public` directory
91+
92+
Use the [command line tool](cli.md) to [initialize the database](migrate.md) and configure your installation. [Configuration](configuration.md) can also be done via environment variables.
93+
94+
95+
### URL Rewriting
96+
97+
Meh requires URL rewriting to work correctly. There's a `.htaccess` file included that handles this for Apache. For other web servers, you need to configure URL rewriting manually.

0 commit comments

Comments
 (0)