Skip to content

Provision MS SQL Server on Linux dev VM#577

Merged
javornikolov merged 6 commits intomasterfrom
provision-sqlserver-on-dev-vm
May 25, 2017
Merged

Provision MS SQL Server on Linux dev VM#577
javornikolov merged 6 commits intomasterfrom
provision-sqlserver-on-dev-vm

Conversation

@MMatten
Copy link
Copy Markdown
Contributor

@MMatten MMatten commented May 24, 2017

Pulls SQL Server from MS package repository, installs, configures and creates acceptance testing objects during gradle integrationTest and integrationBuild tasks.

@MMatten
Copy link
Copy Markdown
Contributor Author

MMatten commented May 24, 2017

Note that because of the existing issues in master we won't see a clean build of this branch yet.

@@ -0,0 +1,231 @@
USE FitNesseTestDB
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file seems to have window-style end of lines. Now that we're on Linux - would it be possible to convert it to Unix style (dos2unix)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, indeed.

GO

CREATE USER [FitNesseUser] FOR LOGIN [FitNesseUser] WITH DEFAULT_SCHEMA = [dbo]
GO
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a trailing whitespace at this line.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed this one too.

@@ -0,0 +1,26 @@
ALTER DATABASE DbFit SET SINGLE_USER WITH ROLLBACK IMMEDIATE
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows style EOL here too.

Comment thread dbfit-java/build.gradle
ext.dbdeploy = { dbDriver, url, userid, password, delimiterType = 'normal' ->
ext.dbdeploy = {
dbDriver, url, userid, password, delimiterType = 'normal', delimiter = ';',
dir = "$projectDir/src/integration-test/resources" ->
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will dbdeploy pick only script filenames starting with some digits (as we already have some .sql scripts under resources).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant to delete those other scripts. Yes, dbdeploy only picks up scripts that start with a number.

@MMatten MMatten force-pushed the provision-sqlserver-on-dev-vm branch from 45e6631 to ddc4020 Compare May 24, 2017 20:34
@javornikolov
Copy link
Copy Markdown
Contributor

Perhaps it's good to update CONTRIBUTING.md.

sql_dir = File.join(node['dbfit']['project_root'], "test_vm/scripts/sqlserver/sql")

execute 'create databases' do
command "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P DbFit000! -b -i #{sql_dir}/create-databases-sqlserver.sql"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it OK that we don't have some kind of not_if expression here? What would happen if we re-run VM provisioning?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it OK that we don't have some kind of not_if expression here? What would happen if we re-run VM provisioning?

I'd have to check the SQL Server DBs to see if this had already been run, using a SQL script and perhaps a shell script wrapper.

Alternatively I can add IF NOT EXISTS (SELECT 1 FROM master.sys.databases WHERE name = ...) CREATE DATABASE....

It would be more complex for the users and role grants, etc.

The other option would be for provisioning to destroy anything if finds already existing and recreate them. That's not so good.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other option would be for provisioning to destroy anything if finds already existing and recreate them. That's not so good.

What about checking just for single thing - e.g. the changelog table. If it exists - then skip attempt for re-provisioning.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a check for the changelog table now. Please review again.

@MMatten MMatten force-pushed the provision-sqlserver-on-dev-vm branch from ddc4020 to f18da75 Compare May 24, 2017 20:42

package 'mssql-server'

ENV['SA_PASSWORD'] = 'DbFit000!'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're using the same password in multiple places, can we reuse it at least within the same script?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're using the same password in multiple places, can we reuse it at least within the same script?

Updated.

@MMatten
Copy link
Copy Markdown
Contributor Author

MMatten commented May 24, 2017

Perhaps it's good to update CONTRIBUTING.md.

Done.

@MMatten MMatten force-pushed the provision-sqlserver-on-dev-vm branch 3 times, most recently from 1644e99 to 5b4a554 Compare May 25, 2017 21:30
@MMatten MMatten force-pushed the provision-sqlserver-on-dev-vm branch from 5b4a554 to de8b49c Compare May 25, 2017 21:33
@MMatten
Copy link
Copy Markdown
Contributor Author

MMatten commented May 25, 2017

Rebased and force pushed.

@javornikolov
Copy link
Copy Markdown
Contributor

Awesome :-) It looks great now 👍, I'm merging it. Thank you @MMatten - it's really useful to finally have that "outsider" in the VM!

@javornikolov javornikolov added this to the Next milestone May 25, 2017
@javornikolov javornikolov merged commit 3fe82bc into master May 25, 2017
@javornikolov javornikolov deleted the provision-sqlserver-on-dev-vm branch May 25, 2017 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants