Skip to content
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

feat: upgrade Dockerfile to Debian 12, update add-on files from upstream, fixes #24 #37

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

45 changes: 45 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: 🐞 Bug report or Support Request
description: Create a report to help us improve.
labels: [bug]
body:
- type: checkboxes
attributes:
label: Preliminary checklist
description: Please complete the following checks before submitting an issue.
options:
- label: I am using the latest stable version of DDEV
required: true
- label: I am using the latest stable version of this add-on
required: true
- type: textarea
attributes:
label: Expected Behavior
description: What did you expect to happen?
validations:
required: true
- type: textarea
attributes:
label: Actual Behavior
description: What actually happened instead?
validations:
required: true
- type: textarea
attributes:
label: Steps To Reproduce
description: Specific steps to reproduce the behavior.
placeholder: |
1. In this environment...
2. With this config...
3. Run `...`
4. See error...
validations:
required: false
- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Screenshots? Anything that will give us more context about your issue!

💡 Attach images or log files by clicking this area to highlight it and dragging files in.
validations:
required: false
20 changes: 0 additions & 20 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: 🚀 Feature request
description: Suggest an idea for this project.
labels: [enhancement]
body:
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search existing issues to see if one already exists for your request.
options:
- label: I have searched the existing issues
required: true
- type: textarea
attributes:
label: Is your feature request related to a problem?
description: Clearly and concisely describe the problem. (Ex. I'm always frustrated when...)
validations:
required: true
- type: textarea
attributes:
label: Describe your solution
description: Clearly and concisely describe what you want to happen.
validations:
required: true
- type: textarea
attributes:
label: Describe alternatives
description: Clearly and concisely describe any alternative solutions or features you've considered.
validations:
required: false
- type: textarea
attributes:
label: Additional context
description: Add any other context or screenshots about the feature request.
validations:
required: false
17 changes: 17 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## The Issue

- #<issue number>

<!-- Provide a brief description of the issue. -->

## How This PR Solves The Issue

## Manual Testing Instructions

## Automated Testing Overview

<!-- Please describe the tests introduced by this PR, or explain why no tests are needed. -->

## Release/Deployment Notes

<!-- Does this affect anything else or have ramifications for other code? Does anything have to be done on deployment? -->
20 changes: 6 additions & 14 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,22 @@ on:
required: false
default: false

# Required permissions for keep-alive, used by ddev/github-action-add-on-test
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# This is required for "gautamkrishnar/keepalive-workflow", see "ddev/github-action-add-on-test"
permissions:
actions: write

defaults:
run:
shell: bash

jobs:
tests:
defaults:
run:
shell: bash

strategy:
matrix:
ddev_version: [stable, HEAD]
fail-fast: false

# We need to use the ubuntu-20.04 image because the sqlsrv service uses the
# mcr.microsoft.com/mssql/server:2019-CU12-ubuntu-20.04 image.
# See the issue https://github.com/ddev/ddev-sqlsrv/issues/29 for more
# details.
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- uses: ddev/github-action-add-on-test@v2
Expand Down
37 changes: 20 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![tests](https://github.com/ddev/ddev-sqlsrv/actions/workflows/tests.yml/badge.svg)](https://github.com/ddev/ddev-sqlsrv/actions/workflows/tests.yml) ![project is maintained](https://img.shields.io/maintenance/yes/2024.svg)
[![tests](https://github.com/ddev/ddev-sqlsrv/actions/workflows/tests.yml/badge.svg)](https://github.com/ddev/ddev-sqlsrv/actions/workflows/tests.yml) ![project is maintained](https://img.shields.io/maintenance/yes/2025.svg)

# ddev-sqlsrv <!-- omit in toc -->

Expand All @@ -20,32 +20,35 @@ Some workarounds are described in the following threads:

**Due to lack of upstream support, this add-on can only be used with amd64 machines, and is not usable on arm64 machines like Apple Silicon computers.**

For DDEV v1.23.5 or above run

```bash
ddev add-on get ddev/ddev-sqlsrv
ddev restart
```

For earlier versions of DDEV run
Used defaults:

```bash
ddev get ddev/ddev-sqlsrv
```dotenv
MSSQL_DOCKER_IMAGE=mcr.microsoft.com/mssql/server:2022-CU17-ubuntu-22.04
MSSQL_EXTERNAL_PORT=1433
MSSQL_SA_PASSWORD=Password12!
MSSQL_PID=Evaluation
MSSQL_DB_NAME=master
MSSQL_HOST=sqlsrv
MSSQL_COLLATION=LATIN1_GENERAL_100_CI_AS_SC_UTF8
```

Then restart your project
If you want to override them, for example, use a different port:

```bash
ddev dotenv set .ddev/.env.sqlsrv --mssql-external-port=1434
ddev restart
```

If your project already has a `.ddev/.env` file, you need to add the following lines to it:
Or change the password:

```dotenv
MSSQL_EXTERNAL_PORT=1433
MSSQL_SA_PASSWORD=Password12!
MSSQL_PID=Evaluation
MSSQL_DB_NAME=master
MSSQL_HOST=sqlsrv
```bash
ddev dotenv set .ddev/.env.sqlsrv --mssql-sa-password='myNewPassword'
ddev restart
```

## Drupal Notice
Expand Down Expand Up @@ -73,12 +76,12 @@ ddev composer require drupal/sqlsrv

## Manually enabling MySQL/MariaDB

**This addons disables the default database by automatically adding `omit_containers: [db,dba]` in the `config.sqlsrv.yaml`**
**This addons disables the default database by automatically adding `omit_containers: [db]` in the `config.sqlsrv.yaml`**

If your project needs to use both MariaDB and MS SQL Server databases, you have to remove `#ddev-generated` and
`omit_containers: [db,dba]` from `config.sqlsrv.yaml`.
`omit_containers: [db]` from `config.sqlsrv.yaml`.

See [.ddev/config.yaml Options](https://ddev.readthedocs.io/en/stable/users/extend/config_yaml/) for additional notes.
See [Config Options](https://ddev.readthedocs.io/en/stable/users/configuration/config/) for additional notes.

## Links with useful information

Expand Down
8 changes: 4 additions & 4 deletions commands/sqlsrv/drupal-regex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

## #ddev-generated
## Description: Installs the Regex database function for compatibility with Drupal version 9 or higher.
Expand All @@ -14,8 +14,8 @@ then
fi

# The following are changed to allow the installation and execution of the user provided database function.
/opt/mssql-tools/bin/sqlcmd -P ${MSSQL_SA_PASSWORD} -U SA -d ${MSSQL_DB_NAME} -Q 'EXEC sp_configure "show advanced options", 1; RECONFIGURE; EXEC sp_configure "clr strict security", 0; RECONFIGURE; EXEC sp_configure "clr enable", 1; RECONFIGURE;'
/opt/mssql-tools18/bin/sqlcmd -P ${MSSQL_SA_PASSWORD} -U SA -C -d ${MSSQL_DB_NAME} -Q 'EXEC sp_configure "show advanced options", 1; RECONFIGURE; EXEC sp_configure "clr strict security", 0; RECONFIGURE; EXEC sp_configure "clr enable", 1; RECONFIGURE;'

# Create the assambly and the function for the Regex helper.
/opt/mssql-tools/bin/sqlcmd -P ${MSSQL_SA_PASSWORD} -U SA -d ${MSSQL_DB_NAME} -Q 'CREATE ASSEMBLY Regex from "/RegEx.dll" WITH PERMISSION_SET = SAFE'
/opt/mssql-tools/bin/sqlcmd -P ${MSSQL_SA_PASSWORD} -U SA -d ${MSSQL_DB_NAME} -Q 'CREATE FUNCTION dbo.REGEXP(@pattern NVARCHAR(100), @matchString NVARCHAR(100)) RETURNS bit EXTERNAL NAME Regex.RegExCompiled.RegExCompiledMatch'
/opt/mssql-tools18/bin/sqlcmd -P ${MSSQL_SA_PASSWORD} -U SA -C -d ${MSSQL_DB_NAME} -Q 'CREATE ASSEMBLY Regex from "/RegEx.dll" WITH PERMISSION_SET = SAFE'
/opt/mssql-tools18/bin/sqlcmd -P ${MSSQL_SA_PASSWORD} -U SA -C -d ${MSSQL_DB_NAME} -Q 'CREATE FUNCTION dbo.REGEXP(@pattern NVARCHAR(100), @matchString NVARCHAR(100)) RETURNS bit EXTERNAL NAME Regex.RegExCompiled.RegExCompiledMatch'
4 changes: 2 additions & 2 deletions commands/sqlsrv/sqlcmd
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash
#!/usr/bin/env bash

## #ddev-generated
## Description: The sqlcmd utility lets you enter Transact-SQL statements, system procedures, and script files.
## Usage: sqlcmd
## Example: "ddev sqlcmd"

/opt/mssql-tools/bin/sqlcmd -P ${MSSQL_SA_PASSWORD} -U SA -d ${MSSQL_DB_NAME}
/opt/mssql-tools18/bin/sqlcmd -P ${MSSQL_SA_PASSWORD} -U SA -C -d ${MSSQL_DB_NAME} $@
6 changes: 3 additions & 3 deletions config.sqlsrv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ disable_settings_management: true
omit_containers: [db]

hooks:
post-start:
- exec: echo export PATH="$PATH:/opt/mssql-tools/bin" >> ~/.bashrc
- exec: source ~/.bashrc
post-start:
- exec: echo export PATH="$PATH:/opt/mssql-tools18/bin" >> ~/.bashrc
- exec: source ~/.bashrc
19 changes: 7 additions & 12 deletions docker-compose.sqlsrv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@
services:
sqlsrv:
container_name: ddev-${DDEV_SITENAME}-sqlsrv
hostname: ddev-${DDEV_SITENAME}-sqlsrv

# For available options look at https://hub.docker.com/_/microsoft-mssql-server.
# This image that does not work with Apple M1 yet. For more details:
# - https://github.com/microsoft/mssql-docker/issues/734
# - https://github.com/microsoft/mssql-docker/issues/802
image: mcr.microsoft.com/mssql/server:2019-CU12-ubuntu-20.04
image: ${MSSQL_DOCKER_IMAGE:-mcr.microsoft.com/mssql/server:2022-CU17-ubuntu-22.04}

user: root
volumes:
- sqlsystem:/var/opt/mssql/
- .:/mnt/ddev_config
restart: "no"
ports:
- "${MSSQL_EXTERNAL_PORT}:1433"
- "${MSSQL_EXTERNAL_PORT:-1433}:1433"
labels:
com.ddev.site-name: ${DDEV_SITENAME}
com.ddev.approot: $DDEV_APPROOT
Expand All @@ -31,27 +30,23 @@ services:
# As a result you cannot login with the "SA" user account.
# The password for the SA account needs to follow the following policy:
# https://learn.microsoft.com/en-us/sql/relational-databases/security/password-policy?view=sql-server-ver16
- MSSQL_SA_PASSWORD=$MSSQL_SA_PASSWORD
- MSSQL_SA_PASSWORD=${MSSQL_SA_PASSWORD:-Password12!}

# The following setting is for selecting the SQL Server edition or product
# key. For possible options:
# https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-configure-environment-variables?view=sql-server-ver16
- MSSQL_PID=$MSSQL_PID
- MSSQL_HOST=$MSSQL_HOST
- MSSQL_PID=${MSSQL_PID:-Developer}
- MSSQL_HOST=${MSSQL_HOST:-sqlsrv}
- MSSQL_TCP_PORT=1433
- MSSQL_DB_NAME=$MSSQL_DB_NAME
- MSSQL_DB_NAME=${MSSQL_DB_NAME:-master}

# Sets the default collation for SQL Server. This setting is optional. The
# current setting is best for Drupal projects. For more information, see:
# https://docs.microsoft.com/en-us/sql/relational-databases/collations/collation-and-unicode-support?view=sql-server-ver16
- MSSQL_COLLATION=LATIN1_GENERAL_100_CI_AS_SC_UTF8
- MSSQL_COLLATION=${MSSQL_COLLATION:-LATIN1_GENERAL_100_CI_AS_SC_UTF8}

# For more possible environment variables that can be set, see:
# https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-configure-environment-variables?view=sql-server-ver16

web:
links:
- sqlsrv:sqlsrv

volumes:
sqlsystem:
Binary file removed images/template-button.png
Binary file not shown.
Loading