我在 Rust + Actix-web 中有一个 hello world web 项目。我有几个问题。首先是代码的每次更改都会导致重新编译整个项目,包括下载和编译每个 crate。我想像在正常开发中一样工作 - 这意味着缓存编译的 crate 并且只重新编译我的代码库。第二个问题是它不会暴露我的应用程序。无法通过网络浏览器访问
Dockerfile:
FROM rust
WORKDIR /var/www/app
COPY . .
EXPOSE 8080
RUN cargo run
Run Code Online (Sandbox Code Playgroud)
docker-compose.yml:
version: "3"
services:
app:
container_name: hello-world
build: .
ports:
- '8080:8080'
volumes:
- .:/var/www/app
- registry:/root/.cargo/registry
volumes:
registry:
driver: local
Run Code Online (Sandbox Code Playgroud)
主.rs:
extern crate actix_web;
use actix_web::{web, App, HttpServer, Responder};
fn index() -> impl Responder {
"Hello world"
}
fn main() -> std::io::Result<()> {
HttpServer::new(|| App::new().service(web::resource("/").to(index)))
.bind("0.0.0.0:8080")?
.run()
}
Run Code Online (Sandbox Code Playgroud)
货物.toml:
[package]
name = …Run Code Online (Sandbox Code Playgroud) 我正在测试与分子和组合的版本兼容性
python 3.8 x ansible 最新 x debian
分子在实例创建步骤中断裂
TASK [Wait for instance(s) creation to complete] *******************************
FAILED - RETRYING: Wait for instance(s) creation to complete (300 retries left).
failed: [localhost] (item=None) => {"attempts": 2, "censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result", "changed": false}
fatal: [localhost]: FAILED! => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result", "changed": false}
PLAY …Run Code Online (Sandbox Code Playgroud) 我想扮演一个角色。这些角色应通过具有分子的CI / CD流程进行验证,并利用docker作为驱动程序。此验证步骤应包括多个Linux版本(例如centos / ubuntu / debian)乘以受支持的ansible版本。
然后应执行测试,以便使用
centos:7 + ansible:2.5
centos:7 + ansible:2.6
centos:7 + ansible:2.7
...
ubuntu:1604 + ansible:2.5
ubuntu:1604 + ansible:2.6
ubuntu:1604 + ansible:2.7
...
Run Code Online (Sandbox Code Playgroud)
Ansible团队的官方图片已弃用大约3年了:
此外,由于结果数量巨大,为查找支持ansible的新图像而使用的不推荐使用的图像所引用的链接是完全没有用的
https://hub.docker.com/search/?q=ansible&page=1&isAutomated=0&isOfficial=0&pullCount=1&starCount=0
是否有社区(或ansible)维护良好的ansible码头工人形象填补了空白?
最好具有可以拉出的多个版本以及可以定期构建和验证所创建映像的CI流程。
我为什么要寻找图像?我不想重新发明轮子(如果可能的话)。我想使用图像通过分子来测试版本不兼容的角色。
我进行了搜索,但找不到真正有用的东西。您正在使用什么图像在容器/编排器中运行ansible?您是否自己构建和维护图像?
例如https://hub.docker.com/r/ansibleplaybookbundle/apb-base/tags
看起来很有希望,但是其中的图像也已经存在了7个月以上(至少)。
为OS和ansible版本的每种组合创建docker映像是否是通过分子和docker作为驱动程序进行测试的最佳方法?还是有一种更聪明的方法来测试具有多个操作系统时间和不同版本的ansible角色的向后兼容性?
我已经用分子和泊坞窗作为驱动程序测试了我的角色。这些测试当前仅测试角色在各种Linux发行版上的功能,而不能通过使用旧版本的ansible版本运行角色来测试向后兼容。
这是基于geerlingguy的ntp角色的centos7 / ubuntu1604 / ubuntu1804的travis测试示例角色:https : //github.com/Gepardec/ansible-role-ntp
我正在尝试启动 Debian 映像,并/sbin/init通过 molecular 进行 ansible 角色测试。
是的,我知道,除非您确实有这样做的用例,否则不应/sbin/init在容器中启动。使用 molecular,我可以在 docker 容器中测试我的 ansible 角色。因此我需要/sbin/init跑步。
当我执行时
docker run -it --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro debian:9 /sbin/init
docker: Error response from daemon: OCI runtime create failed: container_linux.go:346:
starting container process caused "exec: \"/sbin/init\": stat /sbin/init: no such file
or directory": unknown.
Run Code Online (Sandbox Code Playgroud)
然而,在 debian:8 下它工作得很好。
docker run -it --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro debian:8 /sbin/init
Run Code Online (Sandbox Code Playgroud)
奇迹般有效。
Debian 是否已切换到新的启动过程?发生了什么变化?