Skip to main content

EC2 Deployment

Deploy the Goblin daemon to AWS EC2 for 24/7 operation.

Prerequisites

  • AWS account with EC2 access
  • AWS CLI configured (aws configure)
  • SSH key pair created in AWS

Quick Deploy

1. Launch EC2 Instance

# Ubuntu 22.04 LTS, t3.small (2GB RAM recommended)
aws ec2 run-instances \
--image-id ami-0c55b159cbfafe1f0 \
--instance-type t3.small \
--key-name your-key-name \
--security-group-ids sg-xxxxx \
--tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=goblin-daemon}]'

2. Connect to Instance

ssh -i ~/.ssh/your-key.pem ubuntu@<instance-ip>

3. Install Dependencies

# Update system
sudo apt update && sudo apt upgrade -y

# Install Python 3.11
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt install python3.11 python3.11-venv python3.11-dev git -y

# Install tmux
sudo apt install tmux -y

4. Clone & Install Goblin

git clone https://github.com/your-org/goblin.git
cd goblin

python3.11 -m venv venv
source venv/bin/activate
pip install -e .

5. Configure Linear

goblin init
goblin auth --token lin_api_YOUR_TOKEN --org your-org
goblin pipeline config -p project --assignee-id YOUR_BOT_USER_ID

6. Create Systemd Service

Create /etc/systemd/system/goblin-daemon.service:

[Unit]
Description=Goblin Daemon - Linear Auto-Assignment
After=network.target

[Service]
Type=simple
User=ubuntu
WorkingDirectory=/home/ubuntu/goblin
Environment="PATH=/home/ubuntu/goblin/venv/bin:/usr/local/bin:/usr/bin:/bin"
ExecStart=/home/ubuntu/goblin/venv/bin/python -m goblin.cli.main daemon
Restart=always
RestartSec=10
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target

7. Start Service

sudo systemctl daemon-reload
sudo systemctl enable goblin-daemon
sudo systemctl start goblin-daemon

# Check status
sudo systemctl status goblin-daemon

# View logs
sudo journalctl -u goblin-daemon -f

Remote Management

Configure remote access from your local machine:

goblin remote set \
--name production \
--ip 3.16.148.197 \
--ssh-key ~/.ssh/key.pem \
--instance-id i-xxxxx \
--region us-east-2

Remote Commands

# View logs
goblin remote logs # Recent
goblin remote logs -f # Follow
goblin remote logs -l 100 # Last 100 lines

# Control daemon
goblin remote status
goblin remote restart
goblin remote start
goblin remote stop

# SSH access
goblin remote ssh

Security

Restrict SSH Access

# Only allow SSH from your IP
aws ec2 authorize-security-group-ingress \
--group-id sg-xxxxx \
--protocol tcp \
--port 22 \
--cidr YOUR_IP/32

Secrets Management

Consider AWS Secrets Manager or SSM Parameter Store for credentials.

Cost Estimate

InstancevCPURAMCost/Month
t3.micro21GB~$7.50
t3.small22GB~$15
t3.medium24GB~$30

Recommendation: Start with t3.small.

Updating Goblin

# SSH to server
cd goblin
git pull
source venv/bin/activate
pip install -e .

# Restart service
sudo systemctl restart goblin-daemon