Skip to content

Commit 0601d38

Browse files
author
JesusGuzmanJr
committed
update dependencies; cleanup code; remove docker
1 parent 0baacb9 commit 0601d38

15 files changed

+60
-51
lines changed

.vscode/settings.json

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"footguns",
1818
"hasher",
1919
"initializer",
20+
"javac",
2021
"jdks",
2122
"libexec",
2223
"musl",

README.md

+27-16
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,25 @@ Rust earned the top spot as the “most-loved” programming language for the fi
1616

1717
### Stack Comparison
1818

19-
| Stack | Java | Rust |
20-
| ------------------ | ------------------------------------------------------ | -------------------------------------------- |
21-
| domain name | java-car-rentals.marzipan.club | rust-car-rentals.marzipan.club |
22-
| health endpoint | https://java-car-rentals.marzipan.club/health | https://rust-car-rental.marzipan.club/health |
23-
| language | [Java SE 8] ([OpenJDK 8 8u292-b10]) | [Rust 2018] ([1.54.0]) |
24-
| compiler | java-1.8.0-openjdk-devel | rustc 1.54.0 (a178d0322 2021-07-26) |
25-
| compilation target | java bytecode 52.0 | x86_64-unknown-linux-musl |
26-
| runtime | [OpenJDK] ([java-1.8.0-openjdk]) | [Tokio] ([0.2.25]) |
27-
| web framework | [Apache Tomcat] ([8.5.69]) and [Spring Boot] ([2.5.2]) | [Actix Web] ([3.3.2]) |
28-
| package manager | mvn | cargo |
29-
| manifest file | pom.xml | cargo.toml |
30-
| operating system | Fedora 34 | Fedora 34 |
31-
| cpu | 2 vCPU (AMD EPYC 2nd Gen) | 2 vCPU (AMD EPYC 2nd Gen) |
32-
| memory | 2 GB | 2 GB |
33-
| disk space | 40 GB | 40 GB |
19+
| Stack | Java | Rust |
20+
| ------------------ | ------------------------------------------------------ | ----------------------------------- |
21+
| domain name | java.marzipan.club | rust.marzipan.club |
22+
| health endpoint | https://java.marzipan.club/health | https://rust.marzipan.club/health |
23+
| language | [Java SE 8] ([OpenJDK 8 8u292-b10]) | [Rust 2018] ([1.54.0]) |
24+
| compiler | javac 1.8.0_302 | rustc 1.54.0 (a178d0322 2021-07-26) |
25+
| target | java bytecode 52.0 | stable-x86_64-unknown-linux-gnu |
26+
| runtime | [OpenJDK] ([java-1.8.0-openjdk]) | [Tokio] ([0.2.25]) |
27+
| web framework | [Apache Tomcat] ([8.5.69]) and [Spring Boot] ([2.5.2]) | [Actix Web] ([3.3.2]) |
28+
| package manager | mvn | cargo |
29+
| manifest file | [pom.xml] | [cargo.toml] |
30+
| configuration file | [application.properties] | [config.ron] |
3431

3532

3633
[Java SE 8]: https://docs.oracle.com/javase/8
3734
[OpenJDK 8 8u292-b10]: https://mail.openjdk.java.net/pipermail/jdk8u-dev/2021-April/013680.html
3835

3936
[Rust 2018]: https://www.rust-lang.org
40-
[1.53.0]: https://blog.rust-lang.org/2021/06/17/Rust-1.53.0.html
37+
[1.54.0]: https://blog.rust-lang.org/2021/07/29/Rust-1.54.0.html
4138

4239
[OpenJDK]: https://openjdk.java.net
4340
[java-1.8.0-openjdk]: https://openjdk.java.net/install
@@ -54,4 +51,18 @@ Rust earned the top spot as the “most-loved” programming language for the fi
5451
[Actix Web]: https://actix.rs
5552
[3.3.2]: https://crates.io/crates/actix-web/3.3.2
5653

54+
[pom.xml]: java/pom.xml
55+
[cargo.toml]: rust/cargo.toml
56+
57+
[application.properties]: java/src/main/resources/application.properties
58+
[config.ron]: rust/config.ron
59+
60+
61+
| Server Specs per Stack | |
62+
| ---------------------- | -------------------------------- |
63+
| operating system | Fedora 34 |
64+
| cpu | 2 vCPU cores (AMD EPYC 2nd Gen) |
65+
| memory | 2 GB RAM |
66+
| disk space | 40 GB NVMe |
67+
| cost | $50 per year |
5768
---
File renamed without changes.

java/Dockerfile

Whitespace-only changes.

java/README.md

+1-8
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Install the package manager.
3535
Install the web server.
3636

3737
brew install tomcat
38+
3839
## Development
3940
Run the program.
4041

