Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rust implementation #292

Open
wants to merge 72 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
4468b38
add: simple rust api server
Romira915 Jun 7, 2022
29c7bf8
fix: DB host and port
Romira915 Jun 7, 2022
a9ef111
add: dsn
Romira915 Jun 7, 2022
edbc5c0
features: get initialize
Romira915 Jun 8, 2022
e47dc12
add: todo func
Romira915 Jun 8, 2022
44df9ac
add: static dir
Romira915 Jun 9, 2022
93f4394
add: html template 分割
Romira915 Jun 9, 2022
c1a18bb
add: register.html
Romira915 Jun 9, 2022
09df39a
test tiny
Romira915 Jun 9, 2022
ebc4600
add: get_session_user
Romira915 Jun 9, 2022
777f4ae
features: get get_register
Romira915 Jun 9, 2022
8fc8e90
fix: session var
Romira915 Jun 9, 2022
cea6822
add: regex
Romira915 Jun 10, 2022
44f315d
add: form
Romira915 Jun 10, 2022
cfc6da8
features: register
Romira915 Jun 10, 2022
9967f48
add: todo get_flash
Romira915 Jun 10, 2022
d6ce708
fix: get_flash in get_register
Romira915 Jun 10, 2022
63edf8a
features: post_login
Romira915 Jun 10, 2022
a0e5b96
features: get_login
Romira915 Jun 10, 2022
f0992e8
features: make_posts
Romira915 Jun 10, 2022
c0c9069
Merge pull request #1 from Romira915/feature/login
Romira915 Jun 10, 2022
e294c93
add: todo
Romira915 Jun 10, 2022
c6b9fc3
create: template html
Romira915 Jun 10, 2022
bb1bdee
fix: template html
Romira915 Jun 14, 2022
ea152c4
add: image_url
Romira915 Jun 14, 2022
396202c
features: index /
Romira915 Jun 14, 2022
8358f04
fix: origin
Romira915 Jun 14, 2022
e476067
features: get_image
Romira915 Jun 14, 2022
93f458c
Merge pull request #2 from Romira915/feature/get_index
Romira915 Jun 14, 2022
db9c368
features: get_post_id
Romira915 Jun 15, 2022
de507a4
Merge pull request #19 from Romira915/feature/get_posts_id
Romira915 Jun 15, 2022
6673833
features: post_index
Romira915 Jun 15, 2022
ced1035
fix: show user name
Romira915 Jun 15, 2022
09f3251
fix: log level
Romira915 Jun 15, 2022
c2e67d7
fix: ref user page
Romira915 Jun 15, 2022
4ebe48c
Merge pull request #21 from Romira915/feature/post_index
Romira915 Jun 16, 2022
dc0e237
fix: 不要なコードを削除
Romira915 Jun 16, 2022
a8f9ce5
features: post_comment
Romira915 Jun 16, 2022
882a50b
features: get_admin_bannedを実装した・・・だけ
Romira915 Jun 16, 2022
63859db
fix: passhashの不具合修正
Romira915 Jun 16, 2022
4587449
fix: クエリパラメータをpayloadで受け取り
Romira915 Jun 16, 2022
6001fde
fix: post admin banned
Romira915 Jun 17, 2022
499e1db
features: post_admin_banned 実装
Romira915 Jun 17, 2022
f2e74f2
features: get_account_name 実装
Romira915 Jun 17, 2022
be2d762
fix: 表示ユーザがログインユーザとして表示される不具合を修正
Romira915 Jun 17, 2022
e719f0f
fix: bugを確認
Romira915 Jun 17, 2022
693cca2
bugfix: commented_countが正しくない不具合を修正
Romira915 Jun 17, 2022
f4bf4bc
fix: 例外処理を追加
Romira915 Jun 17, 2022
8dc87ff
fix: add NOTE
Romira915 Jun 17, 2022
330bec6
add: query param
Romira915 Jun 17, 2022
751e876
features: get_posts 実装
Romira915 Jun 17, 2022
7a6ad50
Merge pull request #22 from Romira915/rust
Romira915 Jun 17, 2022
7354b96
fix: 不要なhandleを削除
Romira915 Jun 18, 2022
87b8fd3
fix: 分離 pid ext
Romira915 Jun 18, 2022
ef88f11
Merge pull request #23 from Romira915/fix/get_image
Romira915 Jun 18, 2022
363a945
fix: cookiesessionでのベンチマークを確認
Romira915 Jun 18, 2022
af1d0a5
rm: template dir
Romira915 Jun 18, 2022
29f6b3a
resolve upstreamをmerge
Romira915 Jun 18, 2022
72165e5
fix: redisへの依存を削除
Romira915 Jun 18, 2022
e3f67db
exec: cargo fix
Romira915 Jun 18, 2022
8808e10
fix: cargo clippyに則った修正
Romira915 Jun 18, 2022
9bd48cc
rm: 不要なコメント削除
Romira915 Jun 18, 2022
262f96b
fix: log level
Romira915 Jun 18, 2022
4cee458
fix: golangの処理に準拠
Romira915 Jun 18, 2022
b3ba129
fix: cargo fix
Romira915 Jun 19, 2022
f65cefc
rm : .vscode
Romira915 Jun 19, 2022
9cb1397
fix: リンクミスを修正
Romira915 Jun 19, 2022
c08215d
fix: default app
Romira915 Jun 19, 2022
fd26f91
fix: golangの意図していない編集を修正
Romira915 Jun 19, 2022
9838a22
fix: cmd! to duct_sh
Romira915 Jun 19, 2022
486a6e9
fix: append about rust
Romira915 Jun 20, 2022
84467ae
fix: escape shell arg
Romira915 Jun 20, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Ubuntu 20.04 / 22.04

