mirror of
https://github.com/gabrielkheisa/x2go-terraform-digitalocean-chromium.git
synced 2026-04-03 09:02:44 +00:00
first
This commit is contained in:
92
README.md
Normal file
92
README.md
Normal file
@@ -0,0 +1,92 @@
|
||||
# Remote Desktop Setup on DigitalOcean
|
||||
|
||||
## Overview
|
||||
This project automates the deployment of a remote desktop environment on a DigitalOcean droplet using Terraform. It configures a Ubuntu 20.04 server with XFCE4, X2Go server for remote access, and a preconfigured user account.
|
||||
|
||||
## Features
|
||||
- Deploys a DigitalOcean droplet in the `sgp1` region.
|
||||
- Sets up a secure root password and a random password for the user `gabriel`.
|
||||
- Installs XFCE4 as the desktop environment.
|
||||
- Installs and configures X2Go for remote desktop access.
|
||||
- Installs Chromium browser.
|
||||
- Automatically provisions a 2GB swap file.
|
||||
|
||||
## Prerequisites
|
||||
- [Terraform](https://developer.hashicorp.com/terraform/downloads) installed on your local machine.
|
||||
- A [DigitalOcean account](https://www.digitalocean.com/) with an API token.
|
||||
- SSH access to the deployed droplet.
|
||||
|
||||
## Deployment Steps
|
||||
|
||||
### 1. Configure Terraform
|
||||
Edit `deploy.tf` and insert your DigitalOcean API token:
|
||||
```hcl
|
||||
provider "digitalocean" {
|
||||
token = "your_digitalocean_api_token"
|
||||
}
|
||||
```
|
||||
|
||||
### 2. Initialize Terraform
|
||||
Run the following command to initialize Terraform and download the required providers:
|
||||
```sh
|
||||
terraform init
|
||||
```
|
||||
|
||||
### 3. Apply the Configuration
|
||||
To deploy the droplet, execute:
|
||||
```sh
|
||||
terraform apply -auto-approve
|
||||
```
|
||||
Terraform will:
|
||||
- Create a DigitalOcean droplet.
|
||||
- Generate secure passwords for root and `gabriel`.
|
||||
- Run `setup.sh` to configure the system.
|
||||
|
||||
### 4. Retrieve Access Credentials
|
||||
After the deployment, retrieve the droplet IP and passwords:
|
||||
```sh
|
||||
terraform output
|
||||
```
|
||||
Expected output:
|
||||
```
|
||||
droplet_ip = "xxx.xxx.xxx.xxx"
|
||||
root_password = (sensitive value)
|
||||
gabriel_password = (sensitive value)
|
||||
```
|
||||
|
||||
### 5. Connect to the Droplet
|
||||
#### Using SSH:
|
||||
```sh
|
||||
ssh root@<droplet_ip>
|
||||
```
|
||||
Use the root password retrieved from Terraform.
|
||||
|
||||
#### Using X2Go:
|
||||
1. Download and install [X2Go Client](https://wiki.x2go.org/doku.php).
|
||||
2. Set up a new session with:
|
||||
- Host: `<droplet_ip>`
|
||||
- Login: `gabriel`
|
||||
- Session Type: `XFCE`
|
||||
3. Use the password retrieved from Terraform.
|
||||
4. Connect to the remote desktop environment.
|
||||
|
||||
## Cleanup
|
||||
To destroy the droplet and clean up resources, run:
|
||||
```sh
|
||||
terraform destroy -auto-approve
|
||||
```
|
||||
|
||||
## Security Considerations
|
||||
- The generated passwords are sensitive and should be handled securely.
|
||||
- Remove the stored password file (`/home/gabriel/.password.txt`) after first login.
|
||||
- Consider setting up SSH keys for better security.
|
||||
|
||||
## Troubleshooting
|
||||
- Ensure the droplet is running: `terraform show`
|
||||
- Check X2Go server logs: `sudo systemctl status x2goserver`
|
||||
- Verify SSH authentication is enabled: `cat /etc/ssh/sshd_config | grep PasswordAuthentication`
|
||||
|
||||
## License
|
||||
This project is open-source and can be modified as needed.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user