-
Notifications
You must be signed in to change notification settings - Fork 6
Deploying xmlu‐helper (aka sqlite‐server) on ec2
This guide helps you deploy a basic XMLUI helper service on AWS EC2.
You might not need to!
XMLUI is happy to run on your local machine. Use it that way to prototype and develop apps. If you want to share your prototype, you can use a tool like Tailscale to temporarily expose your local machine to the internet, or just to your team.
This deployment guide assumes you have an app you want to put into production.
You might not need it!
A basic XMLUI app can run from an S3 bucket with no extra support, see the guide for basic S3 hosting with no extra support. You'll need a helper service for one or both of these reasons:
-
Your app uses SQL to read from and/or write to a database.
-
Your app needs to read from and/or write to an API that does not support CORS.
We provide a lightweight open source server that enables both. It's a single binary that you can easily copy into any deployment. It embeds SQLite, and defaults to a file, data.db, that you can also easily deploy. You can go a long way with SQLite! But if you want to use your own database, the server's /query endpoint can be adjusted to point to it. Similarly the CORS proxy (the /proxy) endpoint can be adjusted to point to your own service if desired.
An XMLUI minimally comprises:
├── Main.xmlui
├── index.html
└── xmlui
└── xmlui-standalone.umd.js
This structure can live anywhere: your local machine, a web server, S3, etc. If you want to host it on S3 see []
Depending on your experience level and permissions, there are a variety of deployment paths, follow the one that best matches your access level. If unsure, check with your admin!
Details
- You will create the EC2 instance and set up SSH access.
- You will manually upload and run the server.
-
Log into AWS and go to EC2 Dashboard.
-
Launch a new EC2 instance:
- Choose Amazon Linux 2 or Ubuntu 22.04.
- Select instance type t3.micro (or similar).
- Create a Security Group allowing:
-
SSH (22)(Your IP only) -
TCP (8080)(Open to the web for API access).
-
- Create a key pair and download the
.pemfile.chmod 400the file. - Click Launch.
-
Connect via SSH:
ssh -i your-key.pem ec2-user@your-ec2-public-ip
- Replace
your-key.pemwith your key file. - Replace
your-ec2-public-ipwith the actual public IP.
- Replace
-
Upload and run your server:
scp -i your-key.pem xmlui-helper data.db ec2-user@your-ec2-public-ip:~ssh -i your-key.pem ec2-user@your-ec2-public-ip chmod +x xmlui-helper ./xmlui-helper # to observe console or tmux new -s xmlui # Use `tmux` or to keep the process alive: ./xmlui-helper
(Press
Ctrl+B, thenDto detach, andtmux attach -t xmluito reattach)(Can alternatively use
screen) -
(Optional) Set up a domain in Route 53:
- Go to Route 53 → Hosted Zones.
- Create an A record pointing to your EC2 instance's public IP.
- Wait for DNS propagation.
-
Access your server:
- If using the raw URL:
http://your-ec2-public-ip:8080 - If using a domain (optional):
http://your-domain.com:8080
- If using the raw URL:
Details
Details
Details
Details
Details
Details
graph TD;
A[Business Dev] -->|Prefers SSH| B[Can create EC2?];
A -->|Prefers AWS Console| C[Can create EC2?];
B -->|Yes| D[Allowed to use CloudFormation?];
B -->|No| E[Admin provisions EC2, Dev uses SSH];
C -->|Yes| F[Allowed to use CloudFormation?];
C -->|No| G[Admin provisions EC2, Dev uses Console];
D -->|Yes| H[Dev provisions EC2 via CloudFormation & uses SSH];
D -->|No| I[Dev provisions EC2 manually & uses SSH];
F -->|Yes| J[Dev provisions EC2 via CloudFormation & uses Console];
F -->|No| K[Dev provisions EC2 manually & uses Console];
E --> L[Deploy XMLUI Server via SSH];
G --> M[Deploy XMLUI Server via Console];
H --> N[Deploy XMLUI Server via SSH];
I --> O[Deploy XMLUI Server via SSH];
J --> P[Deploy XMLUI Server via Console];
K --> Q[Deploy XMLUI Server via Console];
style A fill:#f9f,stroke:#333,stroke-width:2px;
style B fill:#bbf,stroke:#333,stroke-width:2px;
style C fill:#bbf,stroke:#333,stroke-width:2px;
style D fill:#ffb,stroke:#333,stroke-width:2px;
style E fill:#ffb,stroke:#333,stroke-width:2px;
style F fill:#ffb,stroke:#333,stroke-width:2px;
style G fill:#ffb,stroke:#333,stroke-width:2px;
style H fill:#bfb,stroke:#333,stroke-width:2px;
style I fill:#bfb,stroke:#333,stroke-width:2px;
style J fill:#bfb,stroke:#333,stroke-width:2px;
style K fill:#bfb,stroke:#333,stroke-width:2px;
style L fill:#add8e6,stroke:#333,stroke-width:1px;
style M fill:#add8e6,stroke:#333,stroke-width:1px;
style N fill:#add8e6,stroke:#333,stroke-width:1px;
style O fill:#add8e6,stroke:#333,stroke-width:1px;
style P fill:#add8e6,stroke:#333,stroke-width:1px;
style Q fill:#add8e6,stroke:#333,stroke-width:1px;