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

Remove deprecated env SA_PASSWORD use MSSQL_SA_PASSWORD instead #879

Open
wants to merge 1 commit into
base: master
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
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/mssql-docker.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion linux/preview/CentOS/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ LABEL name="microsoft/mssql-server-linux" \
### Required labels above - recommended below
url="https://www.microsoft.com/en-us/sql-server/" \
run='docker run --name ${NAME} \
-e ACCEPT_EULA=Y -e SA_PASSWORD=yourStrong@Password \
-e ACCEPT_EULA=Y -e MSSQL_SA_PASSWORD=yourStrong@Password \
-p 1433:1433 \
-d ${IMAGE}' \
io.k8s.description="MS SQL Server is ....." \
Expand Down
8 changes: 4 additions & 4 deletions linux/preview/CentOS/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ TARGET = centos7
REGISTRY = docker-registry.default.svc.cluster.local
OC_USER = developer
OC_PASS = developer
SA_PASSWORD = yourStrong@Password
MSSQL_SA_PASSWORD = yourStrong@Password

all: build
build:
Expand All @@ -16,15 +16,15 @@ lint:
dockerfile_lint -f Dockerfile

test:
$(eval CONTAINERID=$(shell docker run -e ACCEPT_EULA=Y -e SA_PASSWORD=${SA_PASSWORD} -d ${CONTEXT}/${IMAGE_NAME}:${TARGET}-${VERSION}))
$(eval CONTAINERID=$(shell docker run -e ACCEPT_EULA=Y -e MSSQL_SA_PASSWORD=${MSSQL_SA_PASSWORD} -d ${CONTEXT}/${IMAGE_NAME}:${TARGET}-${VERSION}))
@sleep 2
@docker exec ${CONTAINERID} ps aux
@sleep 20
@docker exec ${CONTAINERID} sqlcmd -S localhost -U SA -P ${SA_PASSWORD} -Q "sp_databases"
@docker exec ${CONTAINERID} sqlcmd -S localhost -U SA -P ${MSSQL_SA_PASSWORD} -Q "sp_databases"
@docker rm -f ${CONTAINERID}

run:
docker run -e ACCEPT_EULA=Y -e SA_PASSWORD=${SA_PASSWORD} -p 1433:1433 -d ${CONTEXT}/${IMAGE_NAME}:${TARGET}-${VERSION}
docker run -e ACCEPT_EULA=Y -e MSSQL_SA_PASSWORD=${MSSQL_SA_PASSWORD} -p 1433:1433 -d ${CONTEXT}/${IMAGE_NAME}:${TARGET}-${VERSION}

clean:
rm -f build
8 changes: 4 additions & 4 deletions linux/preview/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ $ make run
- At least 3.25 GB of RAM. Make sure to assign enough memory to the Docker VM if you're running on Docker for [Mac](https://docs.docker.com/docker-for-mac/#/general) or [Windows](https://docs.docker.com/docker-for-windows/#/advanced).
- Requires the following environment flags
- ACCEPT_EULA=Y
- SA_PASSWORD=<your_strong_password>
- MSSQL_SA_PASSWORD=<your_strong_password>
- A strong system administrator (SA) password: At least 8 characters including uppercase, lowercase letters, base-10 digits and/or non-alphanumeric symbols.

# How to use this image
---
## Start a mssql-server instance
> ``docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=yourStrong(!)Password' -p 1433:1433 -d microsoft/mssql-server-linux``
> ``docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=yourStrong(!)Password' -p 1433:1433 -d microsoft/mssql-server-linux``

## Connect to Microsoft SQL Server
Starting with the CTP 1.4 (March 17, 2017) release the mssql-tools package including sqlcmd, bcp are included in the image. You can connect to the SQL Server using the sqlcmd tool inside of the container by using the following command on the host:
Expand All @@ -69,7 +69,7 @@ You can connect to the SQL Server instance in the container from outside the con
## Environment variables

