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

axum-bootstrap

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

5 releases

new 0.1.4 Mar 31, 2025
0.1.3 Mar 31, 2025
0.1.2 Mar 30, 2025
0.1.1 Mar 30, 2025
0.1.0 Mar 29, 2025

#384 in HTTP server

Download history 65/week @ 2025-03-24

65 downloads per month

MIT/Apache

37KB
777 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

~23–38MB
~676K SLoC