-
Notifications
You must be signed in to change notification settings - Fork 0
Pass residential proxy secret during deploy #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -93,26 +93,25 @@ jobs: | |
|
|
||
| - name: Deploy to EC2 | ||
| uses: appleboy/ssh-action@v1.0.3 | ||
| env: | ||
| RESIDENTIAL_PROXY: ${{ secrets.RESIDENTIAL_PROXY }} | ||
| with: | ||
| host: ${{ secrets.EC2_HOST }} | ||
| username: ${{ secrets.EC2_USERNAME }} | ||
| key: ${{ secrets.EC2_SSH_KEY }} | ||
| command_timeout: 20m | ||
| envs: RESIDENTIAL_PROXY | ||
| script: | | ||
| set -e | ||
|
|
||
| echo "========== DEPLOYMENT START: ${{ github.ref_name }} ==========" | ||
|
|
||
| cd /home/ec2-user/crypto_sentiment_crawler | ||
|
|
||
| # If the host still has the legacy Reddit VPN enabled, disable it | ||
| # before the first GitHub/Docker network operation. GitHub fetches | ||
| # can fail through the old VPN path before the normal deploy setup | ||
| # gets a chance to stop wg-quick@wg0. | ||
| if [ -f /opt/crypto-sentiment/.env ] && grep -Eq '^(PROXY_URL|RESIDENTIAL_PROXY)=[^[:space:]]+' /opt/crypto-sentiment/.env; then | ||
| echo "Residential proxy configured; disabling legacy WireGuard before network operations." | ||
| sudo systemctl disable --now wg-quick@wg0 2>/dev/null || true | ||
| fi | ||
| # Disable the legacy Reddit VPN before the first GitHub/Docker | ||
| # network operation. This deploy path now uses an app-level proxy. | ||
| echo "Disabling legacy WireGuard before network operations." | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Previously, WireGuard was only disabled if |
||
| sudo systemctl disable --now wg-quick@wg0 2>/dev/null || true | ||
|
|
||
| # Pull latest code. Preserve any EC2-local edits so deployment can | ||
| # move to the release tag without discarding operational changes. | ||
|
|
@@ -129,6 +128,11 @@ jobs: | |
| sudo chown -R ec2-user:ec2-user /opt/crypto-sentiment | ||
|
|
||
| CRAWLER_ENV_ARGS="" | ||
| CRAWLER_SECRET_ENV_ARGS="" | ||
| if [ -n "$RESIDENTIAL_PROXY" ]; then | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| echo "Residential proxy secret available for crawler." | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Secrets passed via |
||
| CRAWLER_SECRET_ENV_ARGS="-e RESIDENTIAL_PROXY=$RESIDENTIAL_PROXY" | ||
| fi | ||
| if [ -f /opt/crypto-sentiment/.env ]; then | ||
| CRAWLER_ENV_ARGS="--env-file /opt/crypto-sentiment/.env" | ||
| if grep -Eq '^(PROXY_URL|RESIDENTIAL_PROXY)=[^[:space:]]+' /opt/crypto-sentiment/.env; then | ||
|
|
@@ -236,6 +240,7 @@ jobs: | |
| docker run -d --name crypto-crawler --restart unless-stopped \ | ||
| --network crypto-sentiment_crypto-net \ | ||
| $CRAWLER_ENV_ARGS \ | ||
| $CRAWLER_SECRET_ENV_ARGS \ | ||
| -v /opt/crypto-sentiment/data:/app/data \ | ||
| -v /opt/crypto-sentiment/logs:/app/logs \ | ||
| -e DATABASE_PATH=/app/data/sentiment.db \ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
env:+envs:together is the correct pattern for appleboy/ssh-action —envmakes the variable available to the action process, andenvs(comma-separated) tells the action which variables to forward to the remote SSH session. This looks correct.