페이지

2021년 3월 27일 토요일

kubernetes

 Kubernetes Cluster       => A collections of nodes + a master to manage them

 Node                        => A virtual machine that will run our containers

Pod                           => More or less a running container.

                                     Technically, a pod can run multiple containers

                                     (we won't do this)

Deployment                => Monitors a set of pods, make sure they are running

                                    and restarts them if they crash

Service                      => Provides an easy-to-remember URL to access 

                                    a running container


 



2021년 3월 26일 금요일

node js building docker

 FROM                  node:alpine       => Specify base image

 WORKDIR             /app                => Set the working directory to '/app' in the                                                                  container. All following commands will be 

                                                      issued relative to this dir

 COPY                   package.json ./   => Copy over only the package.json file

 RUN                    npm install        => Install all dependencies

 COPY                   ./ ./                 => Copy over all of our remaining source code

 CMD                    ["npm", "start"]  => Set the command to run when the container

                                                      starts up


Dockerfile


FROM node:alpine


WORKDIR /app

COPY package.json ./

RUN npm install

COPY ./ ./


CMD ["npm", "start"]




.dockerignore


node_modules


docker build .


Successfully built eb521ea6b7e6


docker run eb521ea6b7e6

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


docker build -t abcdefg/efgh .            => Build an image based on the dockerfile in the 

                                                        current directory. Tag it as 'abcdefg/efgh'

docker run [image id or image tag]     => Create and start a container based on the

                                                        provided image id or tag

docker run -it [image id or image tag] [cmd] => Create and start container, but also

                                                                override the default command

docker ps                                    => Print out information about all of the 

                                                      running containers

docker exec -it [container id] [cmd]    => Execute the given command in a running 

                                                      container

docker logs [container id]                => Print out logs from the given container








         


2020년 6월 20일 토요일

Local Environment Setup

* If you are still willing to set up your environment for Go programming language, you need the following software available on your computer:
- A text editor
- Go compiler

The source code written in source file is the human readable source for your program. It needs to be compiled and turned into machine language so that your CPU can actually execute the program as per the instructions given. The Go programming language compiler compiles the source code into its final executable program.

Go distribution comes as a binary installable for FreeBSD(release 8 and above), Linux, Mac OS X(Snow Leopard and above), and Windows operating systems with 32-bit(386) and 64-bit(amd64) x86 processor architectures.
The following section explains how to install Go binary distribution on various OS.


- Download Go Archive
Download the latest version of Go installable archive file from Go Downloads. The following version is used in this tutorial: go1.4.windows-and64.msi.

it is copied it into C:\>go folder.

Installation on UNIX/Linux/Mac OS X, and FreeBSD
Extract the download archive into the folder /usr/local, createing a Go tree in
/usr/local/go. For example:
tar -C /user/local -xzf go1.4.linux-amd64.tar.gz
Add /usr/local/go/bin to the PATH environment variable.


export PATH=$PATH:/usr/local/go/bin






 





2020년 6월 19일 금요일

Try it Option Online

* You really do not need to set up your own environment to start learning Go programming language. Reason is very simple, we already have set up Go Programming environment online, so that you can compile and execute all the available examples online at the same time when you are doing your theory work.

* This gives you confidence in what you are reading and to check the result with different options. Feel free to modify any example and execute it online.

Try the following example using the Try it option available at the top right corner of the following sample code displayed on our website:

package main

import "fmt"

func main() {fmt.Println("Hello, World!")
}

For most of the examples given in this tutorial, you will find a Try it option.


Compiling Java in the Shell(Optional)

 * Java programs get compiled into object code for an imaginary CPU called the "Java Virtual Machine"(JVM). Consequently, you can't execute compiled Java code directly, You must run program that simulates a JVM and let that simulated computer execute the Java code.

* That may seem a little convoluted, but the JVM simulator is easier to write than a "true" compiler. Consequently, JVM simulators can be built into other programs (such as web browsers), allowing Java code compiled on one machine to be executed on almost any other machine. By contrast, a true native-code compiler (e.g., g++) produces executable that can only be run on a single kind of computer.

* The command to compile Java code is "javac" ("c" for compiler) and the command to execute compiled java code is "java". So a typical sequence to compile and execute a single-file Java program would b

javac -g MyProgram.java
java MyhProgram


* Unlike most programming languages, Java includes some important restrictions on the file names used to store source code.

Java source code is stored in files ending with the extension ".java".

Each Java source code file must contain exactly one public class declaration.

* The base name of the file (the part before the extension) must be the same (including upper/lower case characters) as the name of the public class it contains.

So the command

javac -g MyProgram.java

* ocmpiles a file that must contain the code:

public 
class MyProgram ...

The output of this compilatioin will be a file named MyProgram.class ( and possibly some other .class files as well).

* If we have a program that consists of multiple files, we can simply compile each file in turn:

javac -g MyProgram.java
javac -g MyADT.java

but this might not be necessary. If one Java file imports another, then the imported file will be automatically compiled if no .class file for it exists.















Understanding the Error Message

* Cascading one thing to keep in mind i that errors, especially errors in declarations, can cascade, with one "misunderstanding" by the compiler leading to a whole host of later messages. For example, if you meant to write

string s;

but instead wrote

strng s;

* You will certainly get an error message for the unknown symbol strng. However, there's also the factor that the compiler really doesn't know what types any symbol of unknown type is supposed to be an int. So every time you subsequently uses in a "string-like" mananer, e.g.,

s = s + "abcdef";

or

sting t = s.substring(k,m);

* The compiler will probably issue further complaints. Sometimes, therefore, it's best to stop after fixing a few declaration errors and recompile to see how many of the other messages need to be taken seriously.

* Backtracking A compiler can only report where it detected a problem. Where you actually committed a mistake may be someplace entirely different.

The vast majority of error messages that C++ programmers will see are


* syntax eror (missing brackets, semi-colons, etc.)
undeclared symbols
undefined symbols
type errors (usually "cannot find a matching function" complaints)

const errors

Let's look at these from the point of view of the compiler.






Capturing Compiler Output

* There are other ways to capture the output of a compiler (or of any running program). You can run the compiler within the emacs editor, which then gives you a simple command to move from error message to error message, automatically bringing up the source code file on the line cited in the error message. This works with both the UNIX and the MS Windows ports of emacs, and is the technique I use myself. Vim, the "vi improved" editor will do the same.

* Finally, in UNIX there is a command clalled "script" that causes all output to your screen to be captured in a file.
Just say

script log.txt

and all output to your screen will be copied into log.txt until you say

exit

* script output can be kind of ugly, because it includes all the control characters that you type or that your programs use to control formatting on the screen, but it's still useful.