Use compose, disable major parts of application.
This commit is contained in:
18
docker-compose.yml
Normal file
18
docker-compose.yml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
version: '2'
|
||||||
|
|
||||||
|
services:
|
||||||
|
database:
|
||||||
|
image: mongo
|
||||||
|
restart: always
|
||||||
|
web:
|
||||||
|
build: .
|
||||||
|
environment:
|
||||||
|
- REVOLT_MONGO_URI=mongodb://localhost
|
||||||
|
- REVOLT_PUBLIC_URL=https://local.revolt.chat
|
||||||
|
- REVOLT_USE_EMAIL_VERIFICATION=0
|
||||||
|
- REVOLT_UNSAFE_NO_EMAIL=1
|
||||||
|
- REVOLT_UNSAFE_NO_CAPTCHA=1
|
||||||
|
ports:
|
||||||
|
- "8000:8000"
|
||||||
|
- "9999:9999"
|
||||||
|
restart: unless-stopped
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
docker logs -f revolt
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
echo "Removing Revolt container."
|
|
||||||
docker kill revolt
|
|
||||||
docker rm revolt
|
|
||||||
22
run.sh
22
run.sh
@@ -1,22 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# Split at \n instead of space.
|
|
||||||
# https://unix.stackexchange.com/a/39482
|
|
||||||
set -f
|
|
||||||
IFS='
|
|
||||||
'
|
|
||||||
|
|
||||||
input=($(egrep -v '^#' .env))
|
|
||||||
prepended=(${input[@]/#/-e\"})
|
|
||||||
variables=${prepended[@]/%/\"}
|
|
||||||
|
|
||||||
unset IFS
|
|
||||||
set +f
|
|
||||||
|
|
||||||
echo "Running Revolt in detached mode."
|
|
||||||
docker run \
|
|
||||||
-d \
|
|
||||||
--name revolt \
|
|
||||||
-p 8000:8000 \
|
|
||||||
-p 9000:9000 \
|
|
||||||
$variables \
|
|
||||||
revolt
|
|
||||||
@@ -28,11 +28,11 @@ pub fn get_collection(collection: &str) -> Collection {
|
|||||||
|
|
||||||
pub mod migrations;
|
pub mod migrations;
|
||||||
|
|
||||||
pub mod channel;
|
// pub mod channel;
|
||||||
pub mod guild;
|
// pub mod guild;
|
||||||
pub mod message;
|
// pub mod message;
|
||||||
pub mod mutual;
|
// pub mod mutual;
|
||||||
pub mod permissions;
|
// pub mod permissions;
|
||||||
pub mod user;
|
// pub mod user;
|
||||||
|
|
||||||
pub use permissions::*;
|
// pub use permissions::*;
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
pub use rocket::http::Status;
|
pub use rocket::http::Status;
|
||||||
pub use rocket::response::Redirect;
|
pub use rocket::response::Redirect;
|
||||||
use rocket::Rocket;
|
use rocket::Rocket;
|
||||||
use rocket_contrib::json::JsonValue;
|
|
||||||
|
|
||||||
use crate::database::Permission;
|
// use crate::database::Permission;
|
||||||
|
// use rocket_contrib::json::JsonValue;
|
||||||
|
|
||||||
pub mod account;
|
/* pub mod channel;
|
||||||
pub mod channel;
|
|
||||||
pub mod guild;
|
pub mod guild;
|
||||||
|
pub mod user; */
|
||||||
pub mod root;
|
pub mod root;
|
||||||
pub mod user;
|
|
||||||
|
|
||||||
#[derive(Responder)]
|
/* #[derive(Responder)]
|
||||||
pub enum Response {
|
pub enum Response {
|
||||||
#[response()]
|
#[response()]
|
||||||
Result(Status),
|
Result(Status),
|
||||||
@@ -63,22 +62,12 @@ impl<'a> Responder<'a, 'static> for Permission {
|
|||||||
.sized_body(body.len(), Cursor::new(body))
|
.sized_body(body.len(), Cursor::new(body))
|
||||||
.ok()
|
.ok()
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
|
|
||||||
pub fn mount(rocket: Rocket) -> Rocket {
|
pub fn mount(rocket: Rocket) -> Rocket {
|
||||||
rocket
|
rocket
|
||||||
.mount("/", routes![root::root, root::teapot])
|
.mount("/", routes![root::root, root::teapot])
|
||||||
.mount(
|
/*.mount(
|
||||||
"/account",
|
|
||||||
routes![
|
|
||||||
account::create,
|
|
||||||
account::verify_email,
|
|
||||||
account::resend_email,
|
|
||||||
account::login,
|
|
||||||
account::token,
|
|
||||||
],
|
|
||||||
)
|
|
||||||
.mount(
|
|
||||||
"/users",
|
"/users",
|
||||||
routes![
|
routes![
|
||||||
user::me,
|
user::me,
|
||||||
@@ -128,5 +117,5 @@ pub fn mount(rocket: Rocket) -> Rocket {
|
|||||||
guild::ban_member,
|
guild::ban_member,
|
||||||
guild::unban_member,
|
guild::unban_member,
|
||||||
],
|
],
|
||||||
)
|
)*/
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
use super::Response;
|
|
||||||
use crate::util::variables::{DISABLE_REGISTRATION, HCAPTCHA_SITEKEY, USE_EMAIL, USE_HCAPTCHA};
|
use crate::util::variables::{DISABLE_REGISTRATION, HCAPTCHA_SITEKEY, USE_EMAIL, USE_HCAPTCHA};
|
||||||
|
|
||||||
|
use rocket_contrib::json::JsonValue;
|
||||||
use mongodb::bson::doc;
|
use mongodb::bson::doc;
|
||||||
|
|
||||||
/// root
|
/// root
|
||||||
#[get("/")]
|
#[get("/")]
|
||||||
pub async fn root() -> Response {
|
pub async fn root() -> JsonValue {
|
||||||
Response::Success(json!({
|
json!({
|
||||||
"revolt": "0.3.0-alpha",
|
"revolt": "0.3.0-alpha",
|
||||||
"features": {
|
"features": {
|
||||||
"registration": !*DISABLE_REGISTRATION,
|
"registration": !*DISABLE_REGISTRATION,
|
||||||
@@ -16,14 +16,14 @@ pub async fn root() -> Response {
|
|||||||
},
|
},
|
||||||
"email": *USE_EMAIL,
|
"email": *USE_EMAIL,
|
||||||
}
|
}
|
||||||
}))
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// I'm a teapot.
|
/// I'm a teapot.
|
||||||
#[delete("/")]
|
#[delete("/")]
|
||||||
pub async fn teapot() -> Response {
|
pub async fn teapot() -> JsonValue {
|
||||||
Response::Teapot(json!({
|
json!({
|
||||||
"teapot": true,
|
"teapot": true,
|
||||||
"can_delete": false
|
"can_delete": false
|
||||||
}))
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user