Compare commits

...

3 Commits

  1. 1
      README.md
  2. 9
      docker/chapo-dev/docker-compose.yml
  3. 18
      docker/chapo-dev/nginx-lemmy-dev.conf
  4. 9
      docker/chapo-prod/docker-compose.yml
  5. 5
      docker/dev/docker_update.sh
  6. 1
      server/lemmy_utils/src/settings.rs
  7. 12
      server/src/main.rs
  8. 59
      server/src/routes/index.rs
  9. 1
      server/src/routes/mod.rs

1
README.md

@ -6,7 +6,6 @@
**Production:** [![Build Status](https://drone.chapo.chat/api/badges/chapo-collective/lemmy-hexbear/status.svg?ref=refs/heads/prod)](https://drone.chapo.chat/chapo-collective/lemmy-hexbear)
**Dev-Server:** [![Build Status](https://drone.chapo.chat/api/badges/chapo-collective/lemmy-hexbear/status.svg?ref=refs/heads/dev)](https://drone.chapo.chat/chapo-collective/lemmy-hexbear)
[Original Lemmy README](README-lemmy.md)
</div>

9
docker/chapo-dev/docker-compose.yml

@ -3,8 +3,13 @@ version: '3.3'
services:
hexbear-frontend:
image: registry.chapo.chat/hexbear-frontend:dev
volumes:
- frontend:/app/dist
container_name: lemmy-dev-fe
ports:
- "127.0.0.1:4444:4444"
environment:
- PG_CONN_URL=postgres://lemmy:${LEMMYDEV_POSTGRES_PW}@postgres-dev:5433/lemmy
depends_on:
- postgres
lemmy:
image: registry.chapo.chat/hexbear:dev-latest

18
docker/chapo-dev/nginx-lemmy-dev.conf

@ -5,6 +5,12 @@ server {
return 301 https://thoseamongbranches.chapo.chat$request_uri;
}
#if the incoming client is another federated server, proxy them to the backend when they query /
map $http_accept $root_port {
default "4444";
application/activity+json "8536";
}
server {
listen 443 ssl http2;
server_name thoseamongbranches.chapo.chat;
@ -37,6 +43,12 @@ server {
#limit_req zone=lemmy_ratelimit burst=30 nodelay;
location / {
proxy_pass http://0.0.0.0:$root_port;
rewrite ^(.+)/+$ $1 permanent;
include proxy-set-headers.conf;
}
location /api {
proxy_pass http://0.0.0.0:8536;
rewrite ^(.+)/+$ $1 permanent;
include proxy-set-headers.conf;
@ -47,6 +59,12 @@ server {
proxy_set_header Connection "upgrade";
}
location /feeds {
proxy_pass http://0.0.0.0:8536;
rewrite ^(.+)/+$ $1 permanent;
include proxy-set-headers.conf;
}
# Redirect pictshare images to pictrs
location ~ /pictshare/(.*)$ {
return 301 /pictrs/image/$1;

9
docker/chapo-prod/docker-compose.yml

@ -3,8 +3,13 @@ version: '3.3'
services:
hexbear-frontend:
image: registry.chapo.chat/hexbear-frontend:prod
volumes:
- frontend:/app/dist
container_name: lemmy-dev-fe
ports:
- "127.0.0.1:4444:4444"
environment:
- PG_CONN_URL=postgres://lemmy:${LEMMYPROD_POSTGRES_PW}@postgres-prod:5433/lemmy
depends_on:
- postgres
lemmy:
image: registry.chapo.chat/hexbear:prod-latest

5
docker/dev/docker_update.sh

@ -1,6 +1,5 @@
#!/bin/sh
set -e
sudo chown -R 991:991 volumes/pictrs
sudo docker build ../../ --file ../dev/Dockerfile -t lemmy-dev:latest
sudo docker-compose up -d
docker build ../../ --file ../dev/Dockerfile -t lemmy-dev:latest
docker-compose up -d

1
server/lemmy_utils/src/settings.rs

@ -13,7 +13,6 @@ pub struct Settings {
pub bind: IpAddr,
pub port: u16,
pub jwt_secret: String,
pub front_end_dir: String,
pub pictrs_url: String,
pub rate_limit: RateLimitConfig,
pub email: Option<EmailConfig>,

12
server/src/main.rs

@ -103,7 +103,6 @@ async fn main() -> Result<(), LemmyError> {
.allow_any_header()
.max_age(3600);
let settings = Settings::get();
let rate_limiter = rate_limiter.clone();
App::new()
.wrap_fn(add_cache_headers)
@ -115,19 +114,8 @@ async fn main() -> Result<(), LemmyError> {
.configure(federation::config)
.configure(feeds::config)
.configure(|cfg| images::config(cfg, &rate_limiter))
.configure(index::config)
.configure(nodeinfo::config)
.configure(webfinger::config)
// static files
.service(
actix_files::Files::new("/static", settings.front_end_dir.to_owned())
.use_etag(true)
.use_last_modified(true),
)
.service(actix_files::Files::new(
"/docs",
settings.front_end_dir + "/documentation",
))
})
.bind((settings.bind, settings.port))?
.run()

59
server/src/routes/index.rs

@ -1,59 +0,0 @@
use actix_files::NamedFile;
use actix_web::*;
use lemmy_utils::settings::Settings;
pub fn config(cfg: &mut web::ServiceConfig) {
cfg
.route("/", web::get().to(index))
.route(
"/home/data_type/{data_type}/listing_type/{listing_type}/sort/{sort}/page/{page}",
web::get().to(index),
)
.route("/login", web::get().to(index))
.route("/create_post", web::get().to(index))
.route("/create_community", web::get().to(index))
.route("/create_private_message", web::get().to(index))
.route("/communities/page/{page}", web::get().to(index))
.route("/communities", web::get().to(index))
.route("/post/{id}/comment/{id2}", web::get().to(index))
.route("/post/{id}", web::get().to(index))
.route(
"/c/{name}/data_type/{data_type}/sort/{sort}/page/{page}",
web::get().to(index),
)
.route("/c/{name}", web::get().to(index))
.route("/community/{id}", web::get().to(index))
.route(
"/u/{username}/view/{view}/sort/{sort}/page/{page}",
web::get().to(index),
)
.route("/u/{username}", web::get().to(index))
.route("/user/{id}", web::get().to(index))
.route("/inbox", web::get().to(index))
.route("/modlog/community/{community_id}", web::get().to(index))
.route("/modlog", web::get().to(index))
.route("/setup", web::get().to(index))
.route("/admin", web::get().to(index))
.route("/sitemod", web::get().to(index))
.route(
"/search/q/{q}/type/{type}/sort/{sort}/page/{page}",
web::get().to(index),
)
.route("/search", web::get().to(index))
.route("/sponsors", web::get().to(index))
.route("/contributing", web::get().to(index))
.route("/welcome", web::get().to(index))
.route("/about", web::get().to(index))
.route("/ppb", web::get().to(index))
.route("/reports", web::get().to(index))
.route("/privacy_policy", web::get().to(index))
.route("/tos", web::get().to(index))
.route("/password_change/{token}", web::get().to(index))
.route("/instances", web::get().to(index));
}
async fn index() -> Result<NamedFile, Error> {
Ok(NamedFile::open(
Settings::get().front_end_dir + "/index.html",
)?)
}

1
server/src/routes/mod.rs

@ -2,7 +2,6 @@ pub mod api;
pub mod federation;
pub mod feeds;
pub mod images;
pub mod index;
pub mod nodeinfo;
pub mod webfinger;
pub mod websocket;
Loading…
Cancel
Save