sql_server.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Use of this software is governed by the Business Source License
  4. # included in the LICENSE file at the root of this repository.
  5. #
  6. # As of the Change Date specified in that file, in accordance with
  7. # the Business Source License, use of this software will be governed
  8. # by the Apache License, Version 2.0.
  9. from materialize.mzcompose.service import (
  10. Service,
  11. )
  12. class SqlServer(Service):
  13. DEFAULT_USER = "SA"
  14. DEFAULT_SA_PASSWORD = "RPSsql12345"
  15. def __init__(
  16. self,
  17. # The password must be at least 8 characters including uppercase,
  18. # lowercase letters, base-10 digits and/or non-alphanumeric symbols.
  19. sa_password: str = DEFAULT_SA_PASSWORD,
  20. name: str = "sql-server",
  21. # 2017 mssql images core on OSx, 2019 is the earliest that has passed
  22. image: str = "mcr.microsoft.com/mssql/server:2019-CU32-ubuntu-20.04",
  23. environment_extra: list[str] = [],
  24. volumes_extra: list[str] = [],
  25. ) -> None:
  26. super().__init__(
  27. name=name,
  28. config={
  29. "image": image,
  30. "ports": [1433],
  31. "volumes": volumes_extra,
  32. "environment": [
  33. "ACCEPT_EULA=Y",
  34. "MSSQL_PID=Developer",
  35. "MSSQL_AGENT_ENABLED=True",
  36. f"SA_PASSWORD={sa_password}",
  37. *environment_extra,
  38. ],
  39. },
  40. )
  41. self.sa_password = sa_password