* Ruby/Go/PHPの3言語が用意されており、デフォルトはRubyが起動する
* Node.jsは現状メンテナンスされていない
* Rustは現在、Docker Composeでのみ用意されている
* AMI・Vagrantで他の言語の実装を動かす場合は[manual.md](/manual.md)を参考にする
* AMI・Docker Compose・Vagrantが用意されている
* 手元で適当に動かすことも難しくない
Expand Down
9 changes: 9 additions & 0 deletions webapp/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ services:
volumes:
- ./public:/home/public
init: true
depends_on:
mysql:
condition: service_healthy
deploy:
resources:
limits:
Expand All @@ -43,6 +46,12 @@ services:
- ./sql:/docker-entrypoint-initdb.d
ports:
- "3306:3306"
healthcheck:
test: mysqladmin ping -h 127.0.0.1 -u$$MYSQL_USER -p$$MYSQL_PASSWORD
interval: 5s
timeout: 5s
retries: 10
start_period: 5s
deploy:
resources:
limits:
Expand Down
18 changes: 18 additions & 0 deletions webapp/rust/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

.env
.tmp
*.log
33 changes: 33 additions & 0 deletions webapp/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[package]
edition = "2021"
name = "rust"
version = "0.1.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
actix-cors = "0.6.1"
actix-files = "0.6.0"
actix-multipart = "0.4.0"
actix-redis = "0.10.0"
actix-session = "0.5.0"
actix-web = "4.0.1"

handlebars = {version = "4.3.0", features = ["dir_source"]}
sqlx = {version = "0.5.13", features = ["runtime-actix-native-tls", "mysql", "chrono", "uuid"]}

anyhow = "1.0.57"
chrono = {version = "0.4.19", features = ["serde"]}
derive_more = "0.99.17"
duct = "0.13.5"
duct_sh = "0.13.5"
futures-util = {version = "0.3.21", default-features = false, features = ["std"]}
log = "0.4.17"
num_cpus = "1.13.1"
once_cell = "1.10.0"
rand = "0.8.5"
regex = "1.5.6"
serde = {version = "1.0.137", features = ["derive"]}
serde_json = "1.0.81"
serde_qs = "0.9.2"
simplelog = "0.12.0"
14 changes: 14 additions & 0 deletions webapp/rust/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM rust:1.61.0

WORKDIR /home/webapp

COPY Cargo.toml Cargo.toml
RUN mkdir src \
&& echo "fn main(){}" > src/main.rs \
&& echo "DATABASE_URL=mysql://root:root@mysql:3306/isuconp" > .env \
&& cargo build --release

COPY src src
COPY static static
RUN rm -f target/release/deps/rust*
CMD cargo run --release
Loading