- ACCEPT_EULA confirms acceptance of the [End-User Licensing Agreement](http://go.microsoft.com/fwlink/?LinkId=746388).
- SA_PASSWORD is the database system administrator (userid = 'sa') password used to connect to SQL Server once the container is running.
- MSSQL_SA_PASSWORD is the database system administrator (userid = 'sa') password used to connect to SQL Server once the container is running.

Additional, optional environment variables are documented in the [product documentation](https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-configure-environment-variables).

Expand All @@ -87,7 +87,7 @@ Additional, optional environment variables are documented in the [product docume
---
- **How do I map a volume using Docker for Windows?** Make sure to enable [shared drives in the settings menu](https://docs.docker.com/docker-for-windows/#shared-drives). After that, you can map a volume specifying the **Windows path:Linux path**. The following is an example of a command to map a Windows folder to the data directory in the container:

> ``docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=yourStrong(!)Password' -p 1433:1433 -v C:\MyWindowsVolume:/var/opt/mssql -d microsoft/mssql-server-linux``
> ``docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=yourStrong(!)Password' -p 1433:1433 -v C:\MyWindowsVolume:/var/opt/mssql -d microsoft/mssql-server-linux``

# Further reading
---
Expand Down
2 changes: 1 addition & 1 deletion linux/preview/RHEL/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ LABEL name="microsoft/mssql-server-linux" \
### Required labels above - recommended below
url="https://www.microsoft.com/en-us/sql-server/" \
run='docker run --name ${NAME} \
-e ACCEPT_EULA=Y -e SA_PASSWORD=yourStrong@Password \
-e ACCEPT_EULA=Y -e MSSQL_SA_PASSWORD=yourStrong@Password \
-p 1433:1433 \
-d ${IMAGE}' \
io.k8s.description="MS SQL Server is ....." \
Expand Down
8 changes: 4 additions & 4 deletions linux/preview/RHEL/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ TARGET = rhel7
REGISTRY = docker-registry.default.svc.cluster.local
OC_USER = developer
OC_PASS = developer
SA_PASSWORD = yourStrong@Password
MSSQL_SA_PASSWORD = yourStrong@Password

all: build
build:
Expand All @@ -16,15 +16,15 @@ lint:
dockerfile_lint -f Dockerfile

test:
$(eval CONTAINERID=$(shell docker run -e ACCEPT_EULA=Y -e SA_PASSWORD=${SA_PASSWORD} -d ${CONTEXT}/${IMAGE_NAME}:${TARGET}-${VERSION}))
$(eval CONTAINERID=$(shell docker run -e ACCEPT_EULA=Y -e MSSQL_SA_PASSWORD=${MSSQL_SA_PASSWORD} -d ${CONTEXT}/${IMAGE_NAME}:${TARGET}-${VERSION}))
@sleep 2
@docker exec ${CONTAINERID} ps aux
@sleep 20
@docker exec ${CONTAINERID} sqlcmd -S localhost -U SA -P ${SA_PASSWORD} -Q "sp_databases"
@docker exec ${CONTAINERID} sqlcmd -S localhost -U SA -P ${MSSQL_SA_PASSWORD} -Q "sp_databases"
@docker rm -f ${CONTAINERID}

run:
docker run -e ACCEPT_EULA=Y -e SA_PASSWORD=${SA_PASSWORD} -p 1433:1433 -d ${CONTEXT}/${IMAGE_NAME}:${TARGET}-${VERSION}
docker run -e ACCEPT_EULA=Y -e MSSQL_SA_PASSWORD=${MSSQL_SA_PASSWORD} -p 1433:1433 -d ${CONTEXT}/${IMAGE_NAME}:${TARGET}-${VERSION}

clean:
rm -f build
2 changes: 1 addition & 1 deletion linux/preview/SLES/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
```
4. Run the docker image.
```
sudo docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=<YourStrong!Passw0rd>' \
sudo docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=<YourStrong!Passw0rd>' \
-p 1433:1433 --name sql1 \
-d mssql-sles-tools-nonroot
```
4 changes: 2 additions & 2 deletions linux/preview/examples/mssql-customize/configure-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ i=0

while [[ $DBSTATUS -ne 0 ]] && [[ $i -lt 60 ]] && [[ $ERRCODE -ne 0 ]]; do
i=$i+1
DBSTATUS=$(/opt/mssql-tools/bin/sqlcmd -h -1 -t 1 -U sa -P $SA_PASSWORD -Q "SET NOCOUNT ON; Select SUM(state) from sys.databases")
DBSTATUS=$(/opt/mssql-tools/bin/sqlcmd -h -1 -t 1 -U sa -P $MSSQL_SA_PASSWORD -Q "SET NOCOUNT ON; Select SUM(state) from sys.databases")
ERRCODE=$?
sleep 1
done
Expand All @@ -22,5 +22,5 @@ if [ $DBSTATUS -ne 0 ] OR [ $ERRCODE -ne 0 ]; then
fi

# Run the setup script to create the DB and the schema in the DB
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P $SA_PASSWORD -d master -i setup.sql
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P $MSSQL_SA_PASSWORD -d master -i setup.sql

4 changes: 2 additions & 2 deletions linux/preview/examples/mssql-polybase/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
3. Start SQL Server with PolyBase feature.
- Use `docker run` command to run /opt/mssql/bin/sqlservr in an isolated container.
- On bash shell (Linux/macOS/Windows GitBash):
- `$ docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=YourStrong!Passw0rd' -p 1433:1433 -d mssql-polybase-preview`
- `$ docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=YourStrong!Passw0rd' -p 1433:1433 -d mssql-polybase-preview`
- On elevated PowerShell command prompt:
- `PS> docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=YourStrong!Passw0rd" -p 1433:1433 -d mssql-polybase-preview`
- `PS> docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=YourStrong!Passw0rd" -p 1433:1433 -d mssql-polybase-preview`

4. Enable PolyBase feature.
- After SQL Server is started with `docker run` command, PolyBase must be enabled to access its features.
Expand Down
2 changes: 1 addition & 1 deletion linux/preview/openSUSE/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
```
3. Run the docker image.
```
sudo docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=<YourStrong!Passw0rd>' \
sudo docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=<YourStrong!Passw0rd>' \
-p 1433:1433 --name sql1 \
-d mssql-opensuse
```
2 changes: 1 addition & 1 deletion linux/rancher/values.test.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# since a default SA_PASSWORD is not set, this is used for helm lint and helm debug, otherwise unused
# since a default MSSQL_SA_PASSWORD is not set, this is used for helm lint and helm debug, otherwise unused
mssql:
sa:
password: Sfr9nxVVkbMVGTQweKmD
Expand Down
2 changes: 1 addition & 1 deletion linux/sample-helm-chart-statefulset-deployment/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This HELM chart is a sample "as-is" chart provided for reference to help guide w
4. Requires the following variables to be set or changed in the values.yaml file :<br/>
a. Please ensure that you accept the EULA for SQL Server, by changing the value of ACCEPT_EULA.value=y in values.yaml file or set it during the helm install command --set ACCEPT_EULA.value=Y.<br/>
b. Please do choose the right edition of SQL Server that you would like to install you can change the value of the MSSQL_PID.value in the values file to the edition that you want to install or you can also
change it during the helm install command using the option --set MSSQL_PID.value=Enterprise, If you do not pass the flag and do not change it in the yaml, then by default it is going to install developer edition.<br/> c. Also please do provide your customized value for the sa_password, if you do not provide it then by default the sa_password will the value as shown in the below table.<br/>
change it during the helm install command using the option --set MSSQL_PID.value=Enterprise, If you do not pass the flag and do not change it in the yaml, then by default it is going to install developer edition.<br/> c. Also please do provide your customized value for the mssql_sa_password, if you do not provide it then by default the mssql_sa_password will the value as shown in the below table.<br/>

Note: Once you deploy SQL server containers using the chart below, please log into SQL Server using sa account and change the password for sa, this ensures that as DBA you have the control of the sa user and password.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ spec:
value: "{{ .Values.ACCEPT_EULA.value | upper}}"
- name: MSSQL_AGENT_ENABLED
value: "{{ .Values.MSSQL_AGENT_ENABLED.value}}"
- name: SA_PASSWORD
- name: MSSQL_SA_PASSWORD
valueFrom:
secretKeyRef:
name: mssql
key: SA_PASSWORD
key: MSSQL_SA_PASSWORD
volumeMounts:
- name: mssql
mountPath: "/var/opt/mssql"
Expand Down
6 changes: 3 additions & 3 deletions linux/sample-helm-chart/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This HELM chart is a sample "as-is" chart provided for reference to help guide w
4. Requires the following variables to be set or changed in the values.yaml file :<br/>
a. Please ensure that you accept the EULA for SQL Server, by changing the value of ACCEPT_EULA.value=y in values.yaml file or set it during the helm install command --set ACCEPT_EULA.value=Y.<br/>
b. Please do choose the right edition of SQL Server that you would like to install you can change the value of the MSSQL_PID.value in the values file to the edition that you want to install or you can also
change it during the helm install command using the option --set MSSQL_PID.value=Enterprise, If you do not pass the flag and do not change it in the yaml, then by default it is going to install developer edition.<br/> c. Also please do provide your customized value for the sa_password, if you do not provide it then by default the sa_password will the value as shown in the below table.<br/>
change it during the helm install command using the option --set MSSQL_PID.value=Enterprise, If you do not pass the flag and do not change it in the yaml, then by default it is going to install developer edition.<br/> c. Also please do provide your customized value for the mssql_sa_password, if you do not provide it then by default the mssql_sa_password will the value as shown in the below table.<br/>

Note: Once you deploy SQL server containers using the chart below, please log into SQL Server using sa account and change the password as mentioned here, this ensures that as DBA you have the control of the sa user and password.

Expand All @@ -27,7 +27,7 @@ On the client machine where you have the Helm tools installed, download the char
| Values.MSSQL_PID.value | Set the SQL Server edition or product key. please refer environment variable for more details | Developer |
| Values.MSSQL_AGENT_ENABLED.value | Enable SQL Server Agent. For example, 'true' is enabled and 'false' is disabled. By default, agent is disabled. please refer environment variable for more details. | TRUE |
| Values.hostname | The name that you would like to see when you run the select @@servername for the SQL instance running inside the container. | mssqllatest |
| Values.sa_password | Configure the SA user password. | StrongPass1! |
| Values.mssql_sa_password | Configure the SA user password. | StrongPass1! |
| Values.containers.ports.containerPort | Port on which the SQL Server is listening inside the container. | 1433 |
| Values.podSecurityContext.fsgroup | Security context at the pod level. | 10001 |
| Values.service.type | The type of the service to be created within the kubernetes cluster. | LoadBalancer |
Expand Down Expand Up @@ -57,7 +57,7 @@ In this scenario, I am deploying SQL Server containers on a Azure Kubernetes Ser
| deployment.yaml | A manifest file to describing the deployment details for SQL Server. |
| mssqlconfig.yaml | SQL server mssql.conf file and its content that you would like to mount to the SQL Server container. For parameters that you can pass in this file please refer mssql.conf documentation. To modify the mssql.conf settings please modify this file. |
| pvc.yaml | A manifest file that describes the storage class (SC), Persistent volume (PV) and Persistent volume claims (pvc). This will be mounted to the SQL Container and referenced by the deployment.yaml. To make any changes to the sc,pv or pvc please modify this file accordingly. |
| secret.yaml | A manifest file to create secrets to manage the sa_password that will be used to login to the SQL Server container that is deployed. Please modify the value.yaml file to provide your custom sa_password that you will use to login into the SQL Server once deployed. As a security measure please ensure that you change the sa_password once you login to the SQL Server for the first time. |
| secret.yaml | A manifest file to create secrets to manage the mssql_sa_password that will be used to login to the SQL Server container that is deployed. Please modify the value.yaml file to provide your custom mssql_sa_password that you will use to login into the SQL Server once deployed. As a security measure please ensure that you change the mssql_sa_password once you login to the SQL Server for the first time. |
| service.yaml | A manifest file that defines the kubernetes service type and port. Please modify this for any service modification that is needed. |

With this information, and probably after you have modified the required files you are now ready to deploy SQL Server using this chart. From the client machine where you have the helm chart installed, change the
Expand Down
2 changes: 1 addition & 1 deletion linux/sample-helm-chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@ Create the name of the service account to use
Create the name for the SA password secret key.
*/}}
{{- define "mssql.sapassword" -}}
sa_password
mssql_sa_password
{{- end -}}
2 changes: 1 addition & 1 deletion linux/sample-helm-chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
value: "{{ .Values.ACCEPT_EULA.value | upper}}"
- name: MSSQL_AGENT_ENABLED
value: "{{ .Values.MSSQL_AGENT_ENABLED.value}}"
- name: SA_PASSWORD
- name: MSSQL_SA_PASSWORD
valueFrom:
secretKeyRef:
name: mssql-secret
Expand Down
2 changes: 1 addition & 1 deletion linux/sample-helm-chart/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ metadata:
{{- include "mssql-latest.labels" . | nindent 4 }}
type: Opaque
data:
sa_password : {{ .Values.sa_password | b64enc | quote}}
mssql_sa_password : {{ .Values.mssql_sa_password | b64enc | quote}}
2 changes: 1 addition & 1 deletion linux/sample-helm-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ MSSQL_PID:
MSSQL_AGENT_ENABLED:
value: "true"
hostname: mssqllatest
sa_password: "Toughpass1!"
mssql_sa_password: "Toughpass1!"
containers:
ports:
containerPort: 1433
Expand Down