Tuesday, February 7, 2017

Install node-gyp


If you're using Windows you can now install all node-gyp dependencies with single command:
 $ npm install --global --production windows-build-tools
and then install the package
 $ npm install --global node-gyp

Tuesday, November 8, 2016

Octopus update database by entityframework

Entity framework includes a tool called migrate.exe for use in deployment target to update database.
We can use that one in Octopus deployment. Here is the steps to get it working,

1. create a nuspec file in the project, make it the same name as the project name.
    make sure the id is the same package id as the Octopus package id
Add the below section in the file,
<files>
    <file src="..\packages\EntityFramework.6.1.3\tools\migrate.exe" target="tools"/>
    <file src="..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll" target="tools"/>
    <file src="..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.sqlserver.dll" target="tools"/>
    <file src="*.ps1" />
  </files>

2. Include the parameter OctoPackEnforceAddingFiles for uploading package
msbuild /t:build /p:RunOctoPack=true  /p:OctoPackEnforceAddingFiles=true .....

3. Create a new deployment step script

$installPath = $OctopusParameters['Octopus.Action[Deploy Package].Output.Package.InstallationDirectoryPath']
Write-Host "Installation Path:" $installPath

set-location "$($installPath)\tools"
Write-Host "Working Dir: "$(get-location)

.\migrate.exe <datamodel.dll> /StartUpDirectory="$($installPath)\bin" /StartUpConfigurationFile="$($installPath)\web.config"

Tuesday, November 1, 2016

Octopus msbuild cmd to publish the nuget package

Just record it here in case I will need it later,

msbuild /t:build /p:RunOctoPack=true /p:OctoPackPackageVersion=1.0.0-beta /p:OctoPackPublishPackageToHttp=http://<server>:3001/nuget/packages /p:OctoPackPublishApiKey=<apikey>

Also if the nuget is behind proxy, need to set it up with the command
  • nuget.exe config -set http_proxy=http://my.proxy.address:port
    nuget.exe config -set http_proxy.user=<domain>\<username>
    nuget.exe config -set http_proxy.password=<password>

Sunday, August 21, 2016

How to install rabbitMQ on windows

I tried to follow the rabbitMQ official guide to download and install (include Erlang) but it is still not working.

This blog finally saved my day.
http://arcware.net/installing-rabbitmq-on-windows/

Here is the summary to be done,

Firewall inbound rules setup,
Allow ports for 5672,15672
Allow program for

  • %ProgramFiles%\erl8.0\bin\erl.exe
  • %ProgramFiles%\erl8.0\erts-8.0\bin\erl.exe
  • %ProgramFiles%\erl8.0\erts-8.0\bin\epmd.exe

Set up correct home drive and reinstall the service (running cmd as administrator)
SET HOMEDRIVE=C:
rabbitmq-plugins enable rabbitmq_management
rabbitmq-service stop
rabbitmq-service install
rabbitmq-service start


Monday, May 23, 2016

Detailed guides to set up docker on windows behind a firewall

Recently just set up a docker to work under windows behind a corporate firewall

Prerequisite:
 - Enable VT-X in BIOS
 - Setup Server environment variable in the host PC
   HTTP_PROXY=http://<proxy>:<port>
   HTTPS_PROXY=http://<proxy>:<port>
   NO_PROXY=192.168.99.100

1. Download docker toolbox for windows and install it

2. Start Docker quick terminal
I removed the default image and recreate one.
docker-machine stop default
docker-machine rm default

3. Create a image named dev
docker-machine create --driver virtualbox dev

4. Set up the start environment variable
docker-machine env dev
eval $("C:\program files\docker toolbox\docker-machine.exe" env dev)
docker ps

5.Remote SSH to the image and set up proxy in it
docker-machine ssh dev
sudo -s
echo "export HTTP_PROXY=http://<proxy>:<port>" >> /var/lib/boot2docker/profile
echo "export HTTPS_PROXY=http://<proxy>:<port>" >> /var/lib/boot2docker/profile

cat /var/lib/boot2docker/profile
exit

6. Restart the image
docker-machine restart dev

7. Run hello-world to test
docker run hello-world

-----
There are also a few useful command to use
docker ps -a
docker run -p 3000:3000 -v $(pwd):/var/www -w /var/www node npm start

-----------
Updated, just found a blog talking about this as well.
http://www.netinstructions.com/how-to-install-docker-on-windows-behind-a-proxy/




Friday, April 1, 2016

Tangling with Git proxy settings in windows

To set up git proxy globally, you need to run this command

git config --global http.proxy "http://<your proxy>:<port>"

However, it returned me error,

error: could not lock config file H:\/.gitconfig: No such file or
directory error: could not lock config file
 
To fix it, need to set up the %HOME% environment variable to your user profile path

1. echo %userprofile%

2. create a new environment variable as HOME = the user profile directory

And then you can run the config http.proxy command.

Friday, February 12, 2016

Setting up Github with Visual Studio Code

Visual studio code support work with GitHub, you can reference the below link for the detailed steps,
http://michaelcrump.net/using-github-with-visualstudio-code/

The main command is the below to run in a command shell,
git remote add origin https://github.com/xinzhang/SampleProject.git
git push -u origin master
Then the config file in the .git folder will become as below,
[remote "origin"]
url = https://github.com/mbcrump/SampleProject.git
fetch = +refs/heads/*:refs/remotes/origin/*

[branch "master"]
remote = origin
merge = refs/heads/master
After this is done, you commit the changes but there is still the below commands to run to be able to run PUSH from Visual Studio Code,

git config --global credential.helper wincred
git config --global user.name "YOUR NAME"
git config --global user.email "YOUR EMAIL ADDRESS"