From 98191d29ee866a53346ac1048f6ff31f9bf27aa3 Mon Sep 17 00:00:00 2001 From: jude Date: Sun, 7 May 2023 21:08:59 +0100 Subject: [PATCH] deb-related stuff --- Cargo.toml | 8 ++++---- Containerfile | 9 +++++++++ README.md | 11 ++--------- build.rs | 3 +++ 4 files changed, 18 insertions(+), 13 deletions(-) create mode 100644 Containerfile create mode 100644 build.rs diff --git a/Cargo.toml b/Cargo.toml index 9bfa5d2..ef7d7ec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,14 +35,14 @@ path = "postman" path = "web" [package.metadata.deb] -depends = "$auto, nginx, python3-dateparser" -suggests = "mysql-server-8.0" +depends = "$auto, python3-dateparser" +suggests = "mysql-server-8.0, nginx" maintainer-scripts = "debian" assets = [ ["target/release/reminder-rs", "usr/bin/reminder-rs", "755"], ["conf/default.env", "etc/reminder-rs/default.env", "600"], - ["web/static/", "var/www/reminder-rs/static", "755"], - ["nginx/reminder-rs", "etc/nginx/sites-available/reminder-rs", "755"] +# ["web/static/", "var/www/reminder-rs/static", "755"], +# ["nginx/reminder-rs", "etc/nginx/sites-available/reminder-rs", "755"] ] [package.metadata.deb.systemd-units] diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..4684fc4 --- /dev/null +++ b/Containerfile @@ -0,0 +1,9 @@ +FROM ubuntu:20.04 + +ENV RUSTUP_HOME=/usr/local/rustup \ + CARGO_HOME=/usr/local/cargo \ + PATH=/usr/local/cargo/bin:$PATH + +RUN apt update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt install -y gcc gcc-multilib cmake pkg-config libssl-dev curl mysql-client-8.0 +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --profile minimal +RUN cargo install cargo-deb diff --git a/README.md b/README.md index ffef020..a3e6a7e 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ You'll need rustc and cargo for compilation. To run, you'll need Python 3 still ### Compiling Install build requirements: -`sudo apt install gcc gcc-multilib cmake libssl-dev build-essential` +`sudo apt install gcc gcc-multilib cmake libssl-dev build-essential python3-dateparser` Install Rust from https://rustup.rs @@ -28,9 +28,7 @@ Use MySQL 8. MariaDB is confirmed not working at the moment. Load the SQL files in order from "migrations" to generate the database schema. ### Setting up Python -Reminder Bot by default looks for a venv within it's working directory to run Python out of. To set up a venv, install `python3-venv` and run `python3 -m venv venv`. Then, run `source venv/bin/activate` to activate the venv, and do `pip install dateparser` to install the required library. - -Remember where you create the venv! You may need to change the `PYTHON_LOCATION` variable in the next step to point to your Python binary if the venv is not in your working directory. +Reminder Bot uses `python3-dateparser` to handle dates. This depends on Python 3. ### Environment Variables Reminder Bot reads a number of environment variables. Some are essential, and others have hardcoded fallbacks. Environment variables can be loaded from a .env file in the working directory. @@ -46,8 +44,3 @@ __Other Variables__ * `CNC_GUILD` - default `None`, accepts a single Discord guild ID for the server that the subscription roles belong to * `PYTHON_LOCATION` - default `venv/bin/python3`. Can be changed if your Python executable is located somewhere else * `THEME_COLOR` - default `8fb677`. Specifies the hex value of the color to use on info message embeds -* `DM_ENABLED` - default `1`, if `1`, Reminder Bot will respond to direct messages - -### Todo List - -* Convert aliases to macros diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..3a8149e --- /dev/null +++ b/build.rs @@ -0,0 +1,3 @@ +fn main() { + println!("cargo:rerun-if-changed=migrations"); +}