@@ -55,11 +56,3 @@ Make a production build.
5556
Clear build artifacts.
5657

5758
mvn clean
58-
59-
Make a production build image.
60-
61-
docker build -t java-car-rentals:latest
62-
63-
Run an ephemeral docker container.
64-
65-
docker run --rm -it java-car-rentals:latest

java/src/main/resources/application.properties

+7
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,12 @@ spring.datasource.hikari.maxLifetime=600
1717
spring.datasource.hikari.idleTimeout=3000
1818
spring.datasource.data-source-class-name=org.postgresql.ds.PGSimpleDataSource
1919

20+
# tls
21+
server.ssl.enabled-protocols=TLSv1.3
22+
server.ssl.enabled=true
23+
server.ssl.key-store-type=PKCS12
24+
server.ssl.key-store=classpath:keystore/keystore.p12
25+
server.ssl.key-store-password=changeit
26+
2027
# miscellaneous
2128
management.info.git.mode=full

java/src/test/java/club/marzipan/carrentals/CarRentalsApplicationTests.java renamed to java/src/test/java/club/marzipan/javacarrentals/CarRentalsApplicationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package club.marzipan.carrentals;
1+
package club.marzipan.javacarrentals;
22

33
import org.junit.jupiter.api.Test;
44
import org.springframework.boot.test.context.SpringBootTest;

rust/Cargo.lock

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ version = "0.1.0"
88

99
[dependencies]
1010
actix-web = {version = "3.3.2", features = ["rustls"]}
11-
argon2 = "0.2.2"
11+
argon2 = "0.2.3"
1212
base64 = "0.13.0"
1313
base64-serde = "0.6.1"
1414
chrono = {version = "0.4.19", features = ["serde"]}
15-
color-backtrace = "0.5.0"
15+
color-backtrace = "0.5.1"
1616
derive_more = "0.99.16"
1717
env_logger = "0.9.0"
1818
log = "0.4.14"
1919
once_cell = "1.8.0"
2020
rand_core = "0.6.3"
2121
ron = "0.6.4"
22-
serde = "1.0.126"
23-
serde_json = "1.0.64"
22+
serde = "1.0.127"
23+
serde_json = "1.0.66"
2424
sqlx = {version = "0.5.5", features = [
2525
"runtime-async-std-rustls",
2626
"macros",

rust/Dockerfile

Whitespace-only changes.

rust/README.md

-9
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ Install the linter `clippy`.
3333

3434
rustup component add clippy
3535

36-
- Install docker: https://docs.docker.com/docker-for-mac/install/
3736

3837
## Development
3938
Automatically build and run on source changes.
@@ -59,11 +58,3 @@ Clear build artifacts.
5958
Check for outdated dependencies.
6059

6160
cargo outdated
62-
63-
Make a production build image.
64-
65-
docker build -t rust-car-rentals:latest
66-
67-
Run an ephemeral docker container.
68-
69-
docker run --rm -it rust-car-rentals:latest

rust/src/account_endpoint.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ use uuid::Uuid;
77
use validator::Validate;
88

99
use crate::{
10-
account::Account, account_entity, account_entity::AccountEntity, account_repository,
11-
create_account::CreateAccount, error_handler::Error, password_hasher,
10+
account::Account,
11+
account_entity::{AccountEntity, Status::Unverified},
12+
account_repository,
13+
create_account::CreateAccount,
14+
error_handler::Error,
15+
password_hasher,
1216
};
1317

1418
#[get("/account/{id}")]
@@ -36,7 +40,7 @@ async fn create_account(Json(create_account): Json<CreateAccount>) -> Result<Htt
3640
email: create_account.email,
3741
password_hash: password_hash.into(),
3842
password_salt: password_salt.into(),
39-
status: account_entity::Status::Unverified,
43+
status: Unverified,
4044
};
4145

4246
account_repository::save_and_flush(&account_entity).await?;

rust/src/persistance.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::time::Duration;
2+
13
use once_cell::sync::OnceCell;
24

35
type Pool = sqlx::Pool<sqlx::Postgres>;
@@ -7,8 +9,8 @@ static POOL: OnceCell<Pool> = OnceCell::new();
79
pub async fn init() {
810
let config = crate::config::app_config();
911

10-
let connection_timeout = std::time::Duration::new(config.postgres_timeout_sec, 0);
11-
let max_lifetime = std::time::Duration::new(config.postgres_max_life_time_minutes * 60, 0);
12+
let connection_timeout = Duration::new(config.postgres_timeout_sec, 0);
13+
let max_lifetime = Duration::new(config.postgres_max_life_time_minutes * 60, 0);
1214

1315
// panic if connection pool can't be created
1416
let pool = sqlx::postgres::PgPoolOptions::new()

0 commit comments

Comments
 (0)