Comments (1)
what do you want the service file to do ?
I wrote these service files for the VMI to run bacalhau serve and restart the service when it fails
[Unit]
Description=Bacalhau Daemon
After=network-online.target
Wants=network-online.target systemd-networkd-wait-online.service
[Service]
Environment="LOG_TYPE=json"
Environment="BACALHAU_DIR=/data"
Environment="BACALHAU_ENVIRONMENT=local"
Restart=always
RestartSec=5s
ExecStart=bacalhau serve ${args}
[Install]
WantedBy=multi-user.target
[Unit]
Description=Startup Script
After=network-online.target
Wants=network-online.target systemd-networkd-wait-online.service
[Service]
ExecStart=/usr/local/bin/startup-script.sh
Restart=on-failure
RestartSec=10s
[Install]
WantedBy=multi-user.target
#! /bin/bash
echo "Startup script is running as user: $(whoami)"
CONFIG_FILE="/etc/config.yaml"
echo "Fetching node type..."
NODE_TYPE=$(curl -f http://metadata.google.internal/computeMetadata/v1/instance/attributes/node_type -H "Metadata-Flavor: Google")
CURL_STATUS=$?
if [ $CURL_STATUS -ne 0 ]; then
echo "Error fetching NODE_TYPE. Exiting..."
exit 1
fi
echo "Node Type: $NODE_TYPE"
if [ "$NODE_TYPE" = "requester" ]; then
echo "Node type is requester."
if [ ! -f $CONFIG_FILE ]; then
sudo cp /etc/requester_config.yaml $CONFIG_FILE
fi
else
echo "Node type is not requester. Fetching requester IP..."
REQUESTER_IP=$(curl -s -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/requester_ip")
echo "Requester IP: $REQUESTER_IP"
if [ ! -f $CONFIG_FILE ]; then
sudo cp /etc/compute_config.yaml $CONFIG_FILE
sed -i "s/\${requester_ip}/$REQUESTER_IP/g" $CONFIG_FILE
fi
fi
if [ ! -d /data ]; then
sudo mkdir -p /data
sudo chmod 0700 /data
echo "/data directory created."
else
echo "/data directory already exists. No need to create."
fi
if [ ! -f /data/config.yaml ]; then
echo "Moving configuration file..."
sudo mv "$CONFIG_FILE" /data/config.yaml
else
echo "Configuration file already exists, not moving."
fi
echo "Checking and moving service files..."
if [ ! -f /etc/systemd/system/bacalhau.service ]; then
sudo mv /etc/bacalhau.service /etc/systemd/system/bacalhau.service
else
echo "Service file already exists in target location, not moving."
fi
echo "Reloading systemctl daemon..."
systemctl daemon-reload
echo "Handling Docker service..."
systemctl enable docker
systemctl restart docker
echo "Enabling bacalhau service..."
systemctl enable bacalhau.service
systemctl restart bacalhau.service
from bacalhau.
Related Issues (20)
- Backfill evaluations at startup
- Update evaluation state
- Handling Ungraceful Terminations of Log Streams on NATS HOT 1
- Deploy canaries with filtered installationID
- Refactor configuration systems to remove global config access
- Improved Configuration Management
- Job rescheduling policies
- Add queue and total timeout values to jobs
- Housekeeping task to fail jobs exceeding total timeouts
- Reschedule jobs if no nodes were found
- Use new APIs for `wasm run`
- `bacalhau node list` returns error `failed request: invalid node type: nodeTypeUndefined` HOT 4
- Separate out streaming client into consumer and producer client and add heart beat logic
- Optimize the heart beating mainly, to do more optimistic cleanup instead of just removing all stream ids
- Add end to end tests using devstack for unhappy cases for log streaming
- obtuse error message from `bacalhau docker run` when issuing job with invalid parameters
- Handle graceful shutdown of produceer client via context
- Show full nodeID and executionID with `--wide` flag
- Cancel log stream on respective engines if the stream is cancelled due to any reason.
- Simplify node bootstrapping (fx)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bacalhau.