mirror of
https://github.com/docker-training/node-bulletin-board.git
synced 2025-07-01 21:39:31 +08:00
commit
482e19ec78
@ -5,9 +5,13 @@ var log = require('../log');
|
|||||||
log.Logger.debug('Initializing connection to SQL Server: %s', dbConfig.connection.host);
|
log.Logger.debug('Initializing connection to SQL Server: %s', dbConfig.connection.host);
|
||||||
|
|
||||||
var sequelize = new Sequelize(dbConfig.connection.dbName, dbConfig.connection.username, dbConfig.connection.password, {
|
var sequelize = new Sequelize(dbConfig.connection.dbName, dbConfig.connection.username, dbConfig.connection.password, {
|
||||||
dialect: 'mssql',
|
dialect: 'postgres',
|
||||||
host: dbConfig.connection.host,
|
host: dbConfig.connection.host,
|
||||||
port: dbConfig.connection.port,
|
port: dbConfig.connection.port,
|
||||||
|
omitNull: true,
|
||||||
|
define: {
|
||||||
|
timestamps: false
|
||||||
|
},
|
||||||
pool: {
|
pool: {
|
||||||
max: dbConfig.pool.max
|
max: dbConfig.pool.max
|
||||||
},
|
},
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
var dbConfig = module.exports = {};
|
var dbConfig = module.exports = {};
|
||||||
|
|
||||||
dbConfig.connection = {
|
dbConfig.connection = {
|
||||||
username: 'sa',
|
username: 'postgres',
|
||||||
password: 'DockerCon!!!',
|
password: 'DockerCon!!!',
|
||||||
host: 'bb-db',
|
host: 'bb-db',
|
||||||
post: 1433,
|
post: 5432,
|
||||||
dbName: 'BulletinBoard'
|
dbName: 'postgres'
|
||||||
};
|
};
|
||||||
|
|
||||||
dbConfig.pool = {
|
dbConfig.pool = {
|
||||||
|
@ -15,7 +15,9 @@
|
|||||||
"tedious": "^2.0.1",
|
"tedious": "^2.0.1",
|
||||||
"sequelize": "^4.20.1",
|
"sequelize": "^4.20.1",
|
||||||
"prom-client": "^10.2.2",
|
"prom-client": "^10.2.2",
|
||||||
"winston": "3.2.1"
|
"winston": "3.2.1",
|
||||||
|
"pg": "^7.0.0",
|
||||||
|
"pg-hstore": "^2.3.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"body-parser": "^1.14.1",
|
"body-parser": "^1.14.1",
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
FROM microsoft/mssql-server-linux:2017-CU13
|
FROM postgres:9.6
|
||||||
|
|
||||||
ENV ACCEPT_EULA=Y \
|
ENV MSSQL_SA_PASSWORD=DockerCon!!!
|
||||||
MSSQL_SA_PASSWORD=DockerCon!!!
|
|
||||||
|
|
||||||
WORKDIR /init
|
COPY init-db.sh /docker-entrypoint-initdb.d/init-db.sh
|
||||||
COPY init-db.* ./
|
|
||||||
|
|
||||||
RUN chmod +x ./init-db.sh
|
|
||||||
RUN /opt/mssql/bin/sqlservr & ./init-db.sh
|
|
@ -1,20 +0,0 @@
|
|||||||
CREATE DATABASE BulletinBoard;
|
|
||||||
GO
|
|
||||||
|
|
||||||
USE BulletinBoard;
|
|
||||||
|
|
||||||
CREATE TABLE Events (
|
|
||||||
Id INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
|
|
||||||
Title NVARCHAR(50),
|
|
||||||
Detail NVARCHAR(200),
|
|
||||||
[Date] DATETIMEOFFSET,
|
|
||||||
CreatedAt DATETIMEOFFSET NOT NULL,
|
|
||||||
UpdatedAt DATETIMEOFFSET NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO Events (Title, Detail, [Date], CreatedAt, UpdatedAt) VALUES
|
|
||||||
(N'Docker for Beginners', N'Introduction to Docker using Node.js', '2017-11-21', GETDATE(), GETDATE()),
|
|
||||||
(N'Advanced Orchestration', N'Deep dive into Docker Swarm', '2017-12-25', GETDATE(), GETDATE()),
|
|
||||||
(N'Docker on Windows', N'From 101 to production', '2018-01-01', GETDATE(), GETDATE());
|
|
||||||
|
|
||||||
SELECT * FROM BulletinBoard.dbo.Events;
|
|
Loading…
x
Reference in New Issue
Block a user