Dockerize app (#32)
This commit adds both a Dockerfile and updates the docker-compose.yml with local mounting so that you can standup a consistent dev environment. Please view the project README for more information.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
kolide
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
FROM golang:1.6.3-wheezy
|
||||
MAINTAINER engineering@kolide.co
|
||||
|
||||
RUN mkdir -p /app
|
||||
WORKDIR /app
|
||||
COPY . /app
|
||||
|
||||
# Download and install any required third party dependencies into the container.
|
||||
RUN go-wrapper download
|
||||
RUN go build -o kolide
|
||||
|
||||
CMD /app/kolide serve
|
||||
@@ -7,35 +7,72 @@
|
||||
To build the code, run the following from the root of the repository:
|
||||
|
||||
```
|
||||
go build
|
||||
go build -o kolide
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
To run the application's tests, run the following from the root of the repository:
|
||||
To run the application's tests, run the following from the root of the
|
||||
repository:
|
||||
|
||||
```
|
||||
go test
|
||||
```
|
||||
|
||||
Or if you using the Docker development environment run:
|
||||
|
||||
```
|
||||
docker-compose app exec go test
|
||||
```
|
||||
|
||||
## Development Environment
|
||||
|
||||
To set up the development environment via docker, run the following frmo the root of the repository:
|
||||
To set up a canonical development environment via docker,
|
||||
run the following from the root of the repository:
|
||||
|
||||
```
|
||||
docker-compose up
|
||||
```
|
||||
|
||||
Obviouly this requires that you have docker installed. At this point in time, automatic configuration tools are not included with this project.
|
||||
Once completed, you can access the application at `https://<your-docker-ip>:8080`
|
||||
where `your-docker-ip` is localhost in most native docker installations.
|
||||
|
||||
If you'd like to shut down the virtual infrastructure created by docker, run the following from the root of the repository:
|
||||
This requires that you have docker installed. At this point in time,
|
||||
automatic configuration tools are not included with this project.
|
||||
|
||||
If you'd like to shut down the virtual infrastructure created by docker, run
|
||||
the following from the root of the repository:
|
||||
|
||||
```
|
||||
docker-compose down
|
||||
```
|
||||
|
||||
Once you `docker-compose up` and are running the databases, build the code and run the following command to create the database tables:
|
||||
Once you `docker-compose up` and are running the databases, you can re-build
|
||||
the code with:
|
||||
|
||||
```
|
||||
kolide prepare-db
|
||||
docker-compose exec app go build -o kolide
|
||||
```
|
||||
|
||||
and then run the following command to create the database tables:
|
||||
|
||||
```
|
||||
docker-compose exec app ./kolide prepare-db
|
||||
```
|
||||
|
||||
## Docker Deployment
|
||||
This repository comes with a simple Dockerfile. You can use this to easily
|
||||
deploy Kolide in any infrastructure context that can consume a docker image
|
||||
(heroku, kubernetes, rancher, etc).
|
||||
|
||||
To build the image locally, run:
|
||||
|
||||
```
|
||||
docker build --rm -t kolide .
|
||||
```
|
||||
|
||||
To run the image locally, simply run:
|
||||
|
||||
```
|
||||
docker run -t -p 8080:8080 kolide
|
||||
```
|
||||
|
||||
@@ -35,7 +35,7 @@ var (
|
||||
)
|
||||
|
||||
var defaultMysqlConfigData = mysqlConfigData{
|
||||
Address: "127.0.0.1:3306",
|
||||
Address: "mysql:3306",
|
||||
Username: "kolide",
|
||||
Password: "kolide",
|
||||
Database: "kolide",
|
||||
|
||||
+11
-1
@@ -1,3 +1,13 @@
|
||||
app:
|
||||
build: .
|
||||
ports:
|
||||
- 8080:8080
|
||||
volumes:
|
||||
- './:/app'
|
||||
command: /app/kolide serve
|
||||
links:
|
||||
- mysql
|
||||
|
||||
mysql:
|
||||
image: mysql:5.7.13
|
||||
environment:
|
||||
@@ -6,4 +16,4 @@ mysql:
|
||||
MYSQL_USER: kolide
|
||||
MYSQL_PASSWORD: kolide
|
||||
ports:
|
||||
- "3306:3306"
|
||||
- "3306:3306"
|
||||
|
||||
+19
-19
@@ -1,21 +1,21 @@
|
||||
{
|
||||
"mysql": {
|
||||
"address": "127.0.0.1:3306",
|
||||
"username": "kolide",
|
||||
"password": "kolide",
|
||||
"database": "kolide"
|
||||
},
|
||||
"server": {
|
||||
"address": ":8080",
|
||||
"cert": "./tools/kolide.crt",
|
||||
"key": "./tools/kolide.key"
|
||||
},
|
||||
"app": {
|
||||
"bcrypt_cost": 12,
|
||||
"salt_length": 32,
|
||||
"jwt_key": "very secure"
|
||||
},
|
||||
"osquery": {
|
||||
"enroll_secret": "super secure"
|
||||
}
|
||||
"mysql": {
|
||||
"address": "mysql:3306",
|
||||
"username": "kolide",
|
||||
"password": "kolide",
|
||||
"database": "kolide"
|
||||
},
|
||||
"server": {
|
||||
"address": ":8080",
|
||||
"cert": "./tools/kolide.crt",
|
||||
"key": "./tools/kolide.key"
|
||||
},
|
||||
"app": {
|
||||
"bcrypt_cost": 12,
|
||||
"salt_length": 32,
|
||||
"jwt_key": "very secure"
|
||||
},
|
||||
"osquery": {
|
||||
"enroll_secret": "super secure"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user