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

Minor improvements on the Dockerfile #17

Open
ema-pe opened this issue Nov 19, 2024 · 0 comments
Open

Minor improvements on the Dockerfile #17

ema-pe opened this issue Nov 19, 2024 · 0 comments
Labels
dfaas-node Related to the agent node refactoring

Comments

@ema-pe
Copy link
Collaborator

ema-pe commented Nov 19, 2024

These are some notes about the Dockerfile to build the dfaas node that I collected during some manual deployments:

  1. Use the hack/install.sh script provided from faasd, updated with the given version, and not the local one under docker/files/faasd/hack/install.sh:

    COPY files/faasd/hack/install.sh ./hack/install.sh
    RUN chmod +x ./hack/install.sh
    RUN ./hack/install.sh

  2. The faasd and faasd-provider units are already enabled by default when installing faasd using the hack/install.sh script:

    RUN systemctl enable faasd.service
    RUN systemctl enable faasd-provider.service

  3. When upgrading cAdvisor to v0.51.0, use the direct link (see release assets) and move the binary to a better location (like /opt/cadvisor):

    # Add cAdvisor to monitor containers
    RUN wget https://github.com/google/cadvisor/releases/download/v0.44.0/cadvisor
    RUN chmod +x cadvisor
    COPY files/faasd/cadvisor.service /etc/systemd/system/cadvisor.service
    RUN systemctl enable cadvisor.service

  4. Same issue as the previous point with Prometheus node exporter:

    # Add Prometheus node exporter to monitor node
    RUN wget https://github.com/prometheus/node_exporter/releases/download/v1.3.1/node_exporter-1.3.1.linux-amd64.tar.gz
    RUN tar xvfz node_exporter-1.3.1.linux-amd64.tar.gz && rm node_exporter-1.3.1.linux-amd64.tar.gz
    COPY files/faasd/node-exporter.service /etc/systemd/system/node-exporter.service
    RUN systemctl enable node-exporter.service

  5. For the forecaster component, install it in /opt/dfaas-forecaster instead of the root directory (this requires updating the config_constants.py file). In the repository, it should be moved outside the docker directory, as it is a component not directly related to docker. Do not install the dependencies via pip when running as root, use apt instead (or create a virtual environment, see this for how to update the unit file), as it may conflict with the system-wide packages.

    ### DFaaS Forecaster
    WORKDIR /forecaster
    COPY forecaster/ .
    RUN pip install "fastapi[all]" scikit-learn lightgbm joblib pandas numpy
    COPY files/forecaster/forecaster.service /etc/systemd/system/forecaster.service
    RUN systemctl enable forecaster.service
    ### End DFaaS Forecaster

  6. Same for the dfaasagent component: it is better to install it in /opt/dfaas-agent instead of /agent, because it is a known directory in FHS. This requires some implementation changes in the agent.

    ### Agent
    WORKDIR /agent
    COPY files/dfaasagent/dfaasagent.service /etc/systemd/system/dfaasagent.service
    RUN systemctl enable dfaasagent.service
    COPY --from=dfaas-agent-builder:latest /go/src/dfaasagent/agent/loadbalancer/haproxycfgrecalc.tmpl ./haproxycfgrecalc.tmpl
    COPY --from=dfaas-agent-builder:latest /go/src/dfaasagent/agent/loadbalancer/haproxycfgnms.tmpl ./haproxycfgnms.tmpl
    COPY --from=dfaas-agent-builder:latest /go/src/dfaasagent/agent/loadbalancer/group_list.json ./group_list.json
    COPY --from=dfaas-agent-builder:latest /go/src/dfaasagent/dfaasagent ./dfaasagent
    ### End Agent

@ema-pe ema-pe added refactoring dfaas-node Related to the agent node labels Nov 19, 2024
@ema-pe ema-pe changed the title Minor improvements on the node Dockerfile Minor improvements on the Dockerfile Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dfaas-node Related to the agent node refactoring
Projects
None yet
Development

No branches or pull requests

1 participant