docker-training / ddev-labs Goto Github PK
View Code? Open in Web Editor NEWLabs for the workshop Docker for Enterprise Developers
Labs for the workshop Docker for Enterprise Developers
The script will not run unless you chmod +x... This was not the case before, so I am assuming recent tweaks lost that bit.
I'm a bit concerned about gists for these exercises as the exercises continue to evolve - they need to be versioned so that multiple versions of the course are supported simultaneously.
We can address this by moving all gists into files in a public repo, and replacing the gist link with a link to the raw files. Then we can branch and version in lockstep with the exercises. @xijing-zhang we can start this for ee2.1-v1.0
; leave the gists up for older versions.
When i copy/paste snippets from the pdf into text files sometimes newlines are not added.
In the developer exercises at 4.1 Back-end Development. Copy pasting the api/Dockerfile.api file will generate a maven error for me because the COPY . . command is added to the RUN mvn line.
I cannot manage to build the 4.1 api build with maven.
I get a maven error in the 4.1 Back-end Development exercise.
Would be a good idea to provide a gist for the ddev-labs/docker-compose/api/src/main/resources/application.yml file.
> docker-compose -f docker-compose-api.yml up --build
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ddev 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.137 s
[INFO] Finished at: 2018-09-17T11:03:31Z
[INFO] Final Memory: 15M/128M
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase "COPY". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/LifecyclePhaseNotFoundException
ERROR: Service 'apiserver' failed to build: The command '/bin/sh -c mvn -B -f pom.xml -s /usr/share/maven/ref/settings-docker.xml dependency:resolve COPY . .' returned a non-zero code: 1
version: "3.1"
services:
database:
build:
context: ./database
image: ddev_db
environment:
POSTGRES_USER: gordonuser
POSTGRES_DB: ddev
ports:
- "5432:5432"
networks:
- back-tier
secrets:
- postgres_password
apiserver:
build:
context: api
dockerfile: Dockerfile.api
image: ddev_api
volumes:
- ./api:/usr/src/ddev
ports:
- "8080:8080"
- "5005:5005"
networks:
- back-tier
secrets:
- postgres_password
watcher:
build:
context: api
dockerfile: Dockerfile.api
volumes:
- ./api:/usr/src/ddev
command: mvn fizzed-watcher:run
networks:
- back-tier
secrets:
postgres_password:
file: ./devsecrets/postgres_password
networks:
back-tier:
---
server:
port: 8080
contextPath: /
---
spring:
profiles: local
datasource:
ddev:
url: jdbc:h2:~/test
username: SA
password:
driverClassName: org.h2.Driver
defaultSchema:
maxPoolSize: 10
hibernate:
hbm2ddl.method: create-drop
show_sql: true
format_sql: true
dialect: org.hibernate.dialect.H2Dialect
---
spring:
profiles: postgres, default
devtools:
remote:
secret: secretkey
restart:
enabled: true
livereload:
enabled: true
datasource:
ddev:
url: jdbc:postgresql://database:5432/ddev
username: gordonuser
password: gordonpass
driverClassName: org.postgresql.Driver
defaultSchema:
maxConnections: 300
initialConnections: 20
maxAge: 30000
testOnBorrow: true
testWhileIdle: true
timeBetweenEvictionRunsMillis: 60000
validationQuery: SELECT 1
minPoolSize: 6
maxPoolSize: 15
hibernate:
hbm2ddl.method: update
show_sql: true
format_sql: true
dialect: org.hibernate.dialect.PostgreSQLDialect
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
</parent>
<groupId>com.docker.ddev</groupId>
<artifactId>ddev</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>ddev</name>
<properties>
<java.version>1.8</java.version>
<h2.version>1.4.187</h2.version>
</properties>
<dependencies>
<!-- Add typical dependencies for a web application -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<!-- Add JPA support -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!-- Add Hikari Connection Pooling support -->
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
</dependency>
<!-- Add H2 database support [for running with local profile] -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<!-- Add PostgreSQL database support -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<!-- Postgres connection pooling -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>5.2.10.Final</version>
</dependency>
<!-- Add Jdbc Template support -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!-- devtools support -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin><!-- Create a jar with all dependencies, run commandline using java -jar NAME -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludeDevtools>true</excludeDevtools>
</configuration>
</plugin>
<plugin>
<groupId>com.fizzed</groupId>
<artifactId>fizzed-watcher-maven-plugin</artifactId>
<version>1.0.6</version>
<configuration>
<touchFile>target/classes/watcher.txt</touchFile>
<watches>
<watch>
<directory>src/main/java/com/docker/ddev</directory>
</watch>
</watches>
<goals>
<goal>package</goal>
</goals>
</configuration>
</plugin>
</plugins>
</build>
</project>
FROM maven:3.5.0-jdk-8-alpine AS appserver
WORKDIR /usr/src/ddev
COPY pom.xml .
RUN mvn -B -f pom.xml -s /usr/share/maven/ref/settings-docker.xml dependency:resolve
COPY . .
RUN mvn -B -s /usr/share/maven/ref/settings-docker.xml package -DskipTests
EXPOSE 8080
CMD mvn spring-boot:run
A gist would be helpful for this file.
Exercises api-tests.md
The mongodb part shouldn't be included in the initial git repo.
e.g. in main.py
import PyMongo
`app.config['MONGO_HOST'] = 'mongo'
etc.
The code must be cleaned to correspond to the instructions.
On excercise book, page 61, point 8: curl localhost:8080/ap/factorial/12 should be curl localhost:8080/api/factorial/12
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.