Skip to content

Latest commit

 

History

History
158 lines (110 loc) · 5.35 KB

Environment-Setup.md

File metadata and controls

158 lines (110 loc) · 5.35 KB

Environment Setup

.NET Dev Certs

This project runs over https which can be configured locally using the .NET SDK:

dotnet dev-certs https --trust

Troubleshooting

Long paths on Windows

When you clone the repository from Git and you are using Windows you might run into a problem that Git cannot create files that have really long paths. This would most likely happen in src/Kentico.Community.Portal.Web/App_Data/CIRepository because some of the sub-folder names are very long.

To fix this issue, enable long path support in Windows with Git configuration, or with Group Policy or a registry key change.

ASP.NET Core Dev Certs

If you have issues with the Admin client Webpack dev server using the ASP.NET Core dev cert, you might have a cert on the filesystem being used by the webpack dev server that is no longer trusted. This can be caused by running dotnet dev-certs https --clean and then dotnet dev-certs https --trust. This will install a new dev cert and the previous cert, which webpack exported, is no longer valid.

To resolve this you can explicitly run the following commands to re-generate the certificates.

On Windows:

dotnet dev-certs https --format pem --no-password --export-path "$env:APPDATA/ASP.NET/https/kentico-community-portal-web-admin.pem"

On MacOS/Linux

dotnet dev-certs https --format pem --no-password -ep $HOME/.aspnet/https/kentico-community-portal-web-admin.pem

These are the commands that are automatically executed for you if no local certs exist when starting up the Admin local dev Node.js script (details in ~\src\Kentico.Community.Portal.Admin\Client\webpack.config.js).

Restore Database

  • Database backups are located in the .\database folder

    • .bacpac (database snapshot archive)

    • .bak (data + full transaction logs)

    • Note: The database backup listed on the first line of the .\database\backups.txt file is the most recent backup and should be used as a starting point for a newly set up project.

  • PowerShell

    1. Use the Restore-Database.ps1 script (.bacpac files only)

      cd .\scripts
      
      .\Restore-Database.ps1 `
      -ServerName "<server name>" `
      -DatabaseName "<database name>" `
      -BacpacFile "<filename.bacpac>" `
      -WorkspaceFolder $PWD
  • (alternative) Azure Data Studio

    1. Restore a .bacpac file (data + schema)
    2. Restore a .bak file
  • (alternative) Add database in SQL Server Management Studio

    • Restore a .bacpac file

    • (alternative) Restore a .bak file

      1. Launch SQL SSMS

      2. Extract backup file might require from .zip

        • .\database\<database-backup.zip>
      3. Restore database

        • Right click on 'Databases'
        • 'Restore Database'
        • Select source 'Device' -> ...-> 'Add'
        • Select .bak from .\database\<database-backup.bak> -> OK
      4. Add User mapping

        • 'Security' -> 'Logins'
        • Right click on your account
        • 'Properties' -> 'User Mapping' -> tick Kentico.Community -> tick 'db owner' -> OK
  • (alternative) Using MacOS/Linux

    1. Use Docker Desktop to setup a MS SQL Server docker container to run the Xperience by Kentico database

      docker run + `
       --name mssql2022 + `
       --hostname=localhost + `
       --user=mssql + `
       --env=ACCEPT_EULA=Y + `
       --env=MSSQL_SA_PASSWORD=Pass@12345 + `
       -p 1433:1433 + `
       -d mcr.microsoft.com/mssql/server:2022-latest
    2. Unzip the .bak.zip in ./database

      Expand-Archive -Path ./database/Kentico.Community-29.0.3-2024-05-14.bak.zip -DestinationPath ./database
    3. Copy the unzip'd .bak file into your docker container (using the correct file path)

      docker cp ./database/Kentico.Community-29.0.3-2024-05-14.bak mssql2022:/var/opt/mssql/data
    4. Use Azure Data Studio to restore the .bak -> command click "Databases" node under SQL Server -> Restore

Configure Application

  1. Open .\Kentico.Community.Portal.sln OR open folder directly from VS Code.

    If using VS Code, install all recommended extensions

  2. Set your database Connection String in your local User Secrets

  3. Disable ReCaptcha validation in your local User Secrets (see settings for ReCaptcha in appsettings.CI.json) or supply a localhost ReCaptcha v3 key/secret