mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-22 20:31:19 +00:00
Some fixes for the docker build.
- Messed with readme. - They needed to be `.env`, not `env`. - Leaving the nginx file there, but extracting it out of the main setup. Ppl might use apache, or none at all. - Docker 3.3 doesn't work with the DB health check unfortunately, so I changed that back to 2.4. - Changed the env in the docker folder so it doesn't need to be edited, someone could just pull this and start it up if they just wanna test it.
This commit is contained in:
parent
06a9417671
commit
431210025d
6 changed files with 49 additions and 52 deletions
57
README.md
57
README.md
|
@ -28,7 +28,7 @@ Front Page|Post
|
||||||
|
|
||||||
- Open source, [AGPL License](/LICENSE).
|
- Open source, [AGPL License](/LICENSE).
|
||||||
- Self hostable, easy to deploy.
|
- Self hostable, easy to deploy.
|
||||||
- Comes with [Docker](#docker).
|
- Comes with [Docker](#docker), [Ansible](#ansible).
|
||||||
- Live-updating Comment threads.
|
- Live-updating Comment threads.
|
||||||
- Full vote scores `(+/-)` like old reddit.
|
- Full vote scores `(+/-)` like old reddit.
|
||||||
- Moderation abilities.
|
- Moderation abilities.
|
||||||
|
@ -64,51 +64,42 @@ Made with [Rust](https://www.rust-lang.org), [Actix](https://actix.rs/), [Infern
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
### Ansible (recommended)
|
### Docker
|
||||||
|
|
||||||
First, you need to [install Ansible on your local computer](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html),
|
Make sure you have both docker and docker-compose(>=`1.24.0`) installed.
|
||||||
eg using `sudo apt install ansible`, or the equivalent for you platform.
|
|
||||||
|
|
||||||
Then run the following commands on your local computer:
|
|
||||||
```bash
|
|
||||||
git clone https://github.com/dessalines/lemmy.git
|
|
||||||
cd lemmy/ansible/
|
|
||||||
cp inventory.example inventory
|
|
||||||
nano inventory # enter your server, domain, contact email
|
|
||||||
ansible-playbook lemmy.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
### Manual
|
|
||||||
|
|
||||||
Make sure you have both docker and docker-compose installed.
|
|
||||||
|
|
||||||
```
|
```
|
||||||
mkdir lemmy/
|
mkdir lemmy/
|
||||||
cd lemmy/
|
cd lemmy/
|
||||||
wget https://raw.githubusercontent.com/dessalines/lemmy/master/docker/prod/docker-compose.yml
|
wget https://raw.githubusercontent.com/dessalines/lemmy/master/docker/prod/docker-compose.yml
|
||||||
wget https://raw.githubusercontent.com/dessalines/lemmy/master/docker/prod/env -O .env
|
wget https://raw.githubusercontent.com/dessalines/lemmy/master/docker/prod/env -O .env
|
||||||
wget https://raw.githubusercontent.com/dessalines/lemmy/master/docker/prod/nginx.conf
|
# Edit the .env for custom passwords
|
||||||
# you need to edit .env and nginx.conf to replace the indicated {{ variables }}
|
|
||||||
sudo mv nginx.conf /etc/nginx/sites-enabled/lemmy.conf
|
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
and goto http://localhost:8536
|
and goto http://localhost:8536
|
||||||
|
|
||||||
### Nginx Config
|
[A sample nginx config](/docker/prod/nginx.conf), could be setup with:
|
||||||
```
|
|
||||||
location / {
|
|
||||||
rewrite (\/(user|u|inbox|post|community|c|login|search|sponsors|communities|modlog|home)+) /static/index.html break;
|
|
||||||
proxy_pass http://0.0.0.0:8536;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
|
|
||||||
# WebSocket support
|
```
|
||||||
proxy_http_version 1.1;
|
wget https://raw.githubusercontent.com/dessalines/lemmy/master/docker/prod/nginx.conf
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
# Replace the {{ vars }}
|
||||||
proxy_set_header Connection "upgrade";
|
sudo mv nginx.conf /etc/nginx/sites-enabled/lemmy.conf
|
||||||
}
|
```
|
||||||
|
|
||||||
|
### Ansible
|
||||||
|
|
||||||
|
First, you need to [install Ansible on your local computer](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html),
|
||||||
|
eg using `sudo apt install ansible`, or the equivalent for you platform.
|
||||||
|
|
||||||
|
Then run the following commands on your local computer:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/dessalines/lemmy.git
|
||||||
|
cd lemmy/ansible/
|
||||||
|
cp inventory.example inventory
|
||||||
|
nano inventory # enter your server, domain, contact email
|
||||||
|
ansible-playbook lemmy.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
## Develop
|
## Develop
|
||||||
|
|
4
docker/dev/.env
Normal file
4
docker/dev/.env
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
DOMAIN=my_domain
|
||||||
|
DATABASE_PASSWORD=password
|
||||||
|
DATABASE_URL=postgres://lemmy:password@lemmy_db:5432/lemmy
|
||||||
|
JWT_SECRET=changeme
|
|
@ -5,13 +5,13 @@ services:
|
||||||
image: postgres:12-alpine
|
image: postgres:12-alpine
|
||||||
restart: always
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_USER: rrr
|
- POSTGRES_USER=lemmy
|
||||||
POSTGRES_PASSWORD: rrr
|
- POSTGRES_PASSWORD=${DATABASE_PASSWORD}
|
||||||
POSTGRES_DB: rrr
|
- POSTGRES_DB=lemmy
|
||||||
volumes:
|
volumes:
|
||||||
- lemmy_db:/var/lib/postgresql/data
|
- lemmy_db:/var/lib/postgresql/data
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "pg_isready -U rrr"]
|
test: ["CMD-SHELL", "pg_isready -U lemmy"]
|
||||||
interval: 5s
|
interval: 5s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 20
|
retries: 20
|
||||||
|
@ -22,10 +22,10 @@ services:
|
||||||
ports:
|
ports:
|
||||||
- "8536:8536"
|
- "8536:8536"
|
||||||
environment:
|
environment:
|
||||||
LEMMY_FRONT_END_DIR: /app/dist
|
- LEMMY_FRONT_END_DIR=/app/dist
|
||||||
DATABASE_URL: postgres://rrr:rrr@lemmy_db:5432/rrr
|
- DATABASE_URL=${DATABASE_URL}
|
||||||
JWT_SECRET: changeme
|
- JWT_SECRET=${JWT_SECRET}
|
||||||
HOSTNAME: rrr
|
- HOSTNAME=${DOMAIN}
|
||||||
restart: always
|
restart: always
|
||||||
depends_on:
|
depends_on:
|
||||||
lemmy_db:
|
lemmy_db:
|
||||||
|
|
4
docker/prod/.env
Normal file
4
docker/prod/.env
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
DOMAIN=my_domain
|
||||||
|
DATABASE_PASSWORD=password
|
||||||
|
DATABASE_URL=postgres://lemmy:password@lemmy_db:5432/lemmy
|
||||||
|
JWT_SECRET=changeme
|
|
@ -1,8 +1,7 @@
|
||||||
version: "3.3"
|
version: '2.4'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
lemmy_db:
|
||||||
db:
|
|
||||||
image: postgres:12-alpine
|
image: postgres:12-alpine
|
||||||
restart: always
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
|
@ -10,15 +9,14 @@ services:
|
||||||
- POSTGRES_PASSWORD=${DATABASE_PASSWORD}
|
- POSTGRES_PASSWORD=${DATABASE_PASSWORD}
|
||||||
- POSTGRES_DB=lemmy
|
- POSTGRES_DB=lemmy
|
||||||
volumes:
|
volumes:
|
||||||
- ./volumes/db:/var/lib/postgresql/data
|
- lemmy_db:/var/lib/postgresql/data
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "pg_isready -U lemmy"]
|
test: ["CMD-SHELL", "pg_isready -U lemmy"]
|
||||||
interval: 5s
|
interval: 5s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 20
|
retries: 20
|
||||||
|
|
||||||
lemmy:
|
lemmy:
|
||||||
image: dessalines/lemmy:v0.0.7
.3
|
image: dessalines/lemmy:v0.0.7.3
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- "8536:8536"
|
- "8536:8536"
|
||||||
|
@ -27,5 +25,9 @@ services:
|
||||||
- DATABASE_URL=${DATABASE_URL}
|
- DATABASE_URL=${DATABASE_URL}
|
||||||
- JWT_SECRET=${JWT_SECRET}
|
- JWT_SECRET=${JWT_SECRET}
|
||||||
- HOSTNAME=${DOMAIN}
|
- HOSTNAME=${DOMAIN}
|
||||||
|
restart: always
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
lemmy_db:
|
||||||
|
condition: service_healthy
|
||||||
|
volumes:
|
||||||
|
lemmy_db:
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
DOMAIN={{your domain}}
|
|
||||||
DATABASE_PASSWORD={{a random password for postgres}}
|
|
||||||
DATABASE_URL=postgres://lemmy:{{ the same postgres password again }}@db:5432/lemmy
|
|
||||||
JWT_SECRET={{ a random password for jwt}}
|
|
Loading…
Reference in a new issue