[PR #1995] [MERGED] Fix: Display setup token after CrowdSec installation #2808

Closed
opened 2026-04-16 09:37:14 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fosrl/pangolin/pull/1995
Author: @Copilot
Created: 12/6/2025
Status: Merged
Merged: 12/6/2025
Merged by: @oschwartz10612

Base: mainHead: copilot/fix-crowdsec-setup-token


📝 Commits (3)

  • 1aa155a Initial plan
  • d7311ad Add setup token printing after CrowdSec installation
  • 69561ca Fix setup token display condition to include CrowdSec installation

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 install/main.go (+1 -1)

📄 Description

Community Contribution License Agreement

By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.

Description

When CrowdSec is installed (either during initial installation or on an existing installation), the installer stops containers, reconfigures the stack, and restarts them. The setup token was not displayed after this restart, forcing users to tail logs manually.

Root Cause: The setup token printing section only executed when !alreadyInstalled was true, which excluded the case where CrowdSec is installed on an existing system.

Solution: Updated the conditional check in install/main.go to also run when CrowdSec is installed by checking the config.DoCrowdsecInstall flag.

Changes Made

  • install/main.go: Modified the condition on line 245 from if !alreadyInstalled { to if !alreadyInstalled || config.DoCrowdsecInstall {

This ensures the existing setup token printing logic runs in both scenarios:

  1. Fresh installations
  2. When CrowdSec is added to an existing installation

The fix leverages the existing infrastructure and config.DoCrowdsecInstall flag that is set to true when CrowdSec installation is performed, ensuring users receive the setup token immediately after CrowdSec installation completes.

How to test?

  1. Test on fresh installation with CrowdSec:

    • Run the installer on a clean system
    • Choose to install CrowdSec when prompted
    • Verify the setup token is displayed in the terminal output
  2. Test on existing installation adding CrowdSec:

    • Run the installer on a system with existing Pangolin installation
    • Choose to install CrowdSec when prompted
    • Verify the setup token is displayed in the terminal output after CrowdSec installation completes
  3. Build verification:

    • cd install && go build -o bin/installer_test .
    • Verify compilation succeeds with no errors
Original prompt

This section details on the original issue you should resolve

<issue_title>No setup token created when installing with crowdsec</issue_title>
<issue_description>### Describe the Bug

When I install with crowdsec no token is created OR no token is in my terminal

Environment

  • OS Type & Version: (e.g., Ubuntu 22.04)
  • Pangolin Version: 1.12.2
  • Gerbil Version: 1.2.2
  • Traefik Version: v3.5

To Reproduce

Just install pangolin and when it asks if you want to install crowdsec choose yes

Expected Behavior

No setup token should be created</issue_description>

<agent_instructions>this is in the installer in install/main.go. WHen they choose to install crowdsec it takes down the docker stack and brings it back up. When this happens we should run the code that prints out the setup token so that they can setup the instance. </agent_instructions>

Comments on the Issue (you are @copilot in this section)

@oschwartz10612 Seems indeed to be a bug. You can bypass this by tailing the logs to get the token for now

docker compose logs -f pangolin


Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/fosrl/pangolin/pull/1995 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 12/6/2025 **Status:** ✅ Merged **Merged:** 12/6/2025 **Merged by:** [@oschwartz10612](https://github.com/oschwartz10612) **Base:** `main` ← **Head:** `copilot/fix-crowdsec-setup-token` --- ### 📝 Commits (3) - [`1aa155a`](https://github.com/fosrl/pangolin/commit/1aa155a0afded86a8c8bf91850faff8f886c36ea) Initial plan - [`d7311ad`](https://github.com/fosrl/pangolin/commit/d7311ad947d954aa61c04814edb126ccddf091a7) Add setup token printing after CrowdSec installation - [`69561ca`](https://github.com/fosrl/pangolin/commit/69561caa74527ab9df8fabb22d49aa1e6e5b1f2f) Fix setup token display condition to include CrowdSec installation ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `install/main.go` (+1 -1) </details> ### 📄 Description ## Community Contribution License Agreement By creating this pull request, I grant the project maintainers an unlimited, perpetual license to use, modify, and redistribute these contributions under any terms they choose, including both the AGPLv3 and the Fossorial Commercial license terms. I represent that I have the right to grant this license for all contributed content. ## Description When CrowdSec is installed (either during initial installation or on an existing installation), the installer stops containers, reconfigures the stack, and restarts them. The setup token was not displayed after this restart, forcing users to tail logs manually. **Root Cause**: The setup token printing section only executed when `!alreadyInstalled` was true, which excluded the case where CrowdSec is installed on an existing system. **Solution**: Updated the conditional check in `install/main.go` to also run when CrowdSec is installed by checking the `config.DoCrowdsecInstall` flag. ### Changes Made - **`install/main.go`**: Modified the condition on line 245 from `if !alreadyInstalled {` to `if !alreadyInstalled || config.DoCrowdsecInstall {` This ensures the existing setup token printing logic runs in both scenarios: 1. Fresh installations 2. When CrowdSec is added to an existing installation The fix leverages the existing infrastructure and `config.DoCrowdsecInstall` flag that is set to `true` when CrowdSec installation is performed, ensuring users receive the setup token immediately after CrowdSec installation completes. ## How to test? 1. **Test on fresh installation with CrowdSec**: - Run the installer on a clean system - Choose to install CrowdSec when prompted - Verify the setup token is displayed in the terminal output 2. **Test on existing installation adding CrowdSec**: - Run the installer on a system with existing Pangolin installation - Choose to install CrowdSec when prompted - Verify the setup token is displayed in the terminal output after CrowdSec installation completes 3. **Build verification**: - `cd install && go build -o bin/installer_test .` - Verify compilation succeeds with no errors <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>No setup token created when installing with crowdsec</issue_title> > <issue_description>### Describe the Bug > > When I install with crowdsec no token is created OR no token is in my terminal > > ### Environment > > - OS Type & Version: (e.g., Ubuntu 22.04) > - Pangolin Version: 1.12.2 > - Gerbil Version: 1.2.2 > - Traefik Version: v3.5 > > ### To Reproduce > > Just install pangolin and when it asks if you want to install crowdsec choose yes > > ### Expected Behavior > > No setup token should be created</issue_description> > > <agent_instructions>this is in the installer in install/main.go. WHen they choose to install crowdsec it takes down the docker stack and brings it back up. When this happens we should run the code that prints out the setup token so that they can setup the instance. </agent_instructions> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > <comment_new><author>@oschwartz10612</author><body> > Seems indeed to be a bug. You can bypass this by tailing the logs to get > the token for now > > docker compose logs -f pangolin > </body></comment_new> > </comments> > </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes fosrl/pangolin#1903 <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/fosrl/pangolin/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-16 09:37:14 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/pangolin#2808