#axum #web-server #shutdown #axum-bootstrap #axum脚手架

axum-bootstrap

a way to bootstrap a web server with axum, including TLS, logging, monitoring, and more

10 releases

new 0.1.9 May 14, 2025
0.1.8 May 14, 2025
0.1.7 Apr 18, 2025
0.1.4 Mar 31, 2025

#1002 in HTTP server

Download history 388/week @ 2025-03-26 65/week @ 2025-04-02 139/week @ 2025-04-09 377/week @ 2025-04-16 12/week @ 2025-04-23 6/week @ 2025-04-30

541 downloads per month

MIT/Apache

38KB
778 lines

axum脚手架

参考

  1. axum serve-with-hyper
  2. axum hyper graceful shutdown
  3. axum anyhow-error-response
  4. axum error-handling

TLS自签名证书

openssl req -x509 -newkey rsa:4096 -sha256 -nodes -keyout privkey.pem -out cert.pem -days 3650 -subj "/C=cn/ST=hl/L=sd/O=op/OU=as/CN=example.com"

MySQL容器

#rm -rf /var/lib/mysql
docker stop mysql
mkdir -p /var/lib/mysql /etc/mysql/conf.d
cat > /etc/mysql/conf.d/ssl.cnf <<EOF
[mysqld]
default-time_zone = '+8:00'
require_secure_transport=ON
EOF
docker run -d --rm  --name mysql \
--network host \
-v /var/lib/mysql:/var/lib/mysql \
-v /etc/mysql/conf.d:/etc/mysql/conf.d \
-e MYSQL_DATABASE=test \
-e MYSQL_ROOT_PASSWORD=xxxxxx \
docker.io/library/mysql:9.1 

Dependencies

~15–27MB
~488K SLoC