Jekyll2021-03-22T04:59:25+00:00https://dipen-dedania.github.io/feed.xmlDipen DedaniaPersonal blog.Dipen Dedaniadipen27891@gmail.comDeploy GO application on Google Compute Engine2018-08-09T00:00:00+00:002018-08-09T00:00:00+00:00https://dipen-dedania.github.io/dev/deploy-go-app-on-gcp<p>Hello There!</p>
<h1 id="create-instance">Create Instance</h1>
<p>https://console.cloud.google.com/compute/instances</p>
<h1 id="generate-and-add-ssh-key">Generate and Add SSH key</h1>
<p>https://console.cloud.google.com/compute/metadata</p>
<h1 id="connect-app-with-filezilla--putty">Connect app with Filezilla & Putty</h1>
<h1 id="install-go">Install Go</h1>
<h1 id="set-gopath">Set GOPATH</h1>
<p>export $GOPATH=/var/www
export $GOROOT=/usr/local/go</p>
<p>export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH</p>
<h1 id="upload-code">Upload Code</h1>
<h1 id="set-firewall-rule-for-8081">Set firewall rule for 8081</h1>
<p>gcloud compute firewall-rules create default-allow-http-8081 –allow tcp:8081 –source-ranges 0.0.0.0/0 –target-tags http-server –description “Allow port 8081 access to http-server”</p>
<h1 id="create-service">Create Service</h1>
<h2 id="create-etcsystemdsystemmyserviceservice">create /etc/systemd/system/myservice.service</h2>
<p>[Unit]
Description=my amazing service</p>
<p>[Service]
Restart=always
RestartSec=3
WorkingDirectory=/var/www/src/zuru.tech/jobs/
ExecStart=/var/www/src/zuru.tech/jobs/main</p>
<p>[Install]
WantedBy=multi-user.target</p>
<h2 id="enable-service">enable service</h2>
<p>systemctl enable myservice</p>
<h2 id="startstop">start/stop</h2>
<p>sudo systemctl start myservice
sudo systemctl stop myservice
sudo systemctl status myservice
sudo systemctl restart myservice</p>
<h2 id="install-openssl">Install Openssl</h2>
<p>https://www.howtoforge.com/tutorial/how-to-install-openssl-from-source-on-linux/</p>
<h1 id="openssl">Openssl</h1>
<h2 id="with-password">with password</h2>
<p>openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -subj ‘/CN=localhost’</p>
<h2 id="wo-password">W/o password</h2>
<p>openssl req -nodes -new -x509 -keyout server.key -out server.cert</p>
<h1 id="quick-cmd">Quick cmd</h1>
<p>/var/www/src/zuru.tech/jobs/cmd
/etc/ld.so.conf.d/</p>Dipen Dedaniadipen27891@gmail.comHello There!Hello world2018-07-28T00:00:00+00:002018-07-28T00:00:00+00:00https://dipen-dedania.github.io/dev/hello-world<p>Hello There!</p>
<p>Having fun?</p>Dipen Dedaniadipen27891@gmail.comHello There!