This guide explains how to clone and set up the application on a new computer or deployment environment, including handling private keys and credentials.
Before starting, ensure you have:
- Python 3.10 or higher
- Git installed
- Access to Neo4j database
- Access to Snowflake account
- Your Snowflake RSA private key (from original setup)
# Clone from GitHub
git clone https://github.com/Hotragn/TravelGraph-AI.git
cd TravelGraph-AI
# Create virtual environment
python -m venv venv
# Activate virtual environment
# Windows:
venv\Scripts\activate
# Mac/Linux:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txtIMPORTANT: Your Snowflake private key is NOT in the GitHub repository for security reasons.
-
On your original machine, locate your private key:
C:\Users\hotra\.ssh\rsa_key.p8 # or wherever you stored it -
Securely transfer the private key to the new machine:
- Use a secure method (USB drive, encrypted email, secure file transfer)
- Never commit this file to Git!
-
On the new machine, place the key in a secure location:
# Windows mkdir C:\Users\YourUsername\.ssh # Copy rsa_key.p8 to this location # Mac/Linux mkdir ~/.ssh chmod 700 ~/.ssh # Copy rsa_key.p8 to ~/.ssh/ chmod 600 ~/.ssh/rsa_key.p8
If you can't access the original key, generate a new one:
# Windows (PowerShell)
cd config
.\generate_snowflake_keys.ps1
# Mac/Linux
cd config
python generate_keys.pyThen update Snowflake:
- Log into Snowflake
- Go to your user settings
- Update the public key with the new one
- Use the new private key in your secrets
Create .streamlit/secrets.toml with your credentials:
# Create .streamlit directory if it doesn't exist
mkdir .streamlitCreate .streamlit/secrets.toml:
# Neo4j Configuration
[neo4j]
uri = "neo4j+s://your-neo4j-instance.databases.neo4j.io"
username = "neo4j"
password = "your-neo4j-password"
# Snowflake Configuration
[snowflake]
account = "your-account.snowflakecomputing.com"
user = "your-username"
warehouse = "COMPUTE_WH"
database = "TRAVEL_DB"
schema = "PUBLIC"
role = "ACCOUNTADMIN"
# Snowflake Private Key Authentication
private_key_path = "C:/Users/YourUsername/.ssh/rsa_key.p8"
# Or for Mac/Linux: "/home/username/.ssh/rsa_key.p8"
# Optional: Private key passphrase (if you set one)
# private_key_passphrase = "your-passphrase"Security Notes:
- ✅
.streamlit/secrets.tomlis in.gitignore- it won't be pushed to GitHub - ✅ Never commit this file
- ✅ Each team member/deployment needs their own copy
Test your configuration:
# Run the application
streamlit run app.pyIf successful, you should see:
- ✅ Streamlit app starts
- ✅ No connection errors
- ✅ Can log in
- ✅ Pages load correctly
✅ Source code
✅ Documentation
✅ Configuration templates
✅ SQL scripts
❌ .streamlit/secrets.toml - Database credentials
❌ rsa_key.p8 - Snowflake private key
❌ rsa_key.pub - Snowflake public key
❌ .env files - Environment variables
❌ Any passwords or API keys
Original Machine:
C:\Users\hotra\.ssh\rsa_key.p8 # Private key
C:\Users\hotra\.ssh\rsa_key.pub # Public key
Travel Recommend\.streamlit\secrets.toml # Credentials
New Machine (example):
C:\Users\NewUser\.ssh\rsa_key.p8 # Copy private key here
Travel Recommend\.streamlit\secrets.toml # Create new file
Team member clones repo:
- Clone repository
- Get private key from team lead (secure transfer)
- Create their own
.streamlit/secrets.toml - Use same Snowflake account credentials
- Run application
For Streamlit Cloud deployment:
-
Push code to GitHub (already done ✅)
-
In Streamlit Cloud dashboard:
- Connect to GitHub repository
- Select
TravelGraph-AI - Set main file:
app.py
-
Add secrets in Streamlit Cloud:
- Go to App Settings → Secrets
- Paste your secrets.toml content
- For private key: Convert to base64 or use environment variable
-
Handle Private Key:
# Option 1: Base64 encode the key [snowflake] private_key_base64 = "LS0tLS1CRUdJTi..." # Option 2: Use Streamlit secrets directly [snowflake] private_key = """ -----BEGIN PRIVATE KEY----- MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC... -----END PRIVATE KEY----- """
-
Update
connections.pyto read from secrets:# Read private key from Streamlit secrets if 'private_key_base64' in st.secrets['snowflake']: import base64 private_key_bytes = base64.b64decode( st.secrets['snowflake']['private_key_base64'] ) elif 'private_key' in st.secrets['snowflake']: private_key_bytes = st.secrets['snowflake']['private_key'].encode()
Your laptop → Desktop computer:
- Clone repository
- Copy
.ssh/rsa_key.p8from laptop to desktop - Create new
.streamlit/secrets.tomlon desktop - Update
private_key_pathto match desktop location - Run application
For setting up on a new machine:
- Clone repository from GitHub
- Create virtual environment
- Install dependencies (
pip install -r requirements.txt) - Create
.streamlit/directory - Copy or generate Snowflake private key
- Create
.streamlit/secrets.tomlwith credentials - Update
private_key_pathin secrets.toml - Test Neo4j connection
- Test Snowflake connection
- Run
streamlit run app.py - Verify all pages work
-
Generate new key pair:
cd config python generate_keys.py -
Update Snowflake:
-- In Snowflake, run: ALTER USER your_username SET RSA_PUBLIC_KEY='MIIBIjANBg...';
-
Update secrets.toml:
private_key_path = "path/to/new/rsa_key.p8"
- Update in Neo4j console
- Update secrets.toml:
[neo4j] password = "new-password"
Solution: Check private_key_path in secrets.toml matches actual file location
Solution: Ensure you copied the entire key file, including header/footer
Solution:
- Verify public key is set in Snowflake user settings
- Check private key matches the public key
- Ensure no extra spaces in key file
Solution:
- Check URI, username, password in secrets.toml
- Verify Neo4j instance is running
- Check network connectivity
If you encounter issues:
- Check this guide first
- Review
docs/MANUAL_KEY_SETUP.md - Review
docs/SNOWFLAKE_KEYPAIR_SETUP.md - Contact team: Hotragn, Tirdesh, Amantha
- Never commit secrets to Git
- Use secure transfer for private keys (encrypted email, secure USB)
- Set proper file permissions on private keys (chmod 600 on Linux/Mac)
- Rotate keys periodically for production environments
- Use different credentials for dev/staging/production
Last Updated: December 2024
Version: 1.0.0
