mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-10-01 01:36:12 -04:00
build: Add basic sync features and better architecture
This commit is contained in:
parent
1d0fb489c3
commit
847e6bfb5b
@ -1,43 +0,0 @@
|
||||
FROM node:10-jessie
|
||||
#If encounter Invalid cross-device error -run on host 'echo N | sudo tee /sys/module/overlay/parameters/metacopy'
|
||||
WORKDIR /app/ui
|
||||
|
||||
COPY ui/package.json ui/yarn.lock ./
|
||||
RUN yarn install --pure-lockfile # This caches your deps
|
||||
COPY ui /app/ui
|
||||
RUN yarn build
|
||||
|
||||
FROM rust:1.33
|
||||
|
||||
# create a new empty shell project
|
||||
WORKDIR /app
|
||||
RUN USER=root cargo new server
|
||||
WORKDIR /app/server
|
||||
|
||||
# copy over your manifests
|
||||
COPY server/Cargo.toml server/Cargo.lock ./
|
||||
|
||||
# this build step will cache your dependencies
|
||||
RUN mkdir -p ./src/bin \
|
||||
&& echo 'fn main() { println!("Dummy") }' > ./src/bin/main.rs
|
||||
RUN cargo build --release --bin lemmy
|
||||
RUN rm -r ./target/release/.fingerprint/server-*
|
||||
|
||||
# copy your source tree
|
||||
# RUN rm -rf ./src/
|
||||
COPY server/src ./src/
|
||||
COPY server/migrations ./migrations/
|
||||
|
||||
# build for release
|
||||
RUN cargo build --frozen --release --bin lemmy
|
||||
RUN mv /app/server/target/release/lemmy /app/lemmy
|
||||
|
||||
# Get diesel-cli on there just in case
|
||||
# RUN cargo install diesel_cli --no-default-features --features postgres
|
||||
|
||||
# The output image
|
||||
# FROM debian:stable-slim
|
||||
# RUN apt-get -y update && apt-get install -y postgresql-client
|
||||
# COPY --from=rust /app/server/target/release/lemmy /app/lemmy
|
||||
# COPY --from=0 /app/ui/dist /app/dist
|
||||
EXPOSE 8536
|
69
README.md
69
README.md
@ -11,15 +11,16 @@
|
||||
|
||||
A link aggregator / reddit clone for the fediverse.
|
||||
|
||||
[Lemmy Dev instance](https://dev.lemmy.ml) *for testing purposes only*
|
||||
[Lemmy Dev instance](https://dev.lemmy.ml) _for testing purposes only_
|
||||
|
||||
This is a **very early beta version**, and a lot of features are currently broken or in active development, such as federation.
|
||||
|
||||
Front Page|Post
|
||||
---|---
|
||||
![main screen](https://i.imgur.com/y64BtXC.png)|![chat screen](https://i.imgur.com/vsOr87q.png)
|
||||
| Front Page | Post |
|
||||
| ----------------------------------------------- | ----------------------------------------------- |
|
||||
| ![main screen](https://i.imgur.com/y64BtXC.png) | ![chat screen](https://i.imgur.com/vsOr87q.png) |
|
||||
|
||||
## Features
|
||||
|
||||
- Open source, [AGPL License](/LICENSE).
|
||||
- Self hostable, easy to deploy.
|
||||
- Comes with [docker](#docker).
|
||||
@ -36,6 +37,7 @@ Front Page|Post
|
||||
- Front end is `~80kB` gzipped.
|
||||
|
||||
## About
|
||||
|
||||
[Lemmy](https://github.com/dessalines/lemmy) is similar to sites like [Reddit](https://reddit.com), [Lobste.rs](https://lobste.rs), [Raddle](https://raddle.me), or [Hacker News](https://news.ycombinator.com/): you subscribe to forums you're interested in, post links and discussions, then vote, and comment on them. Behind the scenes, it is very different; anyone can easily run a server, and all these servers are federated (think email), and connected to the same universe, called the [Fediverse](https://en.wikipedia.org/wiki/Fediverse).
|
||||
|
||||
For a link aggregator, this means a user registered on one server can subscribe to forums on any other server, and can have discussions with users registered elsewhere.
|
||||
@ -45,32 +47,73 @@ The overall goal is to create an easily self-hostable, decentralized alternative
|
||||
Each lemmy server can set its own moderation policy; appointing site-wide admins, and community moderators to keep out the trolls, and foster a healthy, non-toxic environment where all can feel comfortable contributing.
|
||||
|
||||
## Why's it called Lemmy?
|
||||
|
||||
- Lead singer from [motorhead](https://invidio.us/watch?v=pWB5JZRGl0U).
|
||||
- The old school [video game](https://en.wikipedia.org/wiki/Lemmings_(video_game)).
|
||||
- The old school [video game](<https://en.wikipedia.org/wiki/Lemmings_(video_game)>).
|
||||
- The [furry rodents](http://sunchild.fpwc.org/lemming-the-little-giant-of-the-north/).
|
||||
|
||||
Made with [Rust](https://www.rust-lang.org), [Actix](https://actix.rs/), [Inferno](https://www.infernojs.org), [Typescript](https://www.typescriptlang.org/) and [Diesel](http://diesel.rs/).
|
||||
|
||||
## Install
|
||||
### Docker
|
||||
## Usage
|
||||
|
||||
### Production
|
||||
|
||||
#### Docker
|
||||
|
||||
Make sure you have both docker and docker-compose installed.
|
||||
|
||||
```
|
||||
git clone https://github.com/dessalines/lemmy
|
||||
cd lemmy
|
||||
./docker_update.sh # This pulls the newest version, builds and runs it
|
||||
```
|
||||
|
||||
and goto http://localhost:8536
|
||||
### Local Development
|
||||
#### Requirements
|
||||
|
||||
<!-- #### Kubernetes (WIP)
|
||||
|
||||
> TODO: Add production version with proper proxy setup and Ingress for WebSockets
|
||||
|
||||
```bash
|
||||
skaffold run -p lemmy--prod
|
||||
# Now go to http://${IP}:30002
|
||||
``` -->
|
||||
|
||||
### Development
|
||||
|
||||
#### Kubernetes
|
||||
|
||||
This requires:
|
||||
|
||||
- Local or remote Kubernetes Cluster, i.e. [`minikube`](https://kubernetes.io/docs/tasks/tools/install-minikube/)
|
||||
- [`kubectl`](https://kubernetes.io/docs/tasks/tools/install-kubectl/)
|
||||
- [`skaffold`](https://skaffold.dev/)
|
||||
|
||||
After satisfying the requirements, run the following:
|
||||
|
||||
```bash
|
||||
skaffold dev -p lemmy--dev
|
||||
```
|
||||
|
||||
And goto http://localhost:4444.
|
||||
|
||||
#### Non-Kubernetes
|
||||
|
||||
##### Requirements
|
||||
|
||||
- [Rust](https://www.rust-lang.org/)
|
||||
- [Yarn](https://yarnpkg.com/en/)
|
||||
- [Postgres](https://www.sqlite.org/index.html)
|
||||
#### Set up Postgres DB
|
||||
|
||||
##### Set up Postgres DB
|
||||
|
||||
```
|
||||
psql -c "create user rrr with password 'rrr' superuser;" -U postgres
|
||||
psql -c 'create database rrr with owner rrr;' -U postgres
|
||||
```
|
||||
#### Running
|
||||
|
||||
##### Running
|
||||
|
||||
```
|
||||
git clone https://github.com/dessalines/lemmy
|
||||
cd lemmy
|
||||
@ -79,15 +122,19 @@ cd lemmy
|
||||
# cd ui && yarn start
|
||||
# cd server && cargo watch -x run
|
||||
```
|
||||
|
||||
and goto http://localhost:8536
|
||||
|
||||
## Documentation
|
||||
|
||||
- [ActivityPub API.md](docs/API.md)
|
||||
- [Goals](docs/goals.md)
|
||||
- [Ranking Algorithm](docs/ranking.md)
|
||||
|
||||
## Support
|
||||
|
||||
Lemmy is free, open-source software, meaning no advertising, monetizing, or venture capital, ever. Your donations directly support full-time development of the project.
|
||||
|
||||
- [Support on Patreon](https://www.patreon.com/dessalines).
|
||||
- [Sponsor List](https://dev.lemmy.ml/#/sponsors).
|
||||
- bitcoin: `bc1queu73nwuheqtsp65nyh5hf4jr533r8rr5nsj75`
|
||||
|
17
server/Dockerfile.dev
Normal file
17
server/Dockerfile.dev
Normal file
@ -0,0 +1,17 @@
|
||||
# Setup env
|
||||
FROM rust:1.33
|
||||
RUN mkdir -p /opt/lemmy/server--dev
|
||||
WORKDIR /opt/lemmy/server--dev
|
||||
# Create empty directory where the frontend would normally be
|
||||
RUN mkdir -p /opt/lemmy/ui--dev/dist
|
||||
# Enable deps caching
|
||||
RUN mkdir -p src/bin
|
||||
RUN echo 'fn main() { println!("Dummy") }' >src/bin/main.rs
|
||||
# Install deps
|
||||
COPY Cargo.toml .
|
||||
COPY Cargo.lock .
|
||||
RUN cargo build
|
||||
# Add app
|
||||
COPY . .
|
||||
# Run app
|
||||
CMD cargo run
|
@ -38,8 +38,8 @@ spec:
|
||||
image: postgres:11.2-alpine
|
||||
resources:
|
||||
limits:
|
||||
memory: 128Mi
|
||||
cpu: 500m
|
||||
memory: 256Mi
|
||||
cpu: 512m
|
||||
ports:
|
||||
- containerPort: 5432
|
||||
envFrom:
|
||||
@ -66,48 +66,46 @@ spec:
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: lemmy
|
||||
name: lemmy-server--dev
|
||||
data:
|
||||
LEMMY_FRONT_END_DIR: /app/dist
|
||||
LEMMY_FRONT_END_DIR: /opt/lemmy/ui--dev/dist # not actually used here, polyfill for monolith
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: lemmy
|
||||
name: lemmy-server--dev
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: lemmy
|
||||
app: lemmy-server--dev
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: lemmy
|
||||
app: lemmy-server--dev
|
||||
spec:
|
||||
containers:
|
||||
- name: lemmy
|
||||
command:
|
||||
- /bin/sh -c /app/lemmy
|
||||
- name: lemmy-server--dev
|
||||
image: registry.gitlab.com/pojntfx/lemmy/server.dev
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: lemmy
|
||||
- configMapRef:
|
||||
name: postgres
|
||||
image: registry.gitlab.com/pojntfx/lemmy/lemmy
|
||||
- configMapRef:
|
||||
name: lemmy-server--dev
|
||||
resources:
|
||||
limits:
|
||||
memory: 128Mi
|
||||
cpu: 500m
|
||||
memory: 256Mi
|
||||
cpu: 256m
|
||||
ports:
|
||||
- containerPort: 8536
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: lemmy
|
||||
name: lemmy-server--dev
|
||||
spec:
|
||||
type: NodePort
|
||||
selector:
|
||||
app: lemmy
|
||||
app: lemmy-server--dev
|
||||
ports:
|
||||
- port: 8536
|
||||
nodePort: 30001
|
@ -1,13 +1,25 @@
|
||||
apiVersion: skaffold/v1beta9
|
||||
kind: Config
|
||||
profiles:
|
||||
- name: lemmy--dev--no-sync
|
||||
- name: lemmy--dev
|
||||
build:
|
||||
artifacts:
|
||||
- image: registry.gitlab.com/pojntfx/lemmy/lemmy
|
||||
- image: registry.gitlab.com/pojntfx/lemmy/server.dev
|
||||
context: server
|
||||
docker:
|
||||
dockerfile: Dockerfile.dev
|
||||
sync:
|
||||
"**/*.rs": src/
|
||||
- image: registry.gitlab.com/pojntfx/lemmy/ui.dev
|
||||
context: ui
|
||||
docker:
|
||||
dockerfile: Dockerfile.dev
|
||||
sync:
|
||||
"**/*.ts": src/
|
||||
"**/*.tsx": src/
|
||||
"**/*.css": src/
|
||||
deploy:
|
||||
kubectl:
|
||||
manifests:
|
||||
- stack.dev.yaml
|
||||
- server/stack.dev.yaml
|
||||
- ui/stack.dev.yaml
|
||||
|
12
ui/Dockerfile.dev
Normal file
12
ui/Dockerfile.dev
Normal file
@ -0,0 +1,12 @@
|
||||
# Setup env
|
||||
FROM node:10
|
||||
RUN mkdir -p /opt/lemmy/ui--dev
|
||||
WORKDIR /opt/lemmy/ui--dev
|
||||
# Install deps
|
||||
COPY package.json .
|
||||
COPY yarn.lock .
|
||||
RUN npm install
|
||||
# Add app
|
||||
COPY . .
|
||||
# Run app
|
||||
CMD npm start
|
35
ui/stack.dev.yaml
Normal file
35
ui/stack.dev.yaml
Normal file
@ -0,0 +1,35 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: lemmy-ui--dev
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: lemmy-ui--dev
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: lemmy-ui--dev
|
||||
spec:
|
||||
containers:
|
||||
- name: lemmy-ui--dev
|
||||
image: registry.gitlab.com/pojntfx/lemmy/ui.dev
|
||||
resources:
|
||||
limits:
|
||||
memory: 1024Mi
|
||||
cpu: 512m
|
||||
ports:
|
||||
- containerPort: 4444
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: lemmy-ui--dev
|
||||
spec:
|
||||
type: NodePort
|
||||
selector:
|
||||
app: lemmy-ui--dev
|
||||
ports:
|
||||
- port: 4444
|
||||
nodePort: 30002
|
Loading…
Reference in New Issue
Block a user