Minimize cloud-init config

This commit is contained in:
2024-07-02 17:32:35 +02:00
parent f05fac48ca
commit e08969bee5
4 changed files with 64 additions and 3 deletions

View File

@@ -0,0 +1,56 @@
#cloud-config
groups:
- ubuntu: [root,sys]
- docker
- bot
users:
- default
- name: keeper
gecos: keeper
shell: /bin/bash
primary_group: bot
sudo: ALL=(ALL) NOPASSWD:ALL
groups: users, admin, docker
lock_passwd: false
packages:
- apt-transport-https
- ca-certificates
- curl
- gnupg-agent
- software-properties-common
- chrony
- docker.io
- docker-compose
ntp:
enabled: true
ntp_client: chrony
servers:
- ${ntp_server}
runcmd:
- systemctl stop snapd && systemctl disable snapd
- git clone https://github.com/0x1d/drift-keeper /app/bot
- cp -rT /transfer /app/bot && rm -rf /transfer
- chown -R keeper:bot /app/bot
- cd /app/bot && sudo -u keeper -g bot -- docker-compose up -d
write_files:
- path: /transfer/.env
encoding: b64
owner: root:root
permissions: '0750'
content: ${env_file}
- path: /transfer/config.yaml
encoding: b64
owner: root:root
permissions: '0750'
content: ${config_file}
- path: /transfer/docker-compose.yaml
encoding: b64
owner: root:root
permissions: '0750'
content: ${docker_compose_file}

View File

@@ -32,7 +32,7 @@ ntp:
runcmd: runcmd:
- systemctl stop snapd && systemctl disable snapd - systemctl stop snapd && systemctl disable snapd
- git clone -b feature/scaling https://github.com/0x1d/drift-keeper /app/bot - git clone https://github.com/0x1d/drift-keeper /app/bot
- cp -rT /transfer /app/bot && rm -rf /transfer - cp -rT /transfer /app/bot && rm -rf /transfer
- chown -R keeper:bot /app/bot - chown -R keeper:bot /app/bot
- cd /app/bot && sudo -u keeper -g bot -- docker-compose up -d - cd /app/bot && sudo -u keeper -g bot -- docker-compose up -d

View File

@@ -1,4 +1,9 @@
terraform { terraform {
backend "consul" {
address = "sophon:8500"
scheme = "http"
path = "terraform/drift-keeper"
}
required_providers { required_providers {
linode = { linode = {
source = "linode/linode" source = "linode/linode"
@@ -29,7 +34,7 @@ locals {
prometheus_password_bcrypt = bcrypt(var.monitoring.prometheus_password) prometheus_password_bcrypt = bcrypt(var.monitoring.prometheus_password)
})) }))
} }
cloud_config = { for s in concat(var.linode_instances, var.digitalocean_instances) : s.label => templatefile("cloud-init/cloud-config.yaml", { cloud_config = { for s in concat(var.linode_instances, var.digitalocean_instances) : s.label => templatefile("cloud-init/cloud-config-small.yaml", {
ntp_server = s.ntp_server ntp_server = s.ntp_server
env_file = base64encode(templatefile("templates/bot/env.tpl", merge(var.bot, { env_file = base64encode(templatefile("templates/bot/env.tpl", merge(var.bot, {
jito_block_engine_url = s.jito_block_engine_url jito_block_engine_url = s.jito_block_engine_url

View File

@@ -43,7 +43,7 @@ global:
# end after the deposit transaction is sent # end after the deposit transaction is sent
#forceDeposit: 1000 #forceDeposit: 1000
websocket: false # use websocket for account loading and events (limited support) websocket: true # use websocket for account loading and events (limited support)
eventSubscriber: false # disables event subscriber (heavy RPC demand), this is primary used for counting fills eventSubscriber: false # disables event subscriber (heavy RPC demand), this is primary used for counting fills
runOnce: false # Set true to run once and exit, useful for testing or one off bot runs runOnce: false # Set true to run once and exit, useful for testing or one off bot runs
debug: false # Enable debug logging debug: false # Enable debug logging