mirror of https://github.com/LemmyNet/lemmy.git
Adding docker.
- Adding docker support. Fixes #6 - Completing the name change to lemmy. Fixes #36 - Running DB migrations from code. Fixes #38pull/722/head
parent
751cf26be6
commit
e826f631d8
|
@ -0,0 +1,4 @@
|
||||||
|
ui/node_modules
|
||||||
|
ui/dist
|
||||||
|
server/target
|
||||||
|
.git
|
26
API.md
26
API.md
|
@ -48,18 +48,18 @@
|
||||||
{
|
{
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
"type": "Person",
|
"type": "Person",
|
||||||
"id": "https://rust-reddit-fediverse/api/v1/user/sally_smith",
|
"id": "https://instance_url/api/v1/user/sally_smith",
|
||||||
"inbox": "https://rust-reddit-fediverse/api/v1/user/sally_smith/inbox",
|
"inbox": "https://instance_url/api/v1/user/sally_smith/inbox",
|
||||||
"outbox": "https://rust-reddit-fediverse/api/v1/user/sally_smith/outbox",
|
"outbox": "https://instance_url/api/v1/user/sally_smith/outbox",
|
||||||
"liked": "https://rust-reddit-fediverse/api/v1/user/sally_smith/liked",
|
"liked": "https://instance_url/api/v1/user/sally_smith/liked",
|
||||||
// TODO disliked?
|
// TODO disliked?
|
||||||
"following": "https://rust-reddit-fediverse/api/v1/user/sally_smith/following",
|
"following": "https://instance_url/api/v1/user/sally_smith/following",
|
||||||
"name": "sally_smith",
|
"name": "sally_smith",
|
||||||
"preferredUsername": "Sally",
|
"preferredUsername": "Sally",
|
||||||
"icon"?: {
|
"icon"?: {
|
||||||
"type": "Image",
|
"type": "Image",
|
||||||
"name": "User icon",
|
"name": "User icon",
|
||||||
"url": "https://rust-reddit-fediverse/api/v1/user/sally_smith/icon.png",
|
"url": "https://instance_url/api/v1/user/sally_smith/icon.png",
|
||||||
"width": 32,
|
"width": 32,
|
||||||
"height": 32
|
"height": 32
|
||||||
},
|
},
|
||||||
|
@ -73,12 +73,12 @@
|
||||||
{
|
{
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
"type": "Group",
|
"type": "Group",
|
||||||
"id": "https://rust-reddit-fediverse/api/v1/community/today_i_learned",
|
"id": "https://instance_url/api/v1/community/today_i_learned",
|
||||||
"name": "today_i_learned"
|
"name": "today_i_learned"
|
||||||
"attributedTo": [ // The moderators
|
"attributedTo": [ // The moderators
|
||||||
"http://joe.example.org",
|
"http://joe.example.org",
|
||||||
],
|
],
|
||||||
"followers": "https://rust-reddit-fediverse/api/v1/community/today_i_learned/followers",
|
"followers": "https://instance_url/api/v1/community/today_i_learned/followers",
|
||||||
"published": "2014-12-31T23:00:00-08:00",
|
"published": "2014-12-31T23:00:00-08:00",
|
||||||
"summary"?: "The group's tagline",
|
"summary"?: "The group's tagline",
|
||||||
"attachment: [{}] // TBD, these would be where strong types for custom styles, and images would work.
|
"attachment: [{}] // TBD, these would be where strong types for custom styles, and images would work.
|
||||||
|
@ -92,7 +92,7 @@
|
||||||
{
|
{
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
"type": "Page",
|
"type": "Page",
|
||||||
"id": "https://rust-reddit-fediverse/api/v1/post/1",
|
"id": "https://instance_url/api/v1/post/1",
|
||||||
"name": "The title of a post, maybe a link to imgur",
|
"name": "The title of a post, maybe a link to imgur",
|
||||||
"url": "https://news.blah.com"
|
"url": "https://news.blah.com"
|
||||||
"attributedTo": "http://joe.example.org", // The poster
|
"attributedTo": "http://joe.example.org", // The poster
|
||||||
|
@ -105,7 +105,7 @@
|
||||||
{
|
{
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
"type": "OrderedCollectionPage",
|
"type": "OrderedCollectionPage",
|
||||||
"id": "https://rust-reddit-fediverse/api/v1/posts?type={all, best, front}&sort={}&page=1,
|
"id": "https://instance_url/api/v1/posts?type={all, best, front}&sort={}&page=1,
|
||||||
"partOf": "http://example.org/foo",
|
"partOf": "http://example.org/foo",
|
||||||
"orderedItems": [Posts]
|
"orderedItems": [Posts]
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@
|
||||||
{
|
{
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
"type": "Note",
|
"type": "Note",
|
||||||
"id": "https://rust-reddit-fediverse/api/v1/comment/1",
|
"id": "https://instance_url/api/v1/comment/1",
|
||||||
"mediaType": "text/markdown",
|
"mediaType": "text/markdown",
|
||||||
"content": "Looks like it is going to rain today. Bring an umbrella *if necessary*!"
|
"content": "Looks like it is going to rain today. Bring an umbrella *if necessary*!"
|
||||||
"attributedTo": john_id,
|
"attributedTo": john_id,
|
||||||
|
@ -132,7 +132,7 @@
|
||||||
{
|
{
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
"type": "OrderedCollectionPage",
|
"type": "OrderedCollectionPage",
|
||||||
"id": "https://rust-reddit-fediverse/api/v1/comments?type={all,user,community,post,parent_comment}&id=1&page=1,
|
"id": "https://instance_url/api/v1/comments?type={all,user,community,post,parent_comment}&id=1&page=1,
|
||||||
"partOf": "http://example.org/foo",
|
"partOf": "http://example.org/foo",
|
||||||
"orderedItems": [Comments]
|
"orderedItems": [Comments]
|
||||||
}
|
}
|
||||||
|
@ -351,7 +351,7 @@
|
||||||
{
|
{
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
"@context": "https://www.w3.org/ns/activitystreams",
|
||||||
"type": "Invite",
|
"type": "Invite",
|
||||||
"id": "https://rust-reddit-fediverse/api/v1/invite/1",
|
"id": "https://instance_url/api/v1/invite/1",
|
||||||
"actor": sally_id,
|
"actor": sally_id,
|
||||||
"object": group_id,
|
"object": group_id,
|
||||||
"target": john_id
|
"target": john_id
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
FROM node:10-jessie as node
|
||||||
|
#If encounter Invalid cross-device error -run on host 'echo N | sudo tee /sys/module/overlay/parameters/metacopy'
|
||||||
|
COPY ui /app/ui
|
||||||
|
RUN cd /app/ui && yarn && yarn build
|
||||||
|
|
||||||
|
FROM rust:1.33 as rust
|
||||||
|
COPY server /app/server
|
||||||
|
COPY --from=node /app/ui/dist /app/dist
|
||||||
|
RUN cd /app/server && cargo build --release
|
||||||
|
RUN mv /app/server/target/release/lemmy /app/
|
||||||
|
EXPOSE 8080
|
||||||
|
WORKDIR /app/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Rust Reddit Fediverse (to be renamed later)
|
# Lemmy
|
||||||
|
|
||||||
We have a twitter alternative (mastodon), a facebook alternative (friendica), so let's build a reddit alternative in the fediverse.
|
We have a twitter alternative (mastodon), a facebook alternative (friendica), so let's build a reddit alternative in the fediverse.
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: postgres
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: rrr
|
||||||
|
POSTGRES_PASSWORD: rrr
|
||||||
|
POSTGRES_DB: rrr
|
||||||
|
lemmy:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
command: /bin/sh -c /app/lemmy
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
environment:
|
||||||
|
LEMMY_FRONT_END_DIR: /app/dist
|
||||||
|
DATABASE_URL: postgres://rrr:rrr@db:5432/rrr
|
||||||
|
|
||||||
|
links:
|
||||||
|
- db
|
|
@ -420,7 +420,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "diesel"
|
name = "diesel"
|
||||||
version = "1.4.1"
|
version = "1.4.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -440,6 +440,15 @@ dependencies = [
|
||||||
"syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
"syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "diesel_migrations"
|
||||||
|
version = "1.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"migrations_internals 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"migrations_macros 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dotenv"
|
name = "dotenv"
|
||||||
version = "0.9.0"
|
version = "0.9.0"
|
||||||
|
@ -793,6 +802,24 @@ name = "memoffset"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "migrations_internals"
|
||||||
|
version = "1.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"diesel 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "migrations_macros"
|
||||||
|
version = "1.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"migrations_internals 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mime"
|
name = "mime"
|
||||||
version = "0.3.13"
|
version = "0.3.13"
|
||||||
|
@ -1027,6 +1054,11 @@ name = "quick-error"
|
||||||
version = "1.2.2"
|
version = "1.2.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quote"
|
||||||
|
version = "0.3.15"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "0.5.2"
|
version = "0.5.2"
|
||||||
|
@ -1321,7 +1353,8 @@ dependencies = [
|
||||||
"actix-web 0.7.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
"actix-web 0.7.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"bcrypt 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bcrypt 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"diesel 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"diesel 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"diesel_migrations 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"dotenv 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"dotenv 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1400,6 +1433,16 @@ dependencies = [
|
||||||
"syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
"syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "0.11.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "0.13.11"
|
version = "0.13.11"
|
||||||
|
@ -1420,6 +1463,14 @@ dependencies = [
|
||||||
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "synom"
|
||||||
|
version = "0.11.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "synstructure"
|
name = "synstructure"
|
||||||
version = "0.10.1"
|
version = "0.10.1"
|
||||||
|
@ -1771,6 +1822,11 @@ name = "unicode-segmentation"
|
||||||
version = "1.2.1"
|
version = "1.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-xid"
|
||||||
|
version = "0.0.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-xid"
|
name = "unicode-xid"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
@ -1961,8 +2017,9 @@ dependencies = [
|
||||||
"checksum crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "04c9e3102cc2d69cd681412141b390abd55a362afc1540965dad0ad4d34280b4"
|
"checksum crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "04c9e3102cc2d69cd681412141b390abd55a362afc1540965dad0ad4d34280b4"
|
||||||
"checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b"
|
"checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b"
|
||||||
"checksum crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f8306fcef4a7b563b76b7dd949ca48f52bc1141aa067d2ea09565f3e2652aa5c"
|
"checksum crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f8306fcef4a7b563b76b7dd949ca48f52bc1141aa067d2ea09565f3e2652aa5c"
|
||||||
"checksum diesel 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a2469cbcf1dfb9446e491cac4c493c2554133f87f7d041e892ac82e5cd36e863"
|
"checksum diesel 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8d24935ba50c4a8dc375a0fd1f8a2ba6bdbdc4125713126a74b965d6a01a06d7"
|
||||||
"checksum diesel_derives 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "62a27666098617d52c487a41f70de23d44a1dc1f3aa5877ceba2790fb1f1cab4"
|
"checksum diesel_derives 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "62a27666098617d52c487a41f70de23d44a1dc1f3aa5877ceba2790fb1f1cab4"
|
||||||
|
"checksum diesel_migrations 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3cde8413353dc7f5d72fa8ce0b99a560a359d2c5ef1e5817ca731cd9008f4c"
|
||||||
"checksum dotenv 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "400b347fe65ccfbd8f545c9d9a75d04b0caf23fec49aaa838a9a05398f94c019"
|
"checksum dotenv 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "400b347fe65ccfbd8f545c9d9a75d04b0caf23fec49aaa838a9a05398f94c019"
|
||||||
"checksum dtoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6d301140eb411af13d3115f9a562c85cc6b541ade9dfa314132244aaee7489dd"
|
"checksum dtoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6d301140eb411af13d3115f9a562c85cc6b541ade9dfa314132244aaee7489dd"
|
||||||
"checksum encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec"
|
"checksum encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec"
|
||||||
|
@ -2008,6 +2065,8 @@ dependencies = [
|
||||||
"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
|
"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
|
||||||
"checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39"
|
"checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39"
|
||||||
"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3"
|
"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3"
|
||||||
|
"checksum migrations_internals 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8089920229070f914b9ce9b07ef60e175b2b9bc2d35c3edd8bf4433604e863b9"
|
||||||
|
"checksum migrations_macros 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1664412abf7db2b8a6d58be42a38b099780cc542b5b350383b805d88932833fe"
|
||||||
"checksum mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "3e27ca21f40a310bd06d9031785f4801710d566c184a6e15bad4f1d9b65f9425"
|
"checksum mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "3e27ca21f40a310bd06d9031785f4801710d566c184a6e15bad4f1d9b65f9425"
|
||||||
"checksum mime_guess 2.0.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)" = "30de2e4613efcba1ec63d8133f344076952090c122992a903359be5a4f99c3ed"
|
"checksum mime_guess 2.0.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)" = "30de2e4613efcba1ec63d8133f344076952090c122992a903359be5a4f99c3ed"
|
||||||
"checksum miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0300eafb20369952951699b68243ab4334f4b10a88f411c221d444b36c40e649"
|
"checksum miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0300eafb20369952951699b68243ab4334f4b10a88f411c221d444b36c40e649"
|
||||||
|
@ -2035,6 +2094,7 @@ dependencies = [
|
||||||
"checksum proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1b06e2f335f48d24442b35a19df506a835fb3547bc3c06ef27340da9acf5cae7"
|
"checksum proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1b06e2f335f48d24442b35a19df506a835fb3547bc3c06ef27340da9acf5cae7"
|
||||||
"checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915"
|
"checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915"
|
||||||
"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
|
"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
|
||||||
|
"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
|
||||||
"checksum quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9949cfe66888ffe1d53e6ec9d9f3b70714083854be20fd5e271b232a017401e8"
|
"checksum quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9949cfe66888ffe1d53e6ec9d9f3b70714083854be20fd5e271b232a017401e8"
|
||||||
"checksum quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd8e04bd9c52e0342b406469d494fcb033be4bdbe5c606016defbb1681411e1"
|
"checksum quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd8e04bd9c52e0342b406469d494fcb033be4bdbe5c606016defbb1681411e1"
|
||||||
"checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9"
|
"checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9"
|
||||||
|
@ -2078,8 +2138,10 @@ dependencies = [
|
||||||
"checksum string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b639411d0b9c738748b5397d5ceba08e648f4f1992231aa859af1a017f31f60b"
|
"checksum string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b639411d0b9c738748b5397d5ceba08e648f4f1992231aa859af1a017f31f60b"
|
||||||
"checksum strum 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1810e25f576e7ffce1ff5243b37066da5ded0310b3274c20baaeccb1145b2806"
|
"checksum strum 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1810e25f576e7ffce1ff5243b37066da5ded0310b3274c20baaeccb1145b2806"
|
||||||
"checksum strum_macros 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "572a2f4e53dd4c3483fd79e5cc10ddd773a3acb1169bbfe8762365e107110579"
|
"checksum strum_macros 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "572a2f4e53dd4c3483fd79e5cc10ddd773a3acb1169bbfe8762365e107110579"
|
||||||
|
"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
|
||||||
"checksum syn 0.13.11 (registry+https://github.com/rust-lang/crates.io-index)" = "14f9bf6292f3a61d2c716723fdb789a41bbe104168e6f496dc6497e531ea1b9b"
|
"checksum syn 0.13.11 (registry+https://github.com/rust-lang/crates.io-index)" = "14f9bf6292f3a61d2c716723fdb789a41bbe104168e6f496dc6497e531ea1b9b"
|
||||||
"checksum syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)" = "f92e629aa1d9c827b2bb8297046c1ccffc57c99b947a680d3ccff1f136a3bee9"
|
"checksum syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)" = "f92e629aa1d9c827b2bb8297046c1ccffc57c99b947a680d3ccff1f136a3bee9"
|
||||||
|
"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"
|
||||||
"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015"
|
"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015"
|
||||||
"checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f"
|
"checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f"
|
||||||
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
|
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
|
||||||
|
@ -2110,6 +2172,7 @@ dependencies = [
|
||||||
"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
|
"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
|
||||||
"checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426"
|
"checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426"
|
||||||
"checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1"
|
"checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1"
|
||||||
|
"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
|
||||||
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
||||||
"checksum untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "55cd1f4b4e96b46aeb8d4855db4a7a9bd96eeeb5c6a1ab54593328761642ce2f"
|
"checksum untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "55cd1f4b4e96b46aeb8d4855db4a7a9bd96eeeb5c6a1ab54593328761642ce2f"
|
||||||
"checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a"
|
"checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a"
|
||||||
|
|
|
@ -3,8 +3,13 @@ name = "server"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
authors = ["Dessalines <happydooby@gmail.com>"]
|
authors = ["Dessalines <happydooby@gmail.com>"]
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "lemmy"
|
||||||
|
path = "src/bin/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
diesel = { version = "1.4.1", features = ["postgres","chrono"] }
|
diesel = { version = "1.4.2", features = ["postgres","chrono"] }
|
||||||
|
diesel_migrations = "*"
|
||||||
dotenv = "0.9.0"
|
dotenv = "0.9.0"
|
||||||
bcrypt = "0.3"
|
bcrypt = "0.3"
|
||||||
activitypub = "0.1.4"
|
activitypub = "0.1.4"
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
extern crate server;
|
extern crate server;
|
||||||
|
#[macro_use] extern crate diesel_migrations;
|
||||||
|
|
||||||
use std::time::{Instant, Duration};
|
use std::time::{Instant, Duration};
|
||||||
|
use std::env;
|
||||||
use server::actix::*;
|
use server::actix::*;
|
||||||
use server::actix_web::server::HttpServer;
|
use server::actix_web::server::HttpServer;
|
||||||
use server::actix_web::{ws, App, Error, HttpRequest, HttpResponse};
|
use server::actix_web::{ws, App, Error, HttpRequest, HttpResponse, fs::NamedFile, fs};
|
||||||
|
|
||||||
use server::websocket_server::server::*;
|
use server::websocket_server::server::*;
|
||||||
|
use server::establish_connection;
|
||||||
|
|
||||||
|
embed_migrations!();
|
||||||
|
|
||||||
/// How often heartbeat pings are sent
|
/// How often heartbeat pings are sent
|
||||||
const HEARTBEAT_INTERVAL: Duration = Duration::from_secs(5);
|
const HEARTBEAT_INTERVAL: Duration = Duration::from_secs(5);
|
||||||
|
@ -225,7 +230,11 @@ impl WSSession {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _ = env_logger::init();
|
let _ = env_logger::init();
|
||||||
let sys = actix::System::new("rust-reddit-fediverse-server");
|
let sys = actix::System::new("lemmy");
|
||||||
|
|
||||||
|
// Run the migrations from code
|
||||||
|
let conn = establish_connection();
|
||||||
|
embedded_migrations::run(&conn).unwrap();
|
||||||
|
|
||||||
// Start chat server actor in separate thread
|
// Start chat server actor in separate thread
|
||||||
let server = Arbiter::start(|_| ChatServer::default());
|
let server = Arbiter::start(|_| ChatServer::default());
|
||||||
|
@ -244,14 +253,26 @@ fn main() {
|
||||||
// .header("LOCATION", "/static/websocket.html")
|
// .header("LOCATION", "/static/websocket.html")
|
||||||
// .finish()
|
// .finish()
|
||||||
// }))
|
// }))
|
||||||
// // websocket
|
|
||||||
.resource("/service/ws", |r| r.route().f(chat_route))
|
.resource("/service/ws", |r| r.route().f(chat_route))
|
||||||
// static resources
|
// static resources
|
||||||
// .handler("/static/", fs::StaticFiles::new("static/").unwrap())
|
.resource("/", |r| r.route().f(index))
|
||||||
}).bind("127.0.0.1:8080")
|
.handler(
|
||||||
|
"/static",
|
||||||
|
fs::StaticFiles::new(front_end_dir()).unwrap()
|
||||||
|
)
|
||||||
|
.finish()
|
||||||
|
}).bind("0.0.0.0:8080")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.start();
|
.start();
|
||||||
|
|
||||||
println!("Started http server: 127.0.0.1:8080");
|
println!("Started http server: 0.0.0.0:8080");
|
||||||
let _ = sys.run();
|
let _ = sys.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn index(_req: &HttpRequest<WsChatSessionState>) -> Result<NamedFile, actix_web::error::Error> {
|
||||||
|
Ok(NamedFile::open(front_end_dir() + "/index.html")?)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn front_end_dir() -> String {
|
||||||
|
env::var("LEMMY_FRONT_END_DIR").unwrap_or("../ui/dist".to_string())
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "rust_reddit_fediverse",
|
"name": "lemmy",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "A simple UI for rust_reddit_fediverse",
|
"description": "A simple UI for lemmy",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node fuse dev",
|
"start": "node fuse dev",
|
||||||
|
|
|
@ -27,7 +27,7 @@ export class Navbar extends Component<any, any> {
|
||||||
navbar() {
|
navbar() {
|
||||||
return (
|
return (
|
||||||
<nav class="navbar navbar-expand-sm navbar-light bg-light p-0 px-3 shadow">
|
<nav class="navbar navbar-expand-sm navbar-light bg-light p-0 px-3 shadow">
|
||||||
<a class="navbar-brand" href="#">rrf</a>
|
<a class="navbar-brand" href="#">Lemmy</a>
|
||||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
<span class="navbar-toggler-icon"></span>
|
<span class="navbar-toggler-icon"></span>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
// export const endpoint = window.location.origin;
|
export const endpoint = `${window.location.hostname}:8080`;
|
||||||
export const endpoint = "http://localhost:8080";
|
export let wsUri = (window.location.protocol=='https:') ? 'wss://' : 'ws://' + endpoint + '/service/ws';
|
||||||
export let wsUri = (window.location.protocol=='https:') ? 'wss://' : 'ws://' + endpoint.substr(7) + '/service/ws';
|
|
||||||
|
|
|
@ -6,11 +6,10 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
<link rel="shortcut icon" type="image/ico" href="/static/assets/favicon.ico" />
|
<link rel="shortcut icon" type="image/ico" href="/static/assets/favicon.ico" />
|
||||||
|
|
||||||
<title>rust-reddit-fediverse</title>
|
<title>Lemmy</title>
|
||||||
<link rel="stylesheet" href="https://bootswatch.com/4/darkly/bootstrap.min.css">
|
<link rel="stylesheet" href="https://bootswatch.com/4/darkly/bootstrap.min.css">
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/balloon-css/0.5.0/balloon.min.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/balloon-css/0.5.0/balloon.min.css">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,400i,700,800" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,400i,700,800" rel="stylesheet">
|
||||||
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/sortable/0.8.0/css/sortable-theme-minimal.min.css" /> -->
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/sortable/0.8.0/js/sortable.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/sortable/0.8.0/js/sortable.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { UserOperation, Comment } from './interfaces';
|
import { UserOperation, Comment } from './interfaces';
|
||||||
import * as markdown_it from 'markdown-it';
|
import * as markdown_it from 'markdown-it';
|
||||||
|
|
||||||
export let repoUrl = 'https://github.com/dessalines/rust-reddit-fediverse';
|
export let repoUrl = 'https://github.com/dessalines/lemmy';
|
||||||
export let wsUri = (window.location.protocol=='https:'&&'wss://'||'ws://')+window.location.host + '/service/ws/';
|
export let wsUri = (window.location.protocol=='https:'&&'wss://'||'ws://')+window.location.host + '/service/ws/';
|
||||||
|
|
||||||
export function msgOp(msg: any): UserOperation {
|
export function msgOp(msg: any): UserOperation {
|
||||||
|
|
Loading…
Reference in New Issue