Moved backend into backend folder
|
|
@ -0,0 +1,2 @@
|
|||
[build]
|
||||
rustflags = ["-C", "link-arg=-fuse-ld=lld"]
|
||||
|
|
@ -1,13 +1,7 @@
|
|||
# [Choice] Debian OS version (use bullseye on local arm64/Apple Silicon): buster, bullseye
|
||||
ARG VARIANT="bullseye"
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/rust:0-${VARIANT}
|
||||
FROM mcr.microsoft.com/devcontainers/rust:1-1-bookworm
|
||||
|
||||
# Include lld linker to improve build times either by using environment variable
|
||||
# RUSTFLAGS="-C link-arg=-fuse-ld=lld" or with Cargo's configuration file (i.e see .cargo/config.toml).
|
||||
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
&& apt-get -y install clang lld \
|
||||
&& apt-get autoremove -y && apt-get clean -y
|
||||
|
||||
# Add tools for wasm development
|
||||
RUN rustup target add wasm32-unknown-unknown \
|
||||
&& cargo install trunk cargo-edit cargo-watch
|
||||
|
|
@ -1,35 +1,18 @@
|
|||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
|
||||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/rust-postgres
|
||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||
// README at: https://github.com/devcontainers/templates/tree/main/src/rust-postgres
|
||||
{
|
||||
"name": "Rust and PostgreSQL",
|
||||
"dockerComposeFile": "docker-compose.yml",
|
||||
"service": "app",
|
||||
"workspaceFolder": "/workspace",
|
||||
|
||||
// Configure tool-specific properties.
|
||||
"customizations": {
|
||||
// Configure properties specific to VS Code.
|
||||
"vscode": {
|
||||
// Set *default* container specific settings.json values on container create.
|
||||
"settings": {
|
||||
"lldb.executable": "/usr/bin/lldb",
|
||||
// VS Code don't watch files under ./target
|
||||
"files.watcherExclude": {
|
||||
"**/target/**": true
|
||||
},
|
||||
"rust-analyzer.checkOnSave.command": "clippy"
|
||||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/node:1": {},
|
||||
"ghcr.io/lee-orr/rusty-dev-containers/cargo-watch:0": {},
|
||||
"ghcr.io/lumenpink/devcontainer-features/wasm-pack:0": {}
|
||||
},
|
||||
|
||||
// Add the IDs of extensions you want installed when the container is created.
|
||||
"extensions": [
|
||||
"vadimcn.vscode-lldb",
|
||||
"mutantdino.resourcemonitor",
|
||||
"rust-lang.rust-analyzer",
|
||||
"tamasfe.even-better-toml",
|
||||
"serayuzgur.crates"
|
||||
]
|
||||
}
|
||||
},
|
||||
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||
// "features": {},
|
||||
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// "forwardPorts": [5432],
|
||||
|
|
@ -37,9 +20,9 @@
|
|||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
// "postCreateCommand": "rustc --version",
|
||||
|
||||
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
||||
"remoteUser": "vscode",
|
||||
"features": {
|
||||
"docker-in-docker": "latest"
|
||||
}
|
||||
// Configure tool-specific properties.
|
||||
// "customizations": {},
|
||||
|
||||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||
"remoteUser": "root"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,22 +8,12 @@ services:
|
|||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
# Use the VARIANT arg to pick a Debian OS version: buster, bullseye
|
||||
# Use bullseye when on local on arm64/Apple Silicon.
|
||||
VARIANT: bullseye
|
||||
env_file:
|
||||
# Ensure that the variables in .env match the same variables in devcontainer.json
|
||||
- .env
|
||||
# Security Opt and cap_add for C++ based debuggers to work.
|
||||
# See `runArgs`: https://github.com/Microsoft/vscode-docs/blob/main/docs/remote/devcontainerjson-reference.md
|
||||
# security_opt:
|
||||
# - seccomp:unconfined
|
||||
# cap_add:
|
||||
# - SYS_PTRACE
|
||||
|
||||
volumes:
|
||||
- ..:/workspace:cached
|
||||
- ../..:/workspaces:cached
|
||||
|
||||
# Overrides default command so things don't shut down after the process ends.
|
||||
command: sleep infinity
|
||||
|
|
@ -31,9 +21,6 @@ services:
|
|||
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
|
||||
network_mode: service:db
|
||||
|
||||
# Uncomment the next line to use a non-root user for all processes.
|
||||
# user: vscode
|
||||
|
||||
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
|
||||
# (Adding the "ports" property to this file will not forward from a Codespace.)
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
/target
|
||||
backend/target
|
||||
|
|
|
|||
18
Dockerfile
|
|
@ -1,18 +0,0 @@
|
|||
FROM rust:1.59 as builder
|
||||
|
||||
RUN USER=root cargo new --bin jean-marie
|
||||
WORKDIR /jean-marie
|
||||
COPY ./Cargo.toml ./Cargo.toml
|
||||
RUN cargo build --release
|
||||
RUN rm src/*.rs
|
||||
|
||||
ADD . ./
|
||||
|
||||
RUN rm ./target/release/deps/jean_marie*
|
||||
RUN cargo build --release
|
||||
|
||||
FROM debian:buster-slim
|
||||
COPY --from=builder /jean-marie/target/release/jean-marie .
|
||||
RUN mkdir -p /templates
|
||||
CMD ["./jean-marie"]
|
||||
|
||||
|
|
@ -45,6 +45,13 @@ struct LoginTemplate {
|
|||
name: String,
|
||||
}
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "dashboard.html")]
|
||||
struct DashboardTemplate {
|
||||
logged_in: bool,
|
||||
name: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
struct User {
|
||||
id: String,
|
||||
|
|
@ -78,17 +85,10 @@ async fn main() {
|
|||
|
||||
// build our application with some routes
|
||||
let app = Router::new()
|
||||
.route("/assets", get_service(ServeDir::new("templates/assets"))
|
||||
// .handle_error(
|
||||
// |error: std::io::Error| async move {
|
||||
// (
|
||||
// StatusCode::INTERNAL_SERVER_ERROR,
|
||||
// format!("Unhandled internal error: {}", error),
|
||||
// )
|
||||
// },
|
||||
// ),
|
||||
)
|
||||
.nest_service("/assets", ServeDir::new("templates/assets")
|
||||
.fallback(get_service(ServeDir::new("templates/assets"))))
|
||||
.route("/", get(index))
|
||||
.route("/dashboard", get(dashboard))
|
||||
.route("/login", get(login))
|
||||
.route("/google_auth", get(google_auth))
|
||||
.route("/auth/google", get(google_authorized))
|
||||
|
|
@ -125,3 +125,16 @@ async fn login(session: Session<SessionAnyPool>) -> impl IntoResponse {
|
|||
let template = LoginTemplate { logged_in, name };
|
||||
HtmlTemplate(template)
|
||||
}
|
||||
|
||||
async fn dashboard(session: Session<SessionAnyPool>) -> impl IntoResponse {
|
||||
let logged_in = session.get("logged_in").unwrap_or(false);
|
||||
let name = session.get("name").unwrap_or("".to_string());
|
||||
|
||||
session.set_store(true);
|
||||
|
||||
session.set("logged_in", logged_in);
|
||||
session.set("name", &name);
|
||||
|
||||
let template = DashboardTemplate { logged_in, name };
|
||||
HtmlTemplate(template)
|
||||
}
|
||||
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 306 KiB After Width: | Height: | Size: 306 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 573 KiB After Width: | Height: | Size: 573 KiB |
|
Before Width: | Height: | Size: 343 KiB After Width: | Height: | Size: 343 KiB |
|
Before Width: | Height: | Size: 838 KiB After Width: | Height: | Size: 838 KiB |
|
|
@ -1,20 +0,0 @@
|
|||
version: "3"
|
||||
services:
|
||||
jmqa:
|
||||
image: silverfox68/jeanmarie:test
|
||||
container_name: jmqa
|
||||
environment:
|
||||
- PUID=${PUID}
|
||||
- PGID=${PGID}
|
||||
- TZ=${TZ}
|
||||
- GOOGLE_CLIENT_ID=735264084619-clsmvgdqdmum4rvrcj0kuk28k9agir1c.apps.googleusercontent.com
|
||||
- GOOGLE_CLIENT_SECRET=L6uI7FQGoMJd-ay1HO_iGJ6M
|
||||
- DISCORD_CLIENT_ID=956189108559036427
|
||||
- DISCORD_CLIENT_SECRET=dx2DZxjDhVMCCnGX4xpz5MxSTgZ4lHBI
|
||||
- FACEBOOK_CLIENT_ID=1529124327484248
|
||||
- FACEBOOK_CLIENT_SECRET=189509b5eb907b3ce34b7e8459030f21
|
||||
volumes:
|
||||
- ../jean-marie/templates:/templates
|
||||
ports:
|
||||
- 40192:40192
|
||||
restart: unless-stopped
|
||||