Repository: hashicorp/waypoint-examples Branch: main Commit: 19d5162a6267 Files: 578 Total size: 510.8 KB Directory structure: gitextract__3jods0z/ ├── .github/ │ ├── CODEOWNERS │ ├── CODE_OF_CONDUCT.md │ ├── CONTRIBUTING.md │ └── ISSUE_TEMPLATE/ │ ├── bug_report.md │ ├── config.yml │ └── feature_request.md ├── .gitignore ├── LICENSE ├── README.md ├── aws/ │ ├── aws-ecs/ │ │ ├── nodejs/ │ │ │ ├── .gitignore │ │ │ ├── Procfile │ │ │ ├── README.md │ │ │ ├── index.js │ │ │ ├── main.tf │ │ │ ├── package.json │ │ │ ├── packer.json │ │ │ ├── public/ │ │ │ │ └── stylesheets/ │ │ │ │ └── main.css │ │ │ ├── views/ │ │ │ │ ├── pages/ │ │ │ │ │ └── index.ejs │ │ │ │ └── partials/ │ │ │ │ └── header.ejs │ │ │ └── waypoint.hcl │ │ ├── nodejs-terraform/ │ │ │ ├── .gitignore │ │ │ ├── Procfile │ │ │ ├── README.md │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ ├── packer.json │ │ │ ├── public/ │ │ │ │ └── stylesheets/ │ │ │ │ └── main.css │ │ │ ├── terraform/ │ │ │ │ ├── .terraform.lock.hcl │ │ │ │ ├── backend.tf │ │ │ │ ├── ecs.tf │ │ │ │ ├── main.tf │ │ │ │ ├── outputs.tf │ │ │ │ └── variables.tf │ │ │ ├── views/ │ │ │ │ ├── pages/ │ │ │ │ │ └── index.ejs │ │ │ │ └── partials/ │ │ │ │ └── header.ejs │ │ │ └── waypoint.hcl │ │ └── python/ │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── app/ │ │ │ ├── app.py │ │ │ ├── static/ │ │ │ │ ├── images/ │ │ │ │ │ └── language.svg.old │ │ │ │ └── stylesheets/ │ │ │ │ └── main.css │ │ │ ├── templates/ │ │ │ │ └── index.html │ │ │ └── wsgi.py │ │ ├── requirements.txt │ │ └── waypoint.hcl │ ├── ec2/ │ │ ├── README.md │ │ └── waypoint.hcl │ └── lambda/ │ ├── nodejs/ │ │ └── waypoint.hcl │ ├── nodejs-graphql/ │ │ ├── .gitignore │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── index.js │ │ ├── package.json │ │ └── waypoint.hcl │ └── ruby/ │ ├── Dockerfile │ ├── README.md │ ├── handler.rb │ └── waypoint.hcl ├── azure/ │ └── azure-container-instance/ │ └── nodejs/ │ ├── .gitignore │ ├── Procfile │ ├── README.md │ ├── index.js │ ├── package.json │ ├── public/ │ │ └── stylesheets/ │ │ └── main.css │ ├── views/ │ │ ├── pages/ │ │ │ └── index.ejs │ │ └── partials/ │ │ └── header.ejs │ └── waypoint.hcl ├── docker/ │ ├── angular/ │ │ ├── Procfile │ │ ├── README.md │ │ ├── angular.json │ │ ├── browserslist │ │ ├── e2e/ │ │ │ ├── protractor.conf.js │ │ │ ├── src/ │ │ │ │ ├── app.e2e-spec.ts │ │ │ │ └── app.po.ts │ │ │ └── tsconfig.json │ │ ├── karma.conf.js │ │ ├── package.json │ │ ├── server.js │ │ ├── src/ │ │ │ ├── app/ │ │ │ │ ├── app.component.html │ │ │ │ ├── app.component.scss │ │ │ │ ├── app.component.spec.ts │ │ │ │ ├── app.component.ts │ │ │ │ └── app.module.ts │ │ │ ├── assets/ │ │ │ │ └── .gitkeep │ │ │ ├── environments/ │ │ │ │ ├── environment.prod.ts │ │ │ │ └── environment.ts │ │ │ ├── index.html │ │ │ ├── main.ts │ │ │ ├── polyfills.ts │ │ │ ├── styles.scss │ │ │ └── test.ts │ │ ├── tsconfig.app.json │ │ ├── tsconfig.json │ │ ├── tsconfig.spec.json │ │ ├── tslint.json │ │ └── waypoint.hcl │ ├── aspnetapp/ │ │ ├── .dockerignore │ │ ├── .gitignore │ │ ├── Pages/ │ │ │ ├── Error.cshtml │ │ │ ├── Error.cshtml.cs │ │ │ ├── Index.cshtml │ │ │ ├── Index.cshtml.cs │ │ │ ├── Privacy.cshtml │ │ │ ├── Privacy.cshtml.cs │ │ │ ├── Shared/ │ │ │ │ ├── _Layout.cshtml │ │ │ │ └── _ValidationScriptsPartial.cshtml │ │ │ ├── _ViewImports.cshtml │ │ │ └── _ViewStart.cshtml │ │ ├── Program.cs │ │ ├── Properties/ │ │ │ └── launchSettings.json │ │ ├── README.md │ │ ├── Startup.cs │ │ ├── appsettings.Development.json │ │ ├── appsettings.json │ │ ├── aspnetapp.csproj │ │ ├── waypoint.hcl │ │ └── wwwroot/ │ │ └── static/ │ │ └── stylesheets/ │ │ └── main.css │ ├── go/ │ │ ├── README.md │ │ ├── go.mod │ │ ├── main.go │ │ ├── static/ │ │ │ ├── index.html │ │ │ └── static/ │ │ │ └── stylesheets/ │ │ │ └── main.css │ │ └── waypoint.hcl │ ├── go-multiapp/ │ │ ├── README.md │ │ ├── go.mod │ │ ├── main.go │ │ ├── static/ │ │ │ ├── index.html │ │ │ └── static/ │ │ │ └── stylesheets/ │ │ │ └── main.css │ │ └── waypoint.hcl │ ├── java/ │ │ ├── .gitignore │ │ ├── .mvn/ │ │ │ └── wrapper/ │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ │ ├── README.md │ │ ├── mvnw │ │ ├── mvnw.cmd │ │ ├── pom.xml │ │ ├── src/ │ │ │ ├── main/ │ │ │ │ ├── java/ │ │ │ │ │ └── com/ │ │ │ │ │ └── example/ │ │ │ │ │ └── waypoint/ │ │ │ │ │ └── WaypointApplication.java │ │ │ │ └── resources/ │ │ │ │ ├── application.properties │ │ │ │ ├── public/ │ │ │ │ │ └── stylesheets/ │ │ │ │ │ └── main.css │ │ │ │ └── templates/ │ │ │ │ ├── fragments/ │ │ │ │ │ └── layout.html │ │ │ │ └── index.html │ │ │ └── test/ │ │ │ └── java/ │ │ │ └── com/ │ │ │ └── example/ │ │ │ └── waypoint/ │ │ │ └── WaypointApplicationTests.java │ │ ├── system.properties │ │ ├── waypoint.hcl │ │ ├── waypoint.hcl.gcp │ │ ├── waypoint.hcl.heroku │ │ └── waypoint.hcl.paketo │ ├── next-js/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package.json │ │ ├── pages/ │ │ │ ├── _app.js │ │ │ ├── api/ │ │ │ │ └── hello.js │ │ │ └── index.js │ │ ├── styles/ │ │ │ ├── Home.module.css │ │ │ └── globals.css │ │ └── waypoint.hcl │ ├── nodejs/ │ │ ├── .gitignore │ │ ├── Procfile │ │ ├── README.md │ │ ├── index.js │ │ ├── package.json │ │ ├── public/ │ │ │ └── stylesheets/ │ │ │ └── main.css │ │ ├── views/ │ │ │ ├── pages/ │ │ │ │ └── index.ejs │ │ │ └── partials/ │ │ │ └── header.ejs │ │ └── waypoint.hcl │ ├── php/ │ │ ├── .editorconfig │ │ ├── .gitattributes │ │ ├── .gitignore │ │ ├── .styleci.yml │ │ ├── Procfile │ │ ├── README.md │ │ ├── app/ │ │ │ ├── Console/ │ │ │ │ └── Kernel.php │ │ │ ├── Exceptions/ │ │ │ │ └── Handler.php │ │ │ ├── Http/ │ │ │ │ ├── Controllers/ │ │ │ │ │ └── Controller.php │ │ │ │ ├── Kernel.php │ │ │ │ └── Middleware/ │ │ │ │ ├── Authenticate.php │ │ │ │ ├── EncryptCookies.php │ │ │ │ ├── PreventRequestsDuringMaintenance.php │ │ │ │ ├── RedirectIfAuthenticated.php │ │ │ │ ├── TrimStrings.php │ │ │ │ ├── TrustHosts.php │ │ │ │ ├── TrustProxies.php │ │ │ │ └── VerifyCsrfToken.php │ │ │ ├── Models/ │ │ │ │ └── User.php │ │ │ └── Providers/ │ │ │ ├── AppServiceProvider.php │ │ │ ├── AuthServiceProvider.php │ │ │ ├── BroadcastServiceProvider.php │ │ │ ├── EventServiceProvider.php │ │ │ └── RouteServiceProvider.php │ │ ├── artisan │ │ ├── bootstrap/ │ │ │ ├── app.php │ │ │ └── cache/ │ │ │ └── .gitignore │ │ ├── composer.json │ │ ├── config/ │ │ │ ├── app.php │ │ │ ├── auth.php │ │ │ ├── broadcasting.php │ │ │ ├── cache.php │ │ │ ├── cors.php │ │ │ ├── database.php │ │ │ ├── filesystems.php │ │ │ ├── hashing.php │ │ │ ├── logging.php │ │ │ ├── mail.php │ │ │ ├── queue.php │ │ │ ├── services.php │ │ │ ├── session.php │ │ │ └── view.php │ │ ├── database/ │ │ │ ├── .gitignore │ │ │ ├── factories/ │ │ │ │ └── UserFactory.php │ │ │ ├── migrations/ │ │ │ │ ├── 2014_10_12_000000_create_users_table.php │ │ │ │ ├── 2014_10_12_100000_create_password_resets_table.php │ │ │ │ └── 2019_08_19_000000_create_failed_jobs_table.php │ │ │ └── seeders/ │ │ │ └── DatabaseSeeder.php │ │ ├── package.json │ │ ├── phpunit.xml │ │ ├── public/ │ │ │ ├── .htaccess │ │ │ ├── css/ │ │ │ │ └── main.css │ │ │ ├── index.php │ │ │ ├── robots.txt │ │ │ └── web.config │ │ ├── resources/ │ │ │ ├── css/ │ │ │ │ └── app.css │ │ │ ├── js/ │ │ │ │ ├── app.js │ │ │ │ └── bootstrap.js │ │ │ ├── lang/ │ │ │ │ └── en/ │ │ │ │ ├── auth.php │ │ │ │ ├── pagination.php │ │ │ │ ├── passwords.php │ │ │ │ └── validation.php │ │ │ └── views/ │ │ │ └── welcome.blade.php │ │ ├── routes/ │ │ │ ├── api.php │ │ │ ├── channels.php │ │ │ ├── console.php │ │ │ └── web.php │ │ ├── server.php │ │ ├── storage/ │ │ │ ├── app/ │ │ │ │ └── .gitignore │ │ │ ├── framework/ │ │ │ │ ├── .gitignore │ │ │ │ ├── cache/ │ │ │ │ │ └── .gitignore │ │ │ │ ├── sessions/ │ │ │ │ │ └── .gitignore │ │ │ │ ├── testing/ │ │ │ │ │ └── .gitignore │ │ │ │ └── views/ │ │ │ │ └── .gitignore │ │ │ └── logs/ │ │ │ └── .gitignore │ │ ├── tests/ │ │ │ ├── CreatesApplication.php │ │ │ ├── Feature/ │ │ │ │ └── ExampleTest.php │ │ │ ├── TestCase.php │ │ │ └── Unit/ │ │ │ └── ExampleTest.php │ │ ├── waypoint.hcl │ │ └── webpack.mix.js │ ├── python/ │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── app/ │ │ │ ├── app.py │ │ │ ├── static/ │ │ │ │ └── stylesheets/ │ │ │ │ └── main.css │ │ │ ├── templates/ │ │ │ │ └── index.html │ │ │ └── wsgi.py │ │ ├── requirements.txt │ │ └── waypoint.hcl │ ├── reactjs/ │ │ ├── .gitignore │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── nginx/ │ │ │ └── default.conf │ │ ├── package.json │ │ ├── public/ │ │ │ ├── index.html │ │ │ ├── manifest.json │ │ │ └── robots.txt │ │ ├── src/ │ │ │ ├── App.css │ │ │ ├── App.js │ │ │ ├── App.test.js │ │ │ ├── index.js │ │ │ ├── serviceWorker.js │ │ │ └── setupTests.js │ │ └── waypoint.hcl │ ├── reactjs-packer/ │ │ ├── .gitignore │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── nginx/ │ │ │ └── default.conf │ │ ├── nginx.pkr.hcl │ │ ├── package.json │ │ ├── public/ │ │ │ ├── index.html │ │ │ ├── manifest.json │ │ │ └── robots.txt │ │ ├── src/ │ │ │ ├── App.css │ │ │ ├── App.js │ │ │ ├── App.test.js │ │ │ ├── index.js │ │ │ ├── serviceWorker.js │ │ │ └── setupTests.js │ │ └── waypoint.hcl │ ├── ruby/ │ │ ├── .gitignore │ │ ├── Gemfile │ │ ├── Procfile │ │ ├── README.md │ │ ├── Rakefile │ │ ├── app/ │ │ │ ├── assets/ │ │ │ │ ├── images/ │ │ │ │ │ └── .keep │ │ │ │ ├── javascripts/ │ │ │ │ │ ├── application.js │ │ │ │ │ ├── welcome.js.coffee │ │ │ │ │ └── widgets.js.coffee │ │ │ │ └── stylesheets/ │ │ │ │ ├── application.css │ │ │ │ ├── main.css.scss │ │ │ │ ├── scaffolds.css.scss │ │ │ │ ├── theme.css.scss │ │ │ │ ├── welcome.css.scss │ │ │ │ └── widgets.css.scss │ │ │ ├── controllers/ │ │ │ │ ├── application_controller.rb │ │ │ │ ├── concerns/ │ │ │ │ │ └── .keep │ │ │ │ ├── welcome_controller.rb │ │ │ │ └── widgets_controller.rb │ │ │ ├── helpers/ │ │ │ │ ├── application_helper.rb │ │ │ │ ├── welcome_helper.rb │ │ │ │ └── widgets_helper.rb │ │ │ ├── mailers/ │ │ │ │ └── .keep │ │ │ ├── models/ │ │ │ │ ├── .keep │ │ │ │ ├── concerns/ │ │ │ │ │ └── .keep │ │ │ │ └── widget.rb │ │ │ └── views/ │ │ │ ├── layouts/ │ │ │ │ └── application.html.erb │ │ │ ├── welcome/ │ │ │ │ └── index.erb │ │ │ └── widgets/ │ │ │ ├── _form.html.erb │ │ │ ├── edit.html.erb │ │ │ ├── index.html.erb │ │ │ ├── index.json.jbuilder │ │ │ ├── new.html.erb │ │ │ ├── show.html.erb │ │ │ └── show.json.jbuilder │ │ ├── bin/ │ │ │ ├── bundle │ │ │ ├── rails │ │ │ ├── rake │ │ │ ├── setup │ │ │ ├── spring │ │ │ ├── update │ │ │ └── yarn │ │ ├── config/ │ │ │ ├── application.rb │ │ │ ├── boot.rb │ │ │ ├── cable.yml │ │ │ ├── database.yml │ │ │ ├── environment.rb │ │ │ ├── environments/ │ │ │ │ ├── development.rb │ │ │ │ ├── production.rb │ │ │ │ └── test.rb │ │ │ ├── initializers/ │ │ │ │ ├── application_controller_renderer.rb │ │ │ │ ├── assets.rb │ │ │ │ ├── backtrace_silencers.rb │ │ │ │ ├── content_security_policy.rb │ │ │ │ ├── cookies_serializer.rb │ │ │ │ ├── filter_parameter_logging.rb │ │ │ │ ├── inflections.rb │ │ │ │ ├── mime_types.rb │ │ │ │ ├── new_framework_defaults_5_2.rb │ │ │ │ ├── session_store.rb │ │ │ │ └── wrap_parameters.rb │ │ │ ├── locales/ │ │ │ │ └── en.yml │ │ │ ├── puma.rb │ │ │ ├── routes.rb │ │ │ ├── secrets.yml │ │ │ ├── spring.rb │ │ │ └── storage.yml │ │ ├── config.ru │ │ ├── db/ │ │ │ ├── migrate/ │ │ │ │ └── 20140707111715_create_widgets.rb │ │ │ ├── schema.rb │ │ │ └── seeds.rb │ │ ├── lib/ │ │ │ ├── assets/ │ │ │ │ └── .keep │ │ │ └── tasks/ │ │ │ └── .keep │ │ ├── log/ │ │ │ └── .keep │ │ ├── public/ │ │ │ ├── 404.html │ │ │ ├── 422.html │ │ │ ├── 500.html │ │ │ └── robots.txt │ │ ├── test/ │ │ │ ├── controllers/ │ │ │ │ ├── .keep │ │ │ │ ├── welcome_controller_test.rb │ │ │ │ └── widgets_controller_test.rb │ │ │ ├── fixtures/ │ │ │ │ ├── .keep │ │ │ │ └── widgets.yml │ │ │ ├── helpers/ │ │ │ │ ├── .keep │ │ │ │ ├── welcome_helper_test.rb │ │ │ │ └── widgets_helper_test.rb │ │ │ ├── integration/ │ │ │ │ └── .keep │ │ │ ├── mailers/ │ │ │ │ └── .keep │ │ │ ├── models/ │ │ │ │ ├── .keep │ │ │ │ └── widget_test.rb │ │ │ └── test_helper.rb │ │ ├── vendor/ │ │ │ └── assets/ │ │ │ ├── javascripts/ │ │ │ │ └── .keep │ │ │ └── stylesheets/ │ │ │ └── .keep │ │ └── waypoint.hcl │ ├── static/ │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── nginx.conf │ │ ├── public/ │ │ │ ├── index.html │ │ │ └── static/ │ │ │ └── stylesheets/ │ │ │ └── main.css │ │ └── waypoint.hcl │ └── svelte/ │ ├── .gitignore │ ├── Dockerfile │ ├── README.md │ ├── package.json │ ├── public/ │ │ ├── index.html │ │ └── main.css │ ├── rollup.config.js │ ├── src/ │ │ ├── App.svelte │ │ ├── main.js │ │ └── views/ │ │ └── Index.svelte │ └── waypoint.hcl ├── gcp/ │ └── google-cloud-run/ │ └── nodejs/ │ ├── .gitignore │ ├── Procfile │ ├── README.md │ ├── index.js │ ├── package.json │ ├── public/ │ │ └── stylesheets/ │ │ └── main.css │ ├── views/ │ │ ├── pages/ │ │ │ └── index.ejs │ │ └── partials/ │ │ └── header.ejs │ └── waypoint.hcl ├── kubernetes/ │ ├── aws-eks/ │ │ └── nodejs/ │ │ ├── .gitignore │ │ ├── Procfile │ │ ├── README.md │ │ ├── index.js │ │ ├── package.json │ │ ├── public/ │ │ │ └── stylesheets/ │ │ │ └── main.css │ │ ├── views/ │ │ │ ├── pages/ │ │ │ │ └── index.ejs │ │ │ └── partials/ │ │ │ └── header.ejs │ │ └── waypoint.hcl │ ├── exec-kubectl-apply/ │ │ ├── README.md │ │ ├── example-nodejs-exec.yml │ │ ├── index.js │ │ ├── output.txt │ │ ├── package.json │ │ ├── public/ │ │ │ └── stylesheets/ │ │ │ └── main.css │ │ ├── views/ │ │ │ ├── pages/ │ │ │ │ └── index.ejs │ │ │ └── partials/ │ │ │ └── header.ejs │ │ └── waypoint.hcl │ ├── go/ │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── go.mod │ │ ├── main.go │ │ ├── static/ │ │ │ ├── index.html │ │ │ └── static/ │ │ │ └── stylesheets/ │ │ │ └── main.css │ │ └── waypoint.hcl │ ├── go-gitops/ │ │ ├── README.md │ │ ├── go.mod │ │ ├── main.go │ │ ├── static/ │ │ │ ├── index.html │ │ │ └── static/ │ │ │ └── stylesheets/ │ │ │ └── main.css │ │ └── waypoint.hcl │ ├── go-multiapp-ingress/ │ │ ├── .gitignore │ │ ├── README.md │ │ ├── app-one/ │ │ │ ├── index.html │ │ │ └── static/ │ │ │ └── stylesheets/ │ │ │ └── main.css │ │ ├── app-two/ │ │ │ ├── index.html │ │ │ └── static/ │ │ │ └── stylesheets/ │ │ │ └── main.css │ │ ├── go.mod │ │ ├── main.go │ │ ├── static/ │ │ │ ├── index.html │ │ │ └── static/ │ │ │ └── stylesheets/ │ │ │ └── main.css │ │ └── waypoint.hcl │ ├── go-multiworkspace/ │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── config.yml │ │ ├── go.mod │ │ ├── go.sum │ │ ├── main.go │ │ └── waypoint.hcl │ ├── go-workspace-pull/ │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── go.mod │ │ ├── main.go │ │ ├── static/ │ │ │ ├── index.html │ │ │ └── static/ │ │ │ └── stylesheets/ │ │ │ └── main.css │ │ └── waypoint.hcl │ ├── java/ │ │ ├── .gitignore │ │ ├── .mvn/ │ │ │ └── wrapper/ │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ │ ├── README.md │ │ ├── mvnw │ │ ├── mvnw.cmd │ │ ├── pom.xml │ │ ├── src/ │ │ │ ├── main/ │ │ │ │ ├── java/ │ │ │ │ │ └── com/ │ │ │ │ │ └── example/ │ │ │ │ │ └── waypoint/ │ │ │ │ │ └── WaypointApplication.java │ │ │ │ └── resources/ │ │ │ │ ├── application.properties │ │ │ │ ├── public/ │ │ │ │ │ └── stylesheets/ │ │ │ │ │ └── main.css │ │ │ │ └── templates/ │ │ │ │ ├── fragments/ │ │ │ │ │ └── layout.html │ │ │ │ └── index.html │ │ │ └── test/ │ │ │ └── java/ │ │ │ └── com/ │ │ │ └── example/ │ │ │ └── waypoint/ │ │ │ └── WaypointApplicationTests.java │ │ ├── system.properties │ │ └── waypoint.hcl │ ├── nodejs/ │ │ ├── README.md │ │ ├── index.js │ │ ├── package.json │ │ ├── public/ │ │ │ └── stylesheets/ │ │ │ └── main.css │ │ ├── views/ │ │ │ ├── pages/ │ │ │ │ └── index.ejs │ │ │ └── partials/ │ │ │ └── header.ejs │ │ └── waypoint.hcl │ ├── nodejs-apply/ │ │ ├── README.md │ │ ├── index.js │ │ ├── k8s/ │ │ │ └── deployment.yaml │ │ ├── package.json │ │ ├── public/ │ │ │ └── stylesheets/ │ │ │ └── main.css │ │ ├── views/ │ │ │ ├── pages/ │ │ │ │ └── index.ejs │ │ │ └── partials/ │ │ │ └── header.ejs │ │ └── waypoint.hcl │ ├── nodejs-helm/ │ │ ├── README.md │ │ ├── helm/ │ │ │ ├── .helmignore │ │ │ ├── Chart.yaml │ │ │ ├── templates/ │ │ │ │ ├── NOTES.txt │ │ │ │ ├── _helpers.tpl │ │ │ │ ├── deployment.yaml │ │ │ │ └── service.yaml │ │ │ └── values.yaml │ │ ├── index.js │ │ ├── package.json │ │ ├── public/ │ │ │ └── stylesheets/ │ │ │ └── main.css │ │ ├── values.yaml.tpl │ │ ├── views/ │ │ │ ├── pages/ │ │ │ │ └── index.ejs │ │ │ └── partials/ │ │ │ └── header.ejs │ │ └── waypoint.hcl │ ├── nodejs-ingress/ │ │ ├── README.md │ │ ├── index.js │ │ ├── package.json │ │ ├── public/ │ │ │ └── stylesheets/ │ │ │ └── main.css │ │ ├── views/ │ │ │ ├── pages/ │ │ │ │ └── index.ejs │ │ │ └── partials/ │ │ │ └── header.ejs │ │ └── waypoint.hcl │ ├── nodejs-ingress-sidecar/ │ │ ├── README.md │ │ ├── index.js │ │ ├── nginx.conf │ │ ├── package.json │ │ ├── views/ │ │ │ ├── pages/ │ │ │ │ └── index.ejs │ │ │ └── partials/ │ │ │ └── header.ejs │ │ └── waypoint.hcl │ ├── nodejs-local-registry/ │ │ ├── README.md │ │ ├── index.js │ │ ├── package.json │ │ ├── public/ │ │ │ └── stylesheets/ │ │ │ └── main.css │ │ ├── views/ │ │ │ ├── pages/ │ │ │ │ └── index.ejs │ │ │ └── partials/ │ │ │ └── header.ejs │ │ └── waypoint.hcl │ └── nodejs-metrics-sidecar/ │ ├── README.md │ ├── index.js │ ├── package.json │ ├── public/ │ │ └── stylesheets/ │ │ └── main.css │ ├── telegraf.conf │ ├── views/ │ │ ├── pages/ │ │ │ └── index.ejs │ │ └── partials/ │ │ └── header.ejs │ └── waypoint.hcl ├── learn/ │ ├── dynamic-application-configuration/ │ │ ├── README.md │ │ ├── go.mod │ │ ├── go.sum │ │ ├── main.go │ │ ├── postgres.nomad.hcl │ │ ├── readonly.sql │ │ ├── waypoint-policy.hcl │ │ └── waypoint.hcl │ ├── input-variables/ │ │ ├── README.md │ │ ├── go.mod │ │ ├── go.sum │ │ ├── main.go │ │ ├── static/ │ │ │ ├── index.html │ │ │ └── static/ │ │ │ └── stylesheets/ │ │ │ └── main.css │ │ └── waypoint.hcl │ └── static-application-configuration/ │ ├── README.md │ ├── go.mod │ ├── main.go │ └── waypoint.hcl ├── nomad/ │ ├── nodejs/ │ │ ├── README.md │ │ ├── index.js │ │ ├── package.json │ │ ├── public/ │ │ │ └── stylesheets/ │ │ │ └── main.css │ │ ├── views/ │ │ │ ├── pages/ │ │ │ │ └── index.ejs │ │ │ └── partials/ │ │ │ └── header.ejs │ │ └── waypoint.hcl │ └── nodejs-jobspec/ │ ├── README.md │ ├── app.nomad.tpl │ ├── index.js │ ├── package.json │ ├── public/ │ │ └── stylesheets/ │ │ └── main.css │ ├── views/ │ │ ├── pages/ │ │ │ └── index.ejs │ │ └── partials/ │ │ └── header.ejs │ └── waypoint.hcl └── terraform/ └── variables/ ├── .gitignore ├── Dockerfile ├── README.md ├── terraform/ │ ├── main/ │ │ ├── main.tf │ │ └── outputs.tf │ └── tfc/ │ ├── .terraform.lock.hcl │ ├── main.tf │ └── variables.tf └── waypoint.hcl ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/CODEOWNERS ================================================ * @hashicorp/waypoint ================================================ FILE: .github/CODE_OF_CONDUCT.md ================================================ # Code of Conduct HashiCorp Community Guidelines apply to you when interacting with the community here on GitHub and contributing code. Please read the full text at https://www.hashicorp.com/community-guidelines ================================================ FILE: .github/CONTRIBUTING.md ================================================ # Contributing to Waypoint Examples >**Note:** We take Waypoint's security and our users' trust very seriously. >If you believe you have found a security issue in Waypoint, please responsibly >disclose by contacting us at security@hashicorp.com. **First:** if you're unsure or afraid of _anything_, just ask or submit the issue or pull request anyways. You won't be yelled at for giving your best effort. The worst that can happen is that you'll be politely asked to change something. We appreciate any sort of contributions, and don't want a wall of rules to get in the way of that. That said, if you want to ensure that a pull request is likely to be merged, talk to us! A great way to do this is in issues themselves. When you want to work on an issue, comment on it first and tell us the approach you want to take. ## Getting Started ### Some Ways to Contribute * Report potential bugs. * Suggest product enhancements. * Increase our test coverage. * Fix a [bug](https://github.com/hashicorp/waypoint-examples/labels/bug). * Implement a requested [enhancement](https://github.com/hashicorp/waypoint-examples/labels/enhancement). * Improve our guides and documentation. ### Reporting an Issue: >Note: Issues on GitHub for Waypoint are intended to be related to bugs or feature requests. >Questions should be directed to other community resources such as the [forum](https://discuss.hashicorp.com/) * Make sure you test against the latest released version. It is possible we already fixed the bug you're experiencing. However, if you are on an older version of Waypoint and feel the issue is critical, do let us know. * Check existing issues (both open and closed) to make sure it has not been reported previously. * Provide a reproducible test case. If a contributor can't reproduce an issue, then it dramatically lowers the chances it'll get fixed. If we can't reproduce an issue long enough, we are usually forced to close the issue. * As part of the test case, please include any Waypoint configurations (`waypoint.hcl`), build configs such as Dockerfiles, etc. Log output with log level set with verbose flags (at least `-vv`) is helpful too. * If the issue is related to the browser UI, please also include the name and version of the browser and any extensions that may be interacting with the UI * Aim to respond promptly to any questions made by the Waypoint team on your issue. Stale issues will be closed. ### Issue Lifecycle 1. The issue is reported. 2. The issue is verified and categorized by a Waypoint maintainer. Categorization is done via tags. For example, bugs are tagged as "bug". 3. Unless it is critical, the issue is left for a period of time (sometimes many weeks or months), giving outside contributors a chance to address the issue and our internal teams time to plan for inclusion in a release. 4. The issue is addressed in a pull request or commit. The issue will be referenced in the commit message so that the code that fixes it is clearly linked. 5. The issue is closed. ================================================ FILE: .github/ISSUE_TEMPLATE/bug_report.md ================================================ --- name: Bug report about: Let us know about a bug! title: '' labels: new assignees: '' --- **Describe your environment** Which example app are you having problems with? **Describe the bug** A clear and concise description of what the bug is. **Steps to Reproduce** Steps to reproduce the behavior. Please include any `waypoint.hcl` files if applicable. **Expected behavior** A clear and concise description of what you expected to happen. **Additional context** Add any other context about the problem here. ================================================ FILE: .github/ISSUE_TEMPLATE/config.yml ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 contact_links: - name: Ask a question url: https://discuss.hashicorp.com/c/waypoint about: For increased visibility, please post questions on the discussion forum. ================================================ FILE: .github/ISSUE_TEMPLATE/feature_request.md ================================================ --- name: Feature request about: Suggest something! title: '' labels: new assignees: '' --- **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is or why your proposed example should be included. Ex. I'm always frustrated when [...] **Describe the example scenario you wish to be included** What technology are you hoping to add? What additional information or documentation can you share to help us read up on your example app? **Describe the solution you'd like** A clear and concise description of what you want to happen. **Describe alternatives you've considered** A clear and concise description of any alternative solutions or features you've considered. **Explain any additional use-cases** If there are any use-cases that would help us understand the use/need/value please share them as they can help us decide on acceptance and prioritization. **Additional context** Add any other context or screenshots about the feature request here. ================================================ FILE: .gitignore ================================================ .DS_Store data.db # Local .waypoint directories **/.waypoint/* # Local .terraform directories **/.terraform/* # .tfstate files *.tfstate *.tfstate.* # Crash log files crash.log # Ignore any .tfvars files that are generated automatically for each Terraform run. Most # .tfvars files are managed as part of configuration and so should be included in # version control. # # example.tfvars # Ignore override files as they are usually used to override resources locally and so # are not checked in override.tf override.tf.json *_override.tf *_override.tf.json # Include override files you do wish to add to version control using negated pattern # # !example_override.tf # Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan # example: *tfplan* *.wpvars ================================================ FILE: LICENSE ================================================ Copyright (c) 2020 HashiCorp, Inc. Mozilla Public License Version 2.0 ================================== 1. Definitions -------------- 1.1. "Contributor" means each individual or legal entity that creates, contributes to the creation of, or owns Covered Software. 1.2. "Contributor Version" means the combination of the Contributions of others (if any) used by a Contributor and that particular Contributor's Contribution. 1.3. "Contribution" means Covered Software of a particular Contributor. 1.4. "Covered Software" means Source Code Form to which the initial Contributor has attached the notice in Exhibit A, the Executable Form of such Source Code Form, and Modifications of such Source Code Form, in each case including portions thereof. 1.5. "Incompatible With Secondary Licenses" means (a) that the initial Contributor has attached the notice described in Exhibit B to the Covered Software; or (b) that the Covered Software was made available under the terms of version 1.1 or earlier of the License, but not also under the terms of a Secondary License. 1.6. "Executable Form" means any form of the work other than Source Code Form. 1.7. "Larger Work" means a work that combines Covered Software with other material, in a separate file or files, that is not Covered Software. 1.8. "License" means this document. 1.9. "Licensable" means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently, any and all of the rights conveyed by this License. 1.10. "Modifications" means any of the following: (a) any file in Source Code Form that results from an addition to, deletion from, or modification of the contents of Covered Software; or (b) any new file in Source Code Form that contains any Covered Software. 1.11. "Patent Claims" of a Contributor means any patent claim(s), including without limitation, method, process, and apparatus claims, in any patent Licensable by such Contributor that would be infringed, but for the grant of the License, by the making, using, selling, offering for sale, having made, import, or transfer of either its Contributions or its Contributor Version. 1.12. "Secondary License" means either the GNU General Public License, Version 2.0, the GNU Lesser General Public License, Version 2.1, the GNU Affero General Public License, Version 3.0, or any later versions of those licenses. 1.13. "Source Code Form" means the form of the work preferred for making modifications. 1.14. "You" (or "Your") means an individual or a legal entity exercising rights under this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. 2. License Grants and Conditions -------------------------------- 2.1. Grants Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license: (a) under intellectual property rights (other than patent or trademark) Licensable by such Contributor to use, reproduce, make available, modify, display, perform, distribute, and otherwise exploit its Contributions, either on an unmodified basis, with Modifications, or as part of a Larger Work; and (b) under Patent Claims of such Contributor to make, use, sell, offer for sale, have made, import, and otherwise transfer either its Contributions or its Contributor Version. 2.2. Effective Date The licenses granted in Section 2.1 with respect to any Contribution become effective for each Contribution on the date the Contributor first distributes such Contribution. 2.3. Limitations on Grant Scope The licenses granted in this Section 2 are the only rights granted under this License. No additional rights or licenses will be implied from the distribution or licensing of Covered Software under this License. Notwithstanding Section 2.1(b) above, no patent license is granted by a Contributor: (a) for any code that a Contributor has removed from Covered Software; or (b) for infringements caused by: (i) Your and any other third party's modifications of Covered Software, or (ii) the combination of its Contributions with other software (except as part of its Contributor Version); or (c) under Patent Claims infringed by Covered Software in the absence of its Contributions. This License does not grant any rights in the trademarks, service marks, or logos of any Contributor (except as may be necessary to comply with the notice requirements in Section 3.4). 2.4. Subsequent Licenses No Contributor makes additional grants as a result of Your choice to distribute the Covered Software under a subsequent version of this License (see Section 10.2) or under the terms of a Secondary License (if permitted under the terms of Section 3.3). 2.5. Representation Each Contributor represents that the Contributor believes its Contributions are its original creation(s) or it has sufficient rights to grant the rights to its Contributions conveyed by this License. 2.6. Fair Use This License is not intended to limit any rights You have under applicable copyright doctrines of fair use, fair dealing, or other equivalents. 2.7. Conditions Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in Section 2.1. 3. Responsibilities ------------------- 3.1. Distribution of Source Form All distribution of Covered Software in Source Code Form, including any Modifications that You create or to which You contribute, must be under the terms of this License. You must inform recipients that the Source Code Form of the Covered Software is governed by the terms of this License, and how they can obtain a copy of this License. You may not attempt to alter or restrict the recipients' rights in the Source Code Form. 3.2. Distribution of Executable Form If You distribute Covered Software in Executable Form then: (a) such Covered Software must also be made available in Source Code Form, as described in Section 3.1, and You must inform recipients of the Executable Form how they can obtain a copy of such Source Code Form by reasonable means in a timely manner, at a charge no more than the cost of distribution to the recipient; and (b) You may distribute such Executable Form under the terms of this License, or sublicense it under different terms, provided that the license for the Executable Form does not attempt to limit or alter the recipients' rights in the Source Code Form under this License. 3.3. Distribution of a Larger Work You may create and distribute a Larger Work under terms of Your choice, provided that You also comply with the requirements of this License for the Covered Software. If the Larger Work is a combination of Covered Software with a work governed by one or more Secondary Licenses, and the Covered Software is not Incompatible With Secondary Licenses, this License permits You to additionally distribute such Covered Software under the terms of such Secondary License(s), so that the recipient of the Larger Work may, at their option, further distribute the Covered Software under the terms of either this License or such Secondary License(s). 3.4. Notices You may not remove or alter the substance of any license notices (including copyright notices, patent notices, disclaimers of warranty, or limitations of liability) contained within the Source Code Form of the Covered Software, except that You may alter any license notices to the extent required to remedy known factual inaccuracies. 3.5. Application of Additional Terms You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, You may do so only on Your own behalf, and not on behalf of any Contributor. You must make it absolutely clear that any such warranty, support, indemnity, or liability obligation is offered by You alone, and You hereby agree to indemnify every Contributor for any liability incurred by such Contributor as a result of warranty, support, indemnity or liability terms You offer. You may include additional disclaimers of warranty and limitations of liability specific to any jurisdiction. 4. Inability to Comply Due to Statute or Regulation --------------------------------------------------- If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Software due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be placed in a text file included with all distributions of the Covered Software under this License. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it. 5. Termination -------------- 5.1. The rights granted under this License will terminate automatically if You fail to comply with any of its terms. However, if You become compliant, then the rights granted under this License from a particular Contributor are reinstated (a) provisionally, unless and until such Contributor explicitly and finally terminates Your grants, and (b) on an ongoing basis, if such Contributor fails to notify You of the non-compliance by some reasonable means prior to 60 days after You have come back into compliance. Moreover, Your grants from a particular Contributor are reinstated on an ongoing basis if such Contributor notifies You of the non-compliance by some reasonable means, this is the first time You have received notice of non-compliance with this License from such Contributor, and You become compliant prior to 30 days after Your receipt of the notice. 5.2. If You initiate litigation against any entity by asserting a patent infringement claim (excluding declaratory judgment actions, counter-claims, and cross-claims) alleging that a Contributor Version directly or indirectly infringes any patent, then the rights granted to You by any and all Contributors for the Covered Software under Section 2.1 of this License shall terminate. 5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or Your distributors under this License prior to termination shall survive termination. ************************************************************************ * * * 6. Disclaimer of Warranty * * ------------------------- * * * * Covered Software is provided under this License on an "as is" * * basis, without warranty of any kind, either expressed, implied, or * * statutory, including, without limitation, warranties that the * * Covered Software is free of defects, merchantable, fit for a * * particular purpose or non-infringing. The entire risk as to the * * quality and performance of the Covered Software is with You. * * Should any Covered Software prove defective in any respect, You * * (not any Contributor) assume the cost of any necessary servicing, * * repair, or correction. This disclaimer of warranty constitutes an * * essential part of this License. No use of any Covered Software is * * authorized under this License except under this disclaimer. * * * ************************************************************************ ************************************************************************ * * * 7. Limitation of Liability * * -------------------------- * * * * Under no circumstances and under no legal theory, whether tort * * (including negligence), contract, or otherwise, shall any * * Contributor, or anyone who distributes Covered Software as * * permitted above, be liable to You for any direct, indirect, * * special, incidental, or consequential damages of any character * * including, without limitation, damages for lost profits, loss of * * goodwill, work stoppage, computer failure or malfunction, or any * * and all other commercial damages or losses, even if such party * * shall have been informed of the possibility of such damages. This * * limitation of liability shall not apply to liability for death or * * personal injury resulting from such party's negligence to the * * extent applicable law prohibits such limitation. Some * * jurisdictions do not allow the exclusion or limitation of * * incidental or consequential damages, so this exclusion and * * limitation may not apply to You. * * * ************************************************************************ 8. Litigation ------------- Any litigation relating to this License may be brought only in the courts of a jurisdiction where the defendant maintains its principal place of business and such litigation shall be governed by laws of that jurisdiction, without reference to its conflict-of-law provisions. Nothing in this Section shall prevent a party's ability to bring cross-claims or counter-claims. 9. Miscellaneous ---------------- This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not be used to construe this License against a Contributor. 10. Versions of the License --------------------------- 10.1. New Versions Mozilla Foundation is the license steward. Except as provided in Section 10.3, no one other than the license steward has the right to modify or publish new versions of this License. Each version will be given a distinguishing version number. 10.2. Effect of New Versions You may distribute the Covered Software under the terms of the version of the License under which You originally received the Covered Software, or under the terms of any subsequent version published by the license steward. 10.3. Modified Versions If you create software not governed by this License, and you want to create a new license for such software, you may create and use a modified version of this License if you rename the license and remove any references to the name of the license steward (except to note that such modified license differs from this License). 10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses If You choose to distribute Source Code Form that is Incompatible With Secondary Licenses under the terms of this version of the License, the notice described in Exhibit B of this License must be attached. Exhibit A - Source Code Form License Notice ------------------------------------------- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice. You may add additional accurate notices of copyright ownership. Exhibit B - "Incompatible With Secondary Licenses" Notice --------------------------------------------------------- This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. ================================================ FILE: README.md ================================================ # waypoint-examples ---------------------------------------- HashiCorp Waypoint Community Edition is no longer actively maintained. For additional information on the new vision of Waypoint, check out [this blog post](https://www.hashicorp.com/blog/a-new-vision-for-hcp-waypoint) and the [HCP Waypoint documentation](https://developer.hashicorp.com/hcp/docs/waypoint). ---------------------------------------- You can use these example applications to quickly try out and learn how to use [Waypoint](https://waypointproject.io/). ## Getting Started If you're new to Waypoint, start by reviewing the [Getting Started](https://waypointproject.io/docs/getting-started) page, which includes guided tutorials and quickstart installation and deployment instructions. All guided tutorials use applications in this repository. Detailed tutorials with instructions for provisioning each cloud resource are at [HashiCorp Learn](https://learn.hashicorp.com/waypoint). ## How the Examples are Organized All of the examples in this repository are organized first by deployment platform and then by programming language or web platform. For example: **Docker/nodejs**. Cloud-specific examples are in subdirectories for platform, such as **aws/aws-ecs**. ## Deploying Examples You can experiment with the different examples by entering each directory and running `waypoint init` followed by `waypoint up`. ================================================ FILE: aws/aws-ecs/nodejs/.gitignore ================================================ # Node build artifacts node_modules npm-debug.log # Local development *.env *.dev .DS_Store # Docker Dockerfile docker-compose.yml ================================================ FILE: aws/aws-ecs/nodejs/Procfile ================================================ web: node index.js ================================================ FILE: aws/aws-ecs/nodejs/README.md ================================================ # Waypoint AWS-ECS Example |Title|Description| |---|---| |Pack|Cloud Native Buildpack| |Cloud|AWS| |Language|NodeJS| |Docs|[AWS-ECS](https://www.waypointproject.io/plugins/aws-ecs)| |Tutorial|[HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/aws-ecs)| This example demonstrates the AWS Elastic Container Service `deploy` plugin which also provides a `build` step for the Elastic Container Registry. ================================================ FILE: aws/aws-ecs/nodejs/index.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ const express = require('express') const path = require('path') const PORT = process.env.PORT || 5000 express() .use(express.static(path.join(__dirname, 'public'))) .set('views', path.join(__dirname, 'views')) .set('view engine', 'ejs') .get('/', (req, res) => res.render('pages/index')) .listen(PORT, () => console.log(`Listening on ${ PORT }`)) ================================================ FILE: aws/aws-ecs/nodejs/main.tf ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 terraform { required_providers { aws = { source = "hashicorp/aws" version = "~> 2.70" } } } provider "aws" { region = "us-west-2" } resource "aws_instance" "web" { ami = "ami-04e229bcb91f0f16b" # Nginx instance_type = "t2.medium" count = 1 vpc_security_group_ids = ["${aws_security_group.default.id}"] tags = { Name = "Geoffrey" } } resource "aws_security_group" "default" { name_prefix = "Geoffrey" ingress { from_port = 80 to_port = 80 protocol = "tcp" } ingress { from_port = 22 to_port = 22 protocol = "tcp" } egress { from_port = 0 to_port = 0 protocol = "-1" cidr_blocks = ["0.0.0.0/0"] } tags = { "Created-by" = "Geoffrey" } } output "public_ip" { value = ["${aws_instance.web.*.public_ip}"] } output "public_dns" { value = ["${aws_instance.web.*.public_dns}"] } ================================================ FILE: aws/aws-ecs/nodejs/package.json ================================================ { "name": "node-js-getting-started", "version": "0.3.0", "description": "A sample Node.js app using Express 4", "engines": { "node": "16.x" }, "main": "index.js", "scripts": { "start": "node index.js", "test": "node test.js" }, "dependencies": { "ejs": "^3.1.6", "express": "^4.17.3" }, "keywords": [ "node", "express" ], "license": "MIT" } ================================================ FILE: aws/aws-ecs/nodejs/packer.json ================================================ { "variables": { "aws_access_key": "", "aws_secret_key": "" }, "builders": [ { "type": "amazon-ebs", "access_key": "{{user `aws_access_key`}}", "secret_key": "{{user `aws_secret_key`}}", "region": "us-east-1", "source_ami_filter": { "filters": { "virtualization-type": "hvm", "name": "ubuntu/images/*ubuntu-xenial-16.04-amd64-server-*", "root-device-type": "ebs" }, "owners": ["099720109477"], "most_recent": true }, "instance_type": "t2.micro", "ssh_username": "ubuntu", "ami_name": "packer-example {{timestamp}}" } ] } ================================================ FILE: aws/aws-ecs/nodejs/public/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/pattern-tl.svg), url(/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: aws/aws-ecs/nodejs/views/pages/index.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> <%- include('../partials/header.ejs') %>
Node.js Icon

This Node.js app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: aws/aws-ecs/nodejs/views/partials/header.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> Waypoint Node.js Example ================================================ FILE: aws/aws-ecs/nodejs/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "aws-ecs-nodejs" app "ecs-nodejs-web" { labels = { "service" = "ecs-nodejs-web", "env" = "dev" } build { use "pack" {} registry { use "aws-ecr" { region = "us-east-1" repository = "waypoint-example" tag = "latest" } } } deploy { use "aws-ecs" { region = "us-east-1" memory = "512" } } } ================================================ FILE: aws/aws-ecs/nodejs-terraform/.gitignore ================================================ # Node build artifacts node_modules npm-debug.log # Local development *.env *.dev .DS_Store # Docker Dockerfile docker-compose.yml # Local .terraform directories **/.terraform/* # .tfstate files *.tfstate *.tfstate.* # Crash log files crash.log crash.*.log # Exclude all .tfvars files, which are likely to contain sensitive data, such as # password, private keys, and other secrets. These should not be part of version # control as they are data points which are potentially sensitive and subject # to change depending on the environment. *.tfvars *.tfvars.json # Ignore override files as they are usually used to override resources locally and so # are not checked in override.tf override.tf.json *_override.tf *_override.tf.json # Include override files you do wish to add to version control using negated pattern # !example_override.tf # Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan # example: *tfplan* # Ignore CLI configuration files .terraformrc terraform.rc ================================================ FILE: aws/aws-ecs/nodejs-terraform/Procfile ================================================ web: node index.js ================================================ FILE: aws/aws-ecs/nodejs-terraform/README.md ================================================ # Waypoint AWS-ECS Example with a cluster sourced from TFC |Title|Description| |---|---| |Pack|Cloud Native Buildpack| |Cloud|AWS| |Language|NodeJS| |Docs|[AWS-ECS](https://www.waypointproject.io/plugins/aws-ecs)| |Tutorial|[HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/aws-ecs)| This example demonstrates the AWS Elastic Container Service `deploy` plugin which also provides a `build` step for the Elastic Container Registry. It uses a cluster created with terraform (see the ./terraform directory), and uses the ecs cluster name as an output value in the application. ### Prerequisites - Create a terraform cloud account and run the terraform in the `./terraform` directory - Configure the [terraform-cloud configsourcer](https://www.waypointproject.io/plugins/terraform-cloud#source-parameters). Example: ``` wp config source-set -type=terraform-cloud -config=token=$TFC_TOKEN` ``` - Install a [remote runner](https://www.waypointproject.io/commands/runner-install), and configure your project with a [git url](https://www.waypointproject.io/commands/project-apply#git-url). Dynamic config is not allowed to be sourced on local operations. ================================================ FILE: aws/aws-ecs/nodejs-terraform/index.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ const express = require('express') const path = require('path') const PORT = process.env.PORT || 5000 express() .use(express.static(path.join(__dirname, 'public'))) .set('views', path.join(__dirname, 'views')) .set('view engine', 'ejs') .get('/', (req, res) => res.render('pages/index')) .listen(PORT, () => console.log(`Listening on ${ PORT }`)) ================================================ FILE: aws/aws-ecs/nodejs-terraform/package.json ================================================ { "name": "node-js-getting-started", "version": "0.3.0", "description": "A sample Node.js app using Express 4", "engines": { "node": "16.x" }, "main": "index.js", "scripts": { "start": "node index.js", "test": "node test.js" }, "dependencies": { "ejs": "^3.1.6", "express": "^4.17.3" }, "keywords": [ "node", "express" ], "license": "MIT" } ================================================ FILE: aws/aws-ecs/nodejs-terraform/packer.json ================================================ { "variables": { "aws_access_key": "", "aws_secret_key": "" }, "builders": [ { "type": "amazon-ebs", "access_key": "{{user `aws_access_key`}}", "secret_key": "{{user `aws_secret_key`}}", "region": "us-east-1", "source_ami_filter": { "filters": { "virtualization-type": "hvm", "name": "ubuntu/images/*ubuntu-xenial-16.04-amd64-server-*", "root-device-type": "ebs" }, "owners": ["099720109477"], "most_recent": true }, "instance_type": "t2.micro", "ssh_username": "ubuntu", "ami_name": "packer-example {{timestamp}}" } ] } ================================================ FILE: aws/aws-ecs/nodejs-terraform/public/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/pattern-tl.svg), url(/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: aws/aws-ecs/nodejs-terraform/terraform/.terraform.lock.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 # This file is maintained automatically by "terraform init". # Manual edits may be lost in future updates. provider "registry.terraform.io/hashicorp/aws" { version = "4.29.0" hashes = [ "h1:u0G5dgyBJZgrXicmD/nxSJebNORcQqFkN1jU2emJBUI=", "zh:091615c6dddd556b8cc1cd54e1c5c1fe71b593acebacd0b274a2fed7fc4ca802", "zh:4cc11d7252813b2d7cb52e78b24af8eaf377cc242d1d672a7f8bf680758a4976", "zh:565f46308d6e96a21c273e84e0f73d3f39fd8159fc5aaf41bf65c0b0dd6f1de3", "zh:627b6a5574262b5f07c0e012bcb5c73afd97d90b75389c0ab154b5ae4c0dce8f", "zh:91622572d311c28504fbf14e9364120fbafb3adf8e2d49bfdf014752dac9dac0", "zh:98f37f07628b7c2960335b772a544de6bb90f0f390b9d5fdcc3ac211b9cd7def", "zh:9a6338478ba0e7ca75c5b43e0f91dde12d17273b1dc9934c8ff4d631b8bb837a", "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", "zh:a1cc1fc49e406cba1e98250bc04a47be0b6babf5bb42f23baa40f2dc7f8b90f7", "zh:a251e933412036426e2f7b090000c198feee114270d5724bcc8dd9d674d43689", "zh:b0ef3b92947cc8cea75634139dfbfcae2207a9cb5c31d827cd34e523ca04e919", "zh:fb9ede02c9291e7677877bc21ec5c094da38e3cd44df91da5af36f504be399be", ] } ================================================ FILE: aws/aws-ecs/nodejs-terraform/terraform/backend.tf ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 # Using a single workspace: terraform { backend "remote" { hostname = "app.terraform.io" organization = "hc-waypoint" workspaces { name = "hashiconf-demo" } } } provider "aws" { region = var.region # default_tags { # tags = local.tags # } } ================================================ FILE: aws/aws-ecs/nodejs-terraform/terraform/ecs.tf ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 resource "aws_kms_key" "ecs" { description = "${var.name}-ecs" deletion_window_in_days = 7 } resource "aws_cloudwatch_log_group" "ecs" { name = var.name } resource "aws_ecs_cluster" "cluster" { name = var.name configuration { execute_command_configuration { kms_key_id = aws_kms_key.ecs.arn logging = "OVERRIDE" log_configuration { cloud_watch_encryption_enabled = true cloud_watch_log_group_name = aws_cloudwatch_log_group.ecs.name } } } } ================================================ FILE: aws/aws-ecs/nodejs-terraform/terraform/main.tf ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 data "aws_vpc" "selected" { default = true } output "test" { value = data.aws_vpc.selected.id } terraform { required_providers { aws = { source = "hashicorp/aws" version = "~> 4.29" } } } ================================================ FILE: aws/aws-ecs/nodejs-terraform/terraform/outputs.tf ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 output "ecs_cluster_name" { value = aws_ecs_cluster.cluster.name description = "ecs cluster name" } ================================================ FILE: aws/aws-ecs/nodejs-terraform/terraform/variables.tf ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 variable "name" { type = string description = "Name for infrastructure resources" default = "tfcwaypoint" } # variable "tags" { # type = map(string) # description = "Tags to add to infrastructure resources" # default = {} # } variable "region" { type = string description = "AWS Region" default = "us-west-2" validation { condition = contains(["us-west-2", "us-west-2"], var.region) error_message = "Region must be a valid one for HCP." } } ================================================ FILE: aws/aws-ecs/nodejs-terraform/views/pages/index.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> <%- include('../partials/header.ejs') %>
Node.js Icon

This Node.js app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: aws/aws-ecs/nodejs-terraform/views/partials/header.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> Waypoint Node.js Example ================================================ FILE: aws/aws-ecs/nodejs-terraform/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "njs-ecs-tfc-demo" app "njs-ecs-tfc-demo" { build { use "pack" {} registry { use "aws-ecr" { region = "us-west-2" repository = "njs-ecs-tfc" tag = "latest" } } } deploy { use "aws-ecs" { region = "us-west-2" memory = "512" cluster = var.ecs_cluster } } } variable "ecs_cluster" { default = dynamic("terraform-cloud", { organization = "hc-waypoint" workspace = "hashiconf-demo" output = "ecs_cluster_name" }) type = string sensitive = false description = "name of the ecs cluster to deploy into" } ================================================ FILE: aws/aws-ecs/python/Dockerfile ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 FROM ubuntu:20.04 ENV LC_ALL=C.UTF-8 ENV LANG=C.UTF-8 RUN apt-get update -y && apt-get install python3-pip -y ADD requirements.txt /app/ WORKDIR /app RUN /bin/bash -c "pip3 install --no-cache-dir -r requirements.txt" ADD /app/ /app/ EXPOSE 3000 CMD ["gunicorn", "-b", "0.0.0.0:3000", "wsgi", "-k", "gevent"] ================================================ FILE: aws/aws-ecs/python/README.md ================================================ # Getting Started with Waypoint and Flask This is a slightly-modified version of the docker/python example, with changes to publish to AWS ECR and deploy to AWS ECS, instead of a local Docker setup. 1. Run `waypoint init` in this example directory with `waypoint.hcl`. 1. Run `waypoint up` to build and deploy the application. For more information on Flask, see [https://palletsprojects.com/p/flask/](https://palletsprojects.com/p/flask/). ================================================ FILE: aws/aws-ecs/python/app/app.py ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 from flask import Flask, render_template application = Flask(__name__) @application.route("/") def index(): return (render_template('index.html')) if __name__ == "__main__": application.run(host='0.0.0.0') ================================================ FILE: aws/aws-ecs/python/app/static/images/language.svg.old ================================================ ================================================ FILE: aws/aws-ecs/python/app/static/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/static/images/pattern-tl.svg), url(/static/images/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } .language-image { width: 60px; height: 60px; } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: aws/aws-ecs/python/app/templates/index.html ================================================ Waypoint Flask Example
Flask Icon

This Flask app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: aws/aws-ecs/python/app/wsgi.py ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 from app import application if __name__ == "__main__": application.run() ================================================ FILE: aws/aws-ecs/python/requirements.txt ================================================ gevent gunicorn flask ================================================ FILE: aws/aws-ecs/python/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "aws-ecs-python" app "ecs-python" { labels = { "service" = "ecs-python", "env" = "dev" } build { use "docker" {} registry { use "aws-ecr" { region = "us-east-1" repository = "waypoint-example" tag = "latest" } } } deploy { use "aws-ecs" { region = "us-east-1" memory = "512" } } } ================================================ FILE: aws/ec2/README.md ================================================ # Waypoint AWS-EC2 Example |Title|Description| |---|---| |Pack|N/A| |Cloud|AWS| |Language|N/A| |Docs|[AWS-EC2](https://www.waypointproject.io/plugins/aws-ec2)| |Tutorial|N/A| This example demonstrates the AWS EC2 `deploy` plugin. This uses a public AMI for [NGINX][nginx] in `us-west` region as a simple example. [nginx]:https://bitnami.com/stack/nginx/cloud/aws/amis ================================================ FILE: aws/ec2/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "aws-ec2-nginx-ami" app "ec2-nginx" { labels = { "service" = "ec2-nginx" "env" = "dev" } build { use "aws-ami" { filters = { // See https://bitnami.com/stack/nginx/cloud/aws/amis "image-id" = ["ami-0562fde33e9671bf4"] } region = "us-west-2" } } deploy { use "aws-ec2" { region = "us-west-2" instance_type = "t3a.nano" service_port = 80 } } release { use "aws-alb" { port = 80 } } } ================================================ FILE: aws/lambda/nodejs/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "aws-lambda-nodejs" app "lambda-nodejs-function" { build { use "aws-ecr-pull" { region = var.region repository = "lambda-nodejs" tag = var.tag } } deploy { use "aws-lambda" { region = var.region memory = 512 } } release { use "lambda-function-url" { } } } variable "region" { type = string default = "us-east-1" } variable "tag" { type = string default = "1" } ================================================ FILE: aws/lambda/nodejs-graphql/.gitignore ================================================ node_modules ================================================ FILE: aws/lambda/nodejs-graphql/Dockerfile ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 ########### # Builder # ########### FROM public.ecr.aws/lambda/nodejs:14 as BUILDER WORKDIR /var/task COPY index.js package*.json ./ RUN npm install npm@latest -g RUN npm install RUN npm prune --production ########### # Runtime # ########### FROM public.ecr.aws/lambda/nodejs:14 WORKDIR /var/task COPY --from=BUILDER /var/task ./ CMD [ "index.handler" ] ================================================ FILE: aws/lambda/nodejs-graphql/README.md ================================================ # Waypoint Node.js GraphQL Example |Title|Description| |---|---| |Pack|Docker| |Cloud|AWS| |Language|NodeJS| |Docs|[AWS Lambda](https://www.waypointproject.io/plugins/aws-lambda)| |Tutorial| N/A | This example demonstrates the AWS Lambda `deploy` plugin. It uses [`apollo-server-lambda`][apollo-server-lambda] to handle the mapping of various AWS event objects (API Gateway, ALB, Lambda@Edge) to lambda. To deploy, run `waypoint up`. It will take a few minutes for a brand new load balancer to be fully provisioned. To destroy, run `waypoint destroy -auto-approve` [apollo-server-lambda]: https://github.com/apollographql/apollo-server/tree/main/packages/apollo-server-lambda ================================================ FILE: aws/lambda/nodejs-graphql/index.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ const { ApolloServer, gql } = require("apollo-server-lambda"); const { ApolloServerPluginLandingPageGraphQLPlayground, } = require("apollo-server-core"); const typeDefs = gql` type Echo { message: String! echo(message: String): Echo! } type Query { echo(message: String!): Echo! } `; const resolvers = { Echo: { echo: (parent, args, { dataSources }, info) => { const parentMessage = parent.message; const { message } = args; if (message) { return { message }; } else { return { message: parentMessage }; } }, }, Query: { echo: (parent, args, context, info) => { const { message } = args; return { message }; }, }, }; const server = new ApolloServer({ typeDefs: typeDefs, resolvers: resolvers, introspection: true, plugins: [ApolloServerPluginLandingPageGraphQLPlayground], }); exports.handler = server.createHandler(); ================================================ FILE: aws/lambda/nodejs-graphql/package.json ================================================ { "name": "waypoint-apollo-lambda", "version": "0.1.0", "description": "An Apollo GraphQL server intended to run on AWS Lambda", "main": "index.js", "dependencies": { "apollo-server-core": "^3.6.3", "apollo-server-lambda": "^3.6.3" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [ "node", "graphql" ], "license": "MIT" } ================================================ FILE: aws/lambda/nodejs-graphql/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "waypoint-apollo-lambda" app "waypoint-apollo-lambda-function" { build { use "docker" { buildkit = true platform = "amd64" } registry { use "aws-ecr" { region = var.region repository = var.aws_ecr_repository tag = gitrefpretty() } } } deploy { use "aws-lambda" { region = var.region memory = 256 } } release { use "aws-alb" {} } } variable "aws_ecr_repository" { default = "waypoint-apollo-lambda" type = string description = "AWS ECR repository name" } variable "region" { default = "us-east-1" type = string description = "AWS region" } ================================================ FILE: aws/lambda/ruby/Dockerfile ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 FROM public.ecr.aws/lambda/ruby:2.7 COPY handler.rb /var/task CMD [ "handler.handler" ] ================================================ FILE: aws/lambda/ruby/README.md ================================================ # Getting Started with Waypoint and Lambda This repo is a companion repo to the [Deploy Waypoint to AWS Lambda Learn tutorial](https://learn.hashicorp.com/tutorials/waypoint/aws-lambda?in=waypoint/deploy-aws). ================================================ FILE: aws/lambda/ruby/handler.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 require 'json' def handler(event:, context:) qs = event.fetch("queryStringParameters", {}) name = qs.fetch("name", "unknown user") STDERR.puts "Handling ALB request for #{name}" { "statusCode": 200, "statusDescription": "200 OK", "isBase64Encoded": false, "headers": { "Content-Type": "text/html" }, "body": "

Howdy #{name} from Lambda!

" } end ================================================ FILE: aws/lambda/ruby/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "learn-waypoint-lambda" app "learn-waypoint-lambda-function" { build { use "docker" {} registry { use "aws-ecr" { region = "us-west-2" repository = "learn-waypoint-lambda" tag = "howdy-waypoint-lambda" } } } deploy { use "aws-lambda" { region = "us-west-2" } } release { use "aws-alb" { } } } ================================================ FILE: azure/azure-container-instance/nodejs/.gitignore ================================================ # Node build artifacts node_modules npm-debug.log # Local development *.env *.dev .DS_Store # Docker Dockerfile docker-compose.yml ================================================ FILE: azure/azure-container-instance/nodejs/Procfile ================================================ web: node index.js ================================================ FILE: azure/azure-container-instance/nodejs/README.md ================================================ # Waypoint ACI Example |Title|Description| |---|---| |Pack|Cloud Native Buildpack| |Cloud|Azure| |Language|NodeJS| |Docs|[Azure ACI](https://www.waypointproject.io/plugins/azure-container-instances)| |Tutorial|[HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/azure-container-instance?in=waypoint/deploy-azure)| ================================================ FILE: azure/azure-container-instance/nodejs/index.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ const express = require('express') const path = require('path') const PORT = process.env.PORT || 5000 express() .use(express.static(path.join(__dirname, 'public'))) .set('views', path.join(__dirname, 'views')) .set('view engine', 'ejs') .get('/', (req, res) => res.render('pages/index')) .listen(PORT, () => console.log(`Listening on ${ PORT }`)) ================================================ FILE: azure/azure-container-instance/nodejs/package.json ================================================ { "name": "node-js-getting-started", "version": "0.3.0", "description": "A sample Node.js app using Express 4", "engines": { "node": "12.x" }, "main": "index.js", "scripts": { "start": "node index.js", "test": "node test.js" }, "dependencies": { "ejs": "^2.5.6", "express": "^4.15.2" }, "devDependencies": { "got": "^11.3.0", "tape": "^4.7.0" }, "keywords": [ "node", "express" ], "license": "MIT" } ================================================ FILE: azure/azure-container-instance/nodejs/public/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/pattern-tl.svg), url(/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: azure/azure-container-instance/nodejs/views/pages/index.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> <% include ../partials/header.ejs %>
Node.js Icon

This Node.js app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: azure/azure-container-instance/nodejs/views/partials/header.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> Waypoint Node.js Example ================================================ FILE: azure/azure-container-instance/nodejs/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "azure-container-nodejs" app "container-nodejs-web" { labels = { "service" = "nodejs-web", "env" = "dev" } build { use "pack" {} registry { use "docker" { image = ".azurecr.io/example-nodejs" tag = "latest" } } } deploy { use "azure-container-instance" { resource_group = "DefaultResourceGroup-EUS" location = "eastus" ports = [8080] capacity { memory = "512" cpu_count = 1 } } } } ================================================ FILE: docker/angular/Procfile ================================================ web: node server.js ================================================ FILE: docker/angular/README.md ================================================ # Angular Waypoint Demo Application ![Angular Waypoint](angular-waypoint.png) This application deploys an Angular based application, built in Waypoint using the [pack builder](https://www.waypointproject.io/docs/lifecycle/build#cloud-native-buildpacks) , with a [Procfile](https://www.waypointproject.io/docs/lifecycle/build#customizing-the-buildpack-launch-command) to control the hosting server process. During Waypoint's `build` phase the Buildpack detects the language type and generates the static files using the `build` command located in the `package.json` file. In this case, the Buildpack also detects the presence of the Procfile, and uses the command contained within to launch the server process. In the case of this deployment, it uses NodeJS (the `node` command) to launch an ExpressJS server to host the static files. ## Customization of the Angular Application To change aspects of the application, you can edit the `src/app/app.component.html` component file. SCSS files can be customized by either applying them to the component's SCSS file at `src/app/app.component.scss` or at the global SCSS file (`styles.scss`) in the root directory. ## Deploying the Application To deploy this application, initialize against against a Waypoint server by issuing a `waypoint init` command. Once registered against a server, and execute the `waypoint up` command. ================================================ FILE: docker/angular/angular.json ================================================ { "$schema": "./node_modules/@angular/cli/lib/config/schema.json", "version": 1, "newProjectRoot": "projects", "projects": { "angular": { "projectType": "application", "schematics": { "@schematics/angular:component": { "style": "scss" } }, "root": "", "sourceRoot": "src", "prefix": "app", "architect": { "build": { "builder": "@angular-devkit/build-angular:browser", "options": { "outputPath": "dist/angular", "index": "src/index.html", "main": "src/main.ts", "polyfills": "src/polyfills.ts", "tsConfig": "tsconfig.app.json", "aot": false, "assets": ["src/favicon.ico", "src/assets"], "styles": ["src/styles.scss"], "scripts": [] }, "configurations": { "production": { "fileReplacements": [ { "replace": "src/environments/environment.ts", "with": "src/environments/environment.prod.ts" } ], "optimization": true, "outputHashing": "all", "sourceMap": false, "extractCss": true, "namedChunks": false, "aot": true, "extractLicenses": true, "vendorChunk": false, "buildOptimizer": true, "budgets": [ { "type": "initial", "maximumWarning": "2mb", "maximumError": "5mb" }, { "type": "anyComponentStyle", "maximumWarning": "6kb", "maximumError": "10kb" } ] } } }, "serve": { "builder": "@angular-devkit/build-angular:dev-server", "options": { "browserTarget": "angular:build" }, "configurations": { "production": { "browserTarget": "angular:build:production" } } }, "extract-i18n": { "builder": "@angular-devkit/build-angular:extract-i18n", "options": { "browserTarget": "angular:build" } }, "test": { "builder": "@angular-devkit/build-angular:karma", "options": { "main": "src/test.ts", "polyfills": "src/polyfills.ts", "tsConfig": "tsconfig.spec.json", "karmaConfig": "karma.conf.js", "assets": ["src/favicon.ico", "src/assets"], "styles": ["src/styles.scss"], "scripts": [] } }, "lint": { "builder": "@angular-devkit/build-angular:tslint", "options": { "tsConfig": [ "tsconfig.app.json", "tsconfig.spec.json", "e2e/tsconfig.json" ], "exclude": ["**/node_modules/**"] } }, "e2e": { "builder": "@angular-devkit/build-angular:protractor", "options": { "protractorConfig": "e2e/protractor.conf.js", "devServerTarget": "angular:serve" }, "configurations": { "production": { "devServerTarget": "angular:serve:production" } } } } } }, "defaultProject": "angular" } ================================================ FILE: docker/angular/browserslist ================================================ # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. # For additional information regarding the format and rule options, please see: # https://github.com/browserslist/browserslist#queries # You can see what browsers were selected by your queries by running: # npx browserslist > 0.5% last 2 versions Firefox ESR not dead not IE 9-11 # For IE 9-11 support, remove 'not'. ================================================ FILE: docker/angular/e2e/protractor.conf.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ // @ts-check // Protractor configuration file, see link for more information // https://github.com/angular/protractor/blob/master/lib/config.ts const { SpecReporter } = require('jasmine-spec-reporter'); /** * @type { import("protractor").Config } */ exports.config = { allScriptsTimeout: 11000, specs: [ './src/**/*.e2e-spec.ts' ], capabilities: { browserName: 'chrome' }, directConnect: true, baseUrl: 'http://localhost:4200/', framework: 'jasmine', jasmineNodeOpts: { showColors: true, defaultTimeoutInterval: 30000, print: function() {} }, onPrepare() { require('ts-node').register({ project: require('path').join(__dirname, './tsconfig.json') }); jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); } }; ================================================ FILE: docker/angular/e2e/src/app.e2e-spec.ts ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ import { AppPage } from './app.po'; import { browser, logging } from 'protractor'; describe('workspace-project App', () => { let page: AppPage; beforeEach(() => { page = new AppPage(); }); it('should display welcome message', () => { page.navigateTo(); expect(page.getTitleText()).toEqual('angulardemo app is running!'); }); afterEach(async () => { // Assert that there are no errors emitted from the browser const logs = await browser.manage().logs().get(logging.Type.BROWSER); expect(logs).not.toContain(jasmine.objectContaining({ level: logging.Level.SEVERE, } as logging.Entry)); }); }); ================================================ FILE: docker/angular/e2e/src/app.po.ts ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ import { browser, by, element } from 'protractor'; export class AppPage { navigateTo() { return browser.get(browser.baseUrl) as Promise; } getTitleText() { return element(by.css('app-root .content span')).getText() as Promise; } } ================================================ FILE: docker/angular/e2e/tsconfig.json ================================================ { "extends": "../tsconfig.json", "compilerOptions": { "outDir": "../out-tsc/e2e", "module": "commonjs", "target": "es5", "types": ["jasmine", "jasminewd2", "node"] } } ================================================ FILE: docker/angular/karma.conf.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ // Karma configuration file, see link for more information // https://karma-runner.github.io/1.0/config/configuration-file.html module.exports = function (config) { config.set({ basePath: "", frameworks: ["jasmine", "@angular-devkit/build-angular"], plugins: [ require("karma-jasmine"), require("karma-chrome-launcher"), require("karma-jasmine-html-reporter"), require("karma-coverage-istanbul-reporter"), require("@angular-devkit/build-angular/plugins/karma"), ], client: { clearContext: false, // leave Jasmine Spec Runner output visible in browser }, coverageIstanbulReporter: { dir: require("path").join(__dirname, "./coverage/angular"), reports: ["html", "lcovonly", "text-summary"], fixWebpackSourcePaths: true, }, reporters: ["progress", "kjhtml"], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: true, browsers: ["Chrome"], singleRun: false, restartOnFileChange: true, }); }; ================================================ FILE: docker/angular/package.json ================================================ { "name": "angular", "version": "0.0.0", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/animations": "~8.2.14", "@angular/common": "~8.2.14", "@angular/compiler": "~8.2.14", "@angular/core": "~8.2.14", "@angular/forms": "~8.2.14", "@angular/platform-browser": "~8.2.14", "@angular/platform-browser-dynamic": "~8.2.14", "@angular/router": "~8.2.14", "ejs": "^3.1.5", "express": "^4.17.1", "rxjs": "~6.4.0", "tslib": "^1.10.0", "zone.js": "~0.9.1" }, "devDependencies": { "@angular-devkit/build-angular": "~0.803.23", "@angular/cli": "~8.3.23", "@angular/compiler-cli": "~8.2.14", "@angular/language-service": "~8.2.14", "@types/node": "~8.9.4", "@types/jasmine": "~3.3.8", "@types/jasminewd2": "~2.0.3", "codelyzer": "^5.0.0", "jasmine-core": "~3.4.0", "jasmine-spec-reporter": "~4.2.1", "karma": "~4.1.0", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "~2.0.1", "karma-jasmine": "~2.0.1", "karma-jasmine-html-reporter": "^1.4.0", "protractor": "~5.4.0", "ts-node": "~7.0.0", "tslint": "~5.15.0", "typescript": "~3.5.3" } } ================================================ FILE: docker/angular/server.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ const express = require('express') const path = require('path') const PORT = process.env.PORT || 5000 express() .use(express.static(path.join(__dirname, 'dist/angular/'))) .set('views', path.join(__dirname, 'views')) .set('view engine', 'ejs') .get('/', (req, res) => res.render('pages/index')) .listen(PORT, () => console.log(`Listening on ${ PORT }`)) ================================================ FILE: docker/angular/src/app/app.component.html ================================================ Waypoint Angular Example

This Angular app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: docker/angular/src/app/app.component.scss ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ ================================================ FILE: docker/angular/src/app/app.component.spec.ts ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ import { TestBed, async } from '@angular/core/testing'; import { AppComponent } from './app.component'; describe('AppComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ AppComponent ], }).compileComponents(); })); it('should create the app', () => { const fixture = TestBed.createComponent(AppComponent); const app = fixture.debugElement.componentInstance; expect(app).toBeTruthy(); }); it(`should have as title 'angulardemo'`, () => { const fixture = TestBed.createComponent(AppComponent); const app = fixture.debugElement.componentInstance; expect(app.title).toEqual('angulardemo'); }); it('should render title', () => { const fixture = TestBed.createComponent(AppComponent); fixture.detectChanges(); const compiled = fixture.debugElement.nativeElement; expect(compiled.querySelector('.content span').textContent).toContain('angulardemo app is running!'); }); }); ================================================ FILE: docker/angular/src/app/app.component.ts ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ import { Component } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.scss'] }) export class AppComponent { title = 'angulardemo'; } ================================================ FILE: docker/angular/src/app/app.module.ts ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { AppComponent } from './app.component'; @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule ], providers: [], bootstrap: [AppComponent] }) export class AppModule { } ================================================ FILE: docker/angular/src/assets/.gitkeep ================================================ ================================================ FILE: docker/angular/src/environments/environment.prod.ts ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ export const environment = { production: true }; ================================================ FILE: docker/angular/src/environments/environment.ts ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ // This file can be replaced during build by using the `fileReplacements` array. // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. // The list of file replacements can be found in `angular.json`. export const environment = { production: false }; /* * For easier debugging in development mode, you can import the following file * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. * * This import should be commented out in production mode because it will have a negative impact * on performance if an error is thrown. */ // import 'zone.js/dist/zone-error'; // Included with Angular CLI. ================================================ FILE: docker/angular/src/index.html ================================================ Angular on Waypoint ================================================ FILE: docker/angular/src/main.ts ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ import { enableProdMode } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { AppModule } from './app/app.module'; import { environment } from './environments/environment'; if (environment.production) { enableProdMode(); } platformBrowserDynamic().bootstrapModule(AppModule) .catch(err => console.error(err)); ================================================ FILE: docker/angular/src/polyfills.ts ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ /** * This file includes polyfills needed by Angular and is loaded before the app. * You can add your own extra polyfills to this file. * * This file is divided into 2 sections: * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. * 2. Application imports. Files imported after ZoneJS that should be loaded before your main * file. * * The current setup is for so-called "evergreen" browsers; the last versions of browsers that * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. * * Learn more in https://angular.io/guide/browser-support */ /*************************************************************************************************** * BROWSER POLYFILLS */ /** IE10 and IE11 requires the following for NgClass support on SVG elements */ // import 'classlist.js'; // Run `npm install --save classlist.js`. /** * Web Animations `@angular/platform-browser/animations` * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). */ // import 'web-animations-js'; // Run `npm install --save web-animations-js`. /** * By default, zone.js will patch all possible macroTask and DomEvents * user can disable parts of macroTask/DomEvents patch by setting following flags * because those flags need to be set before `zone.js` being loaded, and webpack * will put import in the top of bundle, so user need to create a separate file * in this directory (for example: zone-flags.ts), and put the following flags * into that file, and then add the following code before importing zone.js. * import './zone-flags.ts'; * * The flags allowed in zone-flags.ts are listed here. * * The following flags will work for all browsers. * * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames * * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js * with the following flag, it will bypass `zone.js` patch for IE/Edge * * (window as any).__Zone_enable_cross_context_check = true; * */ /*************************************************************************************************** * Zone JS is required by default for Angular itself. */ import 'zone.js/dist/zone'; // Included with Angular CLI. /*************************************************************************************************** * APPLICATION IMPORTS */ ================================================ FILE: docker/angular/src/styles.scss ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #e4e5e7; --background: #000; --brand: 4, 198, 194; --headline: #fff; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/assets/pattern-tl.svg), url(/assets/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), 0.5); background: rgba(var(--brand), 0.15); } img.logo { max-width: 60px; max-height: 60px; } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, 0.15); } section a { color: rgb(var(--brand)); } ================================================ FILE: docker/angular/src/test.ts ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ // This file is required by karma.conf.js and loads recursively all the .spec and framework files import 'zone.js/dist/zone-testing'; import { getTestBed } from '@angular/core/testing'; import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; declare const require: any; // First, initialize the Angular testing environment. getTestBed().initTestEnvironment( BrowserDynamicTestingModule, platformBrowserDynamicTesting() ); // Then we find all the tests. const context = require.context('./', true, /\.spec\.ts$/); // And load the modules. context.keys().map(context); ================================================ FILE: docker/angular/tsconfig.app.json ================================================ { "extends": "./tsconfig.json", "compilerOptions": { "outDir": "./out-tsc/app", "types": [] }, "files": [ "src/main.ts", "src/polyfills.ts" ], "include": [ "src/**/*.ts" ], "exclude": [ "src/test.ts", "src/**/*.spec.ts" ] } ================================================ FILE: docker/angular/tsconfig.json ================================================ { "compileOnSave": false, "compilerOptions": { "baseUrl": "./", "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, "downlevelIteration": true, "experimentalDecorators": true, "module": "esnext", "moduleResolution": "node", "importHelpers": true, "target": "es2015", "typeRoots": [ "node_modules/@types" ], "lib": [ "es2018", "dom" ] }, "angularCompilerOptions": { "fullTemplateTypeCheck": true, "strictInjectionParameters": true } } ================================================ FILE: docker/angular/tsconfig.spec.json ================================================ { "extends": "./tsconfig.json", "compilerOptions": { "outDir": "./out-tsc/spec", "types": [ "jasmine", "node" ] }, "files": [ "src/test.ts", "src/polyfills.ts" ], "include": [ "src/**/*.spec.ts", "src/**/*.d.ts" ] } ================================================ FILE: docker/angular/tslint.json ================================================ { "extends": "tslint:recommended", "rules": { "array-type": false, "arrow-parens": false, "deprecation": { "severity": "warning" }, "component-class-suffix": true, "contextual-lifecycle": true, "directive-class-suffix": true, "directive-selector": [ true, "attribute", "app", "camelCase" ], "component-selector": [ true, "element", "app", "kebab-case" ], "import-blacklist": [ true, "rxjs/Rx" ], "interface-name": false, "max-classes-per-file": false, "max-line-length": [ true, 140 ], "member-access": false, "member-ordering": [ true, { "order": [ "static-field", "instance-field", "static-method", "instance-method" ] } ], "no-consecutive-blank-lines": false, "no-console": [ true, "debug", "info", "time", "timeEnd", "trace" ], "no-empty": false, "no-inferrable-types": [ true, "ignore-params" ], "no-non-null-assertion": true, "no-redundant-jsdoc": true, "no-switch-case-fall-through": true, "no-var-requires": false, "object-literal-key-quotes": [ true, "as-needed" ], "object-literal-sort-keys": false, "ordered-imports": false, "quotemark": [ true, "single" ], "trailing-comma": false, "no-conflicting-lifecycle": true, "no-host-metadata-property": true, "no-input-rename": true, "no-inputs-metadata-property": true, "no-output-native": true, "no-output-on-prefix": true, "no-output-rename": true, "no-outputs-metadata-property": true, "template-banana-in-box": true, "template-no-negated-async": true, "use-lifecycle-interface": true, "use-pipe-transform-interface": true }, "rulesDirectory": [ "codelyzer" ] } ================================================ FILE: docker/angular/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "angular-example" app "angular" { build { use "pack" {} } deploy { use "docker" { } } } ================================================ FILE: docker/aspnetapp/.dockerignore ================================================ bin/ obj/ ================================================ FILE: docker/aspnetapp/.gitignore ================================================ bin/* obj/* out/* ================================================ FILE: docker/aspnetapp/Pages/Error.cshtml ================================================ @page @model ErrorModel @{ ViewData["Title"] = "Error"; }

Error.

An error occurred while processing your request.

@if (Model.ShowRequestId) {

Request ID: @Model.RequestId

}

Development Mode

Swapping to the Development environment displays detailed information about the error that occurred.

The Development environment shouldn't be enabled for deployed applications. It can result in displaying sensitive information from exceptions to end users. For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development and restarting the app.

================================================ FILE: docker/aspnetapp/Pages/Error.cshtml.cs ================================================ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.Extensions.Logging; namespace aspnetapp.Pages { [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] public class ErrorModel : PageModel { public string RequestId { get; set; } public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); private readonly ILogger _logger; public ErrorModel(ILogger logger) { _logger = logger; } public void OnGet() { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; } } } ================================================ FILE: docker/aspnetapp/Pages/Index.cshtml ================================================ @page @model IndexModel @{ ViewData["Title"] = "ASP.NET on Waypoint"; }

This ASP.NET app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: docker/aspnetapp/Pages/Index.cshtml.cs ================================================ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.Extensions.Logging; namespace aspnetapp.Pages { public class IndexModel : PageModel { private readonly ILogger _logger; public IndexModel(ILogger logger) { _logger = logger; } public void OnGet() { } } } ================================================ FILE: docker/aspnetapp/Pages/Privacy.cshtml ================================================ @page @model PrivacyModel @{ ViewData["Title"] = "Privacy Policy"; }

@ViewData["Title"]

Use this page to detail your site's privacy policy.

================================================ FILE: docker/aspnetapp/Pages/Privacy.cshtml.cs ================================================ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.Extensions.Logging; namespace aspnetapp.Pages { public class PrivacyModel : PageModel { private readonly ILogger _logger; public PrivacyModel(ILogger logger) { _logger = logger; } public void OnGet() { } } } ================================================ FILE: docker/aspnetapp/Pages/Shared/_Layout.cshtml ================================================  @ViewData["Title"] - Waypoint
Flask Icon
@RenderBody()
================================================ FILE: docker/aspnetapp/Pages/Shared/_ValidationScriptsPartial.cshtml ================================================  ================================================ FILE: docker/aspnetapp/Pages/_ViewImports.cshtml ================================================ @using aspnetapp @namespace aspnetapp.Pages @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers ================================================ FILE: docker/aspnetapp/Pages/_ViewStart.cshtml ================================================ @{ Layout = "_Layout"; } ================================================ FILE: docker/aspnetapp/Program.cs ================================================ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; namespace aspnetapp { public class Program { public static void Main(string[] args) { CreateHostBuilder(args).Build().Run(); } public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); }); } } ================================================ FILE: docker/aspnetapp/Properties/launchSettings.json ================================================ { "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhost:62275", "sslPort": 0 } }, "profiles": { "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, "aspnetapp": { "commandName": "Project", "launchBrowser": true, "applicationUrl": "http://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, "publicdev": { "commandName": "Project", "launchBrowser": true, "applicationUrl": "http://+:80", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } } } } ================================================ FILE: docker/aspnetapp/README.md ================================================ # Waypoint ASP.NET Example |Title|Description| |---|---| |Pack|Cloud Native Buildpack| |Cloud|Local| |Language|ASP.NET| |Docs|[Docker](https://www.waypointproject.io/plugins/docker)| |Tutorial|[HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/get-started-docker)| A barebones ASP.NET app (via [Microsoft docs](https://dotnet.microsoft.com/learn/aspnet/hello-world-tutorial/intro)) which can easily be deployed by Waypoint. Under `Properties/launchSettings.json`, you must set `"applicationUrl": "http://+:80"` so it is accessible outside the container. The buildpack defaults to port `8080`, so you must set `service_port = 8080` in the `deploy` stanza (as shown in `waypoint.hcl`). ================================================ FILE: docker/aspnetapp/Startup.cs ================================================ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; namespace aspnetapp { public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddRazorPages(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); } app.UseStaticFiles(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapRazorPages(); }); } } } ================================================ FILE: docker/aspnetapp/appsettings.Development.json ================================================ { "Logging": { "LogLevel": { "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } } } ================================================ FILE: docker/aspnetapp/appsettings.json ================================================ { "Logging": { "LogLevel": { "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } }, "AllowedHosts": "*" } ================================================ FILE: docker/aspnetapp/aspnetapp.csproj ================================================ netcoreapp3.1 ================================================ FILE: docker/aspnetapp/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "example-dotnet" app "web" { labels = { "service" = "example-dotnet", "env" = "dev" } build { use "pack" { builder = "paketobuildpacks/builder:full" } } # Deploy to Docker deploy { use "docker" { service_port = 8080 } } } ================================================ FILE: docker/aspnetapp/wwwroot/static/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/static/images/pattern-tl.svg), url(/static/images/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } .language-image { width: 60px; height: 60px; } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: docker/go/README.md ================================================ # Waypoint Go Example | Title | Description | | -------- | ------------------------------------------------------------------------------------ | | Pack | Cloud Native Buildpack | | Cloud | Local | | Language | Go | | Docs | [Docker](https://www.waypointproject.io/plugins/docker) | | Tutorial | [HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/get-started-docker) | A barebones Go API, which can easily be deployed by Waypoint. ================================================ FILE: docker/go/go.mod ================================================ module github.com/hashicorp/waypoint-examples/docker/go // +heroku goVersion go1.15 go 1.15 ================================================ FILE: docker/go/main.go ================================================ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 package main import ( "fmt" "log" "net/http" ) func main() { fileServer := http.FileServer(http.Dir("./static")) http.Handle("/", fileServer) fmt.Printf("Starting server at: http://localhost:3000\n") if err := http.ListenAndServe(":3000", nil); err != nil { log.Fatal(err) } } ================================================ FILE: docker/go/static/index.html ================================================ Waypoint Go Example
Icon

This static HTML app was deployed with Waypoint using Go.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: docker/go/static/static/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/static/images/pattern-tl.svg), url(/static/images/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } .language-image { width: 60px; height: 60px; } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: docker/go/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "example-go" app "example-go" { labels = { "service" = "example-go", "env" = "dev" } build { use "pack" {} } deploy { use "docker" {} } } ================================================ FILE: docker/go-multiapp/README.md ================================================ # Waypoint Go Example | Title | Description | | -------- | ------------------------------------------------------------------------------------ | | Pack | Cloud Native Buildpack | | Cloud | Local | | Language | Go | | Docs | [Docker](https://www.waypointproject.io/plugins/docker) | | Tutorial | [HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/get-started-docker) | A barebones Go API, which can easily be deployed by Waypoint. ================================================ FILE: docker/go-multiapp/go.mod ================================================ module github.com/hashicorp/waypoint-examples/docker/go-multiapp // +heroku goVersion go1.17 go 1.17 ================================================ FILE: docker/go-multiapp/main.go ================================================ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 package main import ( "fmt" "log" "net/http" ) func main() { fileServer := http.FileServer(http.Dir("./static")) http.Handle("/", fileServer) fmt.Printf("Starting server at: http://localhost:3000\n") if err := http.ListenAndServe(":3000", nil); err != nil { log.Fatal(err) } } ================================================ FILE: docker/go-multiapp/static/index.html ================================================ Waypoint Go Example
Icon

This static HTML app was deployed with Waypoint using Go.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: docker/go-multiapp/static/static/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/static/images/pattern-tl.svg), url(/static/images/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } .language-image { width: 60px; height: 60px; } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: docker/go-multiapp/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "example-go" app "app-1" { labels = { "service" = "app-1", "env" = "dev" } build { use "pack" {} } deploy { use "docker" {} } } app "app-2" { labels = { "service" = "app-2", "env" = "dev" } build { use "pack" {} } deploy { use "docker" {} } } ================================================ FILE: docker/java/.gitignore ================================================ target/ .env .waypoint/ ### STS ### .apt_generated .classpath .factorypath .project .settings .springBeans .sts4-cache ### IntelliJ IDEA ### .idea *.iws *.iml *.ipr ### NetBeans ### /nbproject/private/ /nbbuild/ /dist/ /nbdist/ /.nb-gradle/ build/ !**/src/main/**/build/ !**/src/test/**/build/ ### VS Code ### .vscode/ ================================================ FILE: docker/java/.mvn/wrapper/maven-wrapper.properties ================================================ distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip ================================================ FILE: docker/java/README.md ================================================ # Java Getting Started |Title|Description| |---|---| |Pack|Multiple (read notes below)| |Cloud|Multiple| |Language|Java| |Docs|[Docker](https://www.waypointproject.io/plugins/docker)| |Tutorial|[HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/get-started-docker)| This is an example Java Spring application that can be deployed with Waypoint. Waypoint defaults to using Heroku buildpacks if you do not specify a [builder variable](https://waypointproject.io/plugins/pack#builder) in the `waypoint.hcl` configuration section for `pack` within the `build` section. This example uses Heroku buildpacks by default. This example also supports using [Cloud Foundry Paketo Buildpacks](https://paketo.io/docs/) and [Google Cloud Platform (GCP) Buildpacks](https://github.com/GoogleCloudPlatform/buildpacks). # Deploying the example application. 1. Install a Waypoint Server up and ensure `waypoint context verify` is successful. 1. `waypoint init` 1. `waypoint up` 1. Visit a URL provided in the `waypoint` output. ## Configuring Waypoint for Cloud Foundry Paketo or GCP Buildpacks. Copy the contents of `waypoint.hcl.paketo` or `waypoint.hcl.gcp` file into `waypoint.hcl` or run a command like `cp waypoint.hcl.paketo waypoint.hcl` from the base directory. Then you can run the `waypoint` commands as described above. There are several `waypoint.hcl` adjustments to enable non-Heroku Buildpacks. 1. The `builder` variable of the `pack` build plugin should specify the a Paketo buildpacks builder image like `paketobuildpacks/builder:base` or `gcr.io/buildpacks/builder:v1`. If no builder image is specified, Waypoint uses the Heroku builder image `heroku/buildpacks:18` by default. 1. The `service_port` variable of the deploy plugin explicity specifies port `8080` which is commonly used by Paketo and GCP buildpacks. The default Waypoint `service_port` is `3000`. Here is a full `waypoint.hcl` example that works with Paketo buildpacks. ``` project = "example-java" app "example-java" { build { use "pack" { builder="paketobuildpacks/builder:base" } } deploy { use "docker" { service_port=8080 } } } ``` Here is a full `waypoint.hcl` example that works with GCP buildpacks. ``` project = "example-java" app "example-java" { build { use "pack" { builder="gcr.io/buildpacks/builder:v1" } } deploy { use "docker" { service_port=8080 } } } ``` ================================================ FILE: docker/java/mvnw ================================================ #!/bin/sh # ---------------------------------------------------------------------------- # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # ---------------------------------------------------------------------------- # ---------------------------------------------------------------------------- # Maven2 Start Up Batch script # # Required ENV vars: # ------------------ # JAVA_HOME - location of a JDK home dir # # Optional ENV vars # ----------------- # M2_HOME - location of maven2's installed home dir # MAVEN_OPTS - parameters passed to the Java VM when running Maven # e.g. to debug Maven itself, use # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 # MAVEN_SKIP_RC - flag to disable loading of mavenrc files # ---------------------------------------------------------------------------- if [ -z "$MAVEN_SKIP_RC" ] ; then if [ -f /etc/mavenrc ] ; then . /etc/mavenrc fi if [ -f "$HOME/.mavenrc" ] ; then . "$HOME/.mavenrc" fi fi # OS specific support. $var _must_ be set to either true or false. cygwin=false; darwin=false; mingw=false case "`uname`" in CYGWIN*) cygwin=true ;; MINGW*) mingw=true;; Darwin*) darwin=true # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home # See https://developer.apple.com/library/mac/qa/qa1170/_index.html if [ -z "$JAVA_HOME" ]; then if [ -x "/usr/libexec/java_home" ]; then export JAVA_HOME="`/usr/libexec/java_home`" else export JAVA_HOME="/Library/Java/Home" fi fi ;; esac if [ -z "$JAVA_HOME" ] ; then if [ -r /etc/gentoo-release ] ; then JAVA_HOME=`java-config --jre-home` fi fi if [ -z "$M2_HOME" ] ; then ## resolve links - $0 may be a link to maven's home PRG="$0" # need this for relative symlinks while [ -h "$PRG" ] ; do ls=`ls -ld "$PRG"` link=`expr "$ls" : '.*-> \(.*\)$'` if expr "$link" : '/.*' > /dev/null; then PRG="$link" else PRG="`dirname "$PRG"`/$link" fi done saveddir=`pwd` M2_HOME=`dirname "$PRG"`/.. # make it fully qualified M2_HOME=`cd "$M2_HOME" && pwd` cd "$saveddir" # echo Using m2 at $M2_HOME fi # For Cygwin, ensure paths are in UNIX format before anything is touched if $cygwin ; then [ -n "$M2_HOME" ] && M2_HOME=`cygpath --unix "$M2_HOME"` [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"` fi # For Mingw, ensure paths are in UNIX format before anything is touched if $mingw ; then [ -n "$M2_HOME" ] && M2_HOME="`(cd "$M2_HOME"; pwd)`" [ -n "$JAVA_HOME" ] && JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" # TODO classpath? fi if [ -z "$JAVA_HOME" ]; then javaExecutable="`which javac`" if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then # readlink(1) is not available as standard on Solaris 10. readLink=`which readlink` if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then if $darwin ; then javaHome="`dirname \"$javaExecutable\"`" javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" else javaExecutable="`readlink -f \"$javaExecutable\"`" fi javaHome="`dirname \"$javaExecutable\"`" javaHome=`expr "$javaHome" : '\(.*\)/bin'` JAVA_HOME="$javaHome" export JAVA_HOME fi fi fi if [ -z "$JAVACMD" ] ; then if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables JAVACMD="$JAVA_HOME/jre/sh/java" else JAVACMD="$JAVA_HOME/bin/java" fi else JAVACMD="`which java`" fi fi if [ ! -x "$JAVACMD" ] ; then echo "Error: JAVA_HOME is not defined correctly." >&2 echo " We cannot execute $JAVACMD" >&2 exit 1 fi if [ -z "$JAVA_HOME" ] ; then echo "Warning: JAVA_HOME environment variable is not set." fi CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher # traverses directory structure from process work directory to filesystem root # first directory with .mvn subdirectory is considered project base directory find_maven_basedir() { if [ -z "$1" ] then echo "Path not specified to find_maven_basedir" return 1 fi basedir="$1" wdir="$1" while [ "$wdir" != '/' ] ; do if [ -d "$wdir"/.mvn ] ; then basedir=$wdir break fi # workaround for JBEAP-8937 (on Solaris 10/Sparc) if [ -d "${wdir}" ]; then wdir=`cd "$wdir/.."; pwd` fi # end of workaround done echo "${basedir}" } # concatenates all lines of a file concat_lines() { if [ -f "$1" ]; then echo "$(tr -s '\n' ' ' < "$1")" fi } BASE_DIR=`find_maven_basedir "$(pwd)"` if [ -z "$BASE_DIR" ]; then exit 1; fi export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} if [ "$MVNW_VERBOSE" = true ]; then echo $MAVEN_PROJECTBASEDIR fi MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" # For Cygwin, switch paths to Windows format before running java if $cygwin; then [ -n "$M2_HOME" ] && M2_HOME=`cygpath --path --windows "$M2_HOME"` [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --windows "$CLASSPATH"` [ -n "$MAVEN_PROJECTBASEDIR" ] && MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` fi WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain exec "$JAVACMD" \ $MAVEN_OPTS \ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" #!/bin/sh # ---------------------------------------------------------------------------- # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # ---------------------------------------------------------------------------- # ---------------------------------------------------------------------------- # Maven Start Up Batch script # # Required ENV vars: # ------------------ # JAVA_HOME - location of a JDK home dir # # Optional ENV vars # ----------------- # M2_HOME - location of maven2's installed home dir # MAVEN_OPTS - parameters passed to the Java VM when running Maven # e.g. to debug Maven itself, use # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 # MAVEN_SKIP_RC - flag to disable loading of mavenrc files # ---------------------------------------------------------------------------- if [ -z "$MAVEN_SKIP_RC" ] ; then if [ -f /etc/mavenrc ] ; then . /etc/mavenrc fi if [ -f "$HOME/.mavenrc" ] ; then . "$HOME/.mavenrc" fi fi # OS specific support. $var _must_ be set to either true or false. cygwin=false; darwin=false; mingw=false case "`uname`" in CYGWIN*) cygwin=true ;; MINGW*) mingw=true;; Darwin*) darwin=true # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home # See https://developer.apple.com/library/mac/qa/qa1170/_index.html if [ -z "$JAVA_HOME" ]; then if [ -x "/usr/libexec/java_home" ]; then export JAVA_HOME="`/usr/libexec/java_home`" else export JAVA_HOME="/Library/Java/Home" fi fi ;; esac if [ -z "$JAVA_HOME" ] ; then if [ -r /etc/gentoo-release ] ; then JAVA_HOME=`java-config --jre-home` fi fi if [ -z "$M2_HOME" ] ; then ## resolve links - $0 may be a link to maven's home PRG="$0" # need this for relative symlinks while [ -h "$PRG" ] ; do ls=`ls -ld "$PRG"` link=`expr "$ls" : '.*-> \(.*\)$'` if expr "$link" : '/.*' > /dev/null; then PRG="$link" else PRG="`dirname "$PRG"`/$link" fi done saveddir=`pwd` M2_HOME=`dirname "$PRG"`/.. # make it fully qualified M2_HOME=`cd "$M2_HOME" && pwd` cd "$saveddir" # echo Using m2 at $M2_HOME fi # For Cygwin, ensure paths are in UNIX format before anything is touched if $cygwin ; then [ -n "$M2_HOME" ] && M2_HOME=`cygpath --unix "$M2_HOME"` [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"` fi # For Mingw, ensure paths are in UNIX format before anything is touched if $mingw ; then [ -n "$M2_HOME" ] && M2_HOME="`(cd "$M2_HOME"; pwd)`" [ -n "$JAVA_HOME" ] && JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" fi if [ -z "$JAVA_HOME" ]; then javaExecutable="`which javac`" if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then # readlink(1) is not available as standard on Solaris 10. readLink=`which readlink` if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then if $darwin ; then javaHome="`dirname \"$javaExecutable\"`" javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" else javaExecutable="`readlink -f \"$javaExecutable\"`" fi javaHome="`dirname \"$javaExecutable\"`" javaHome=`expr "$javaHome" : '\(.*\)/bin'` JAVA_HOME="$javaHome" export JAVA_HOME fi fi fi if [ -z "$JAVACMD" ] ; then if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables JAVACMD="$JAVA_HOME/jre/sh/java" else JAVACMD="$JAVA_HOME/bin/java" fi else JAVACMD="`which java`" fi fi if [ ! -x "$JAVACMD" ] ; then echo "Error: JAVA_HOME is not defined correctly." >&2 echo " We cannot execute $JAVACMD" >&2 exit 1 fi if [ -z "$JAVA_HOME" ] ; then echo "Warning: JAVA_HOME environment variable is not set." fi CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher # traverses directory structure from process work directory to filesystem root # first directory with .mvn subdirectory is considered project base directory find_maven_basedir() { if [ -z "$1" ] then echo "Path not specified to find_maven_basedir" return 1 fi basedir="$1" wdir="$1" while [ "$wdir" != '/' ] ; do if [ -d "$wdir"/.mvn ] ; then basedir=$wdir break fi # workaround for JBEAP-8937 (on Solaris 10/Sparc) if [ -d "${wdir}" ]; then wdir=`cd "$wdir/.."; pwd` fi # end of workaround done echo "${basedir}" } # concatenates all lines of a file concat_lines() { if [ -f "$1" ]; then echo "$(tr -s '\n' ' ' < "$1")" fi } BASE_DIR=`find_maven_basedir "$(pwd)"` if [ -z "$BASE_DIR" ]; then exit 1; fi ########################################################################################## # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central # This allows using the maven wrapper in projects that prohibit checking in binary data. ########################################################################################## if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then if [ "$MVNW_VERBOSE" = true ]; then echo "Found .mvn/wrapper/maven-wrapper.jar" fi else if [ "$MVNW_VERBOSE" = true ]; then echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." fi if [ -n "$MVNW_REPOURL" ]; then jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" else jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" fi while IFS="=" read key value; do case "$key" in (wrapperUrl) jarUrl="$value"; break ;; esac done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" if [ "$MVNW_VERBOSE" = true ]; then echo "Downloading from: $jarUrl" fi wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" if $cygwin; then wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` fi if command -v wget > /dev/null; then if [ "$MVNW_VERBOSE" = true ]; then echo "Found wget ... using wget" fi if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then wget "$jarUrl" -O "$wrapperJarPath" else wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" fi elif command -v curl > /dev/null; then if [ "$MVNW_VERBOSE" = true ]; then echo "Found curl ... using curl" fi if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then curl -o "$wrapperJarPath" "$jarUrl" -f else curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f fi else if [ "$MVNW_VERBOSE" = true ]; then echo "Falling back to using Java to download" fi javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" # For Cygwin, switch paths to Windows format before running javac if $cygwin; then javaClass=`cygpath --path --windows "$javaClass"` fi if [ -e "$javaClass" ]; then if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then if [ "$MVNW_VERBOSE" = true ]; then echo " - Compiling MavenWrapperDownloader.java ..." fi # Compiling the Java class ("$JAVA_HOME/bin/javac" "$javaClass") fi if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then # Running the downloader if [ "$MVNW_VERBOSE" = true ]; then echo " - Running MavenWrapperDownloader.java ..." fi ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") fi fi fi fi ########################################################################################## # End of extension ########################################################################################## export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} if [ "$MVNW_VERBOSE" = true ]; then echo $MAVEN_PROJECTBASEDIR fi MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" # For Cygwin, switch paths to Windows format before running java if $cygwin; then [ -n "$M2_HOME" ] && M2_HOME=`cygpath --path --windows "$M2_HOME"` [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --windows "$CLASSPATH"` [ -n "$MAVEN_PROJECTBASEDIR" ] && MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` fi # Provide a "standardized" way to retrieve the CLI args that will # work with both Windows and non-Windows executions. MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" export MAVEN_CMD_LINE_ARGS WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain exec "$JAVACMD" \ $MAVEN_OPTS \ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" ================================================ FILE: docker/java/mvnw.cmd ================================================ @REM ---------------------------------------------------------------------------- @REM Licensed to the Apache Software Foundation (ASF) under one @REM or more contributor license agreements. See the NOTICE file @REM distributed with this work for additional information @REM regarding copyright ownership. The ASF licenses this file @REM to you under the Apache License, Version 2.0 (the @REM "License"); you may not use this file except in compliance @REM with the License. You may obtain a copy of the License at @REM @REM https://www.apache.org/licenses/LICENSE-2.0 @REM @REM Unless required by applicable law or agreed to in writing, @REM software distributed under the License is distributed on an @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @REM KIND, either express or implied. See the License for the @REM specific language governing permissions and limitations @REM under the License. @REM ---------------------------------------------------------------------------- @REM ---------------------------------------------------------------------------- @REM Maven Start Up Batch script @REM @REM Required ENV vars: @REM JAVA_HOME - location of a JDK home dir @REM @REM Optional ENV vars @REM M2_HOME - location of maven2's installed home dir @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven @REM e.g. to debug Maven itself, use @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files @REM ---------------------------------------------------------------------------- @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' @echo off @REM set title of command window title %0 @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% @REM set %HOME% to equivalent of $HOME if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") @REM Execute a user defined script before this one if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre @REM check for pre script, once with legacy .bat ending and once with .cmd ending if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" :skipRcPre @setlocal set ERROR_CODE=0 @REM To isolate internal variables from possible post scripts, we use another setlocal @setlocal @REM ==== START VALIDATION ==== if not "%JAVA_HOME%" == "" goto OkJHome echo. echo Error: JAVA_HOME not found in your environment. >&2 echo Please set the JAVA_HOME variable in your environment to match the >&2 echo location of your Java installation. >&2 echo. goto error :OkJHome if exist "%JAVA_HOME%\bin\java.exe" goto init echo. echo Error: JAVA_HOME is set to an invalid directory. >&2 echo JAVA_HOME = "%JAVA_HOME%" >&2 echo Please set the JAVA_HOME variable in your environment to match the >&2 echo location of your Java installation. >&2 echo. goto error @REM ==== END VALIDATION ==== :init @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". @REM Fallback to current working directory if not found. set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir set EXEC_DIR=%CD% set WDIR=%EXEC_DIR% :findBaseDir IF EXIST "%WDIR%"\.mvn goto baseDirFound cd .. IF "%WDIR%"=="%CD%" goto baseDirNotFound set WDIR=%CD% goto findBaseDir :baseDirFound set MAVEN_PROJECTBASEDIR=%WDIR% cd "%EXEC_DIR%" goto endDetectBaseDir :baseDirNotFound set MAVEN_PROJECTBASEDIR=%EXEC_DIR% cd "%EXEC_DIR%" :endDetectBaseDir IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig @setlocal EnableExtensions EnableDelayedExpansion for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% :endReadAdditionalConfig SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B ) @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central @REM This allows using the maven wrapper in projects that prohibit checking in binary data. if exist %WRAPPER_JAR% ( if "%MVNW_VERBOSE%" == "true" ( echo Found %WRAPPER_JAR% ) ) else ( if not "%MVNW_REPOURL%" == "" ( SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" ) if "%MVNW_VERBOSE%" == "true" ( echo Couldn't find %WRAPPER_JAR%, downloading it ... echo Downloading from: %DOWNLOAD_URL% ) powershell -Command "&{"^ "$webclient = new-object System.Net.WebClient;"^ "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ "}"^ "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ "}" if "%MVNW_VERBOSE%" == "true" ( echo Finished downloading %WRAPPER_JAR% ) ) @REM End of extension @REM Provide a "standardized" way to retrieve the CLI args that will @REM work with both Windows and non-Windows executions. set MAVEN_CMD_LINE_ARGS=%* %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* if ERRORLEVEL 1 goto error goto end :error set ERROR_CODE=1 :end @endlocal & set ERROR_CODE=%ERROR_CODE% if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost @REM check for post script, once with legacy .bat ending and once with .cmd ending if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" :skipRcPost @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' if "%MAVEN_BATCH_PAUSE%" == "on" pause if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% exit /B %ERROR_CODE% ================================================ FILE: docker/java/pom.xml ================================================ 4.0.0 org.springframework.boot spring-boot-starter-parent 2.3.4.RELEASE com.example waypoint 0.0.1-SNAPSHOT waypoint Demo project for Spring Boot 11 org.springframework.boot spring-boot-starter-actuator org.springframework.boot spring-boot-starter-thymeleaf org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-test test org.junit.vintage junit-vintage-engine org.springframework.boot spring-boot-maven-plugin ================================================ FILE: docker/java/src/main/java/com/example/waypoint/WaypointApplication.java ================================================ /* * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ package com.example.waypoint; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller @SpringBootApplication public class WaypointApplication { public static void main(String[] args) { SpringApplication.run(WaypointApplication.class, args); } @RequestMapping("/") String index() { return "index"; } } ================================================ FILE: docker/java/src/main/resources/application.properties ================================================ ================================================ FILE: docker/java/src/main/resources/public/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/pattern-tl.svg), url(/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: docker/java/src/main/resources/templates/fragments/layout.html ================================================ Waypoint Java Example
================================================ FILE: docker/java/src/main/resources/templates/index.html ================================================
Java Icon

This Java app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: docker/java/src/test/java/com/example/waypoint/WaypointApplicationTests.java ================================================ /* * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ package com.example.waypoint; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class WaypointApplicationTests { @Test void contextLoads() { } } ================================================ FILE: docker/java/system.properties ================================================ java.runtime.version=11 ================================================ FILE: docker/java/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "example-java" app "example-java" { build { use "pack" { builder = "gcr.io/buildpacks/builder:v1" } } deploy { use "docker" { service_port = 8080 } } } ================================================ FILE: docker/java/waypoint.hcl.gcp ================================================ project = "example-java" app "example-java" { build { use "pack" { builder="gcr.io/buildpacks/builder:v1" } } deploy { use "docker" { service_port=8080 } } } ================================================ FILE: docker/java/waypoint.hcl.heroku ================================================ project = "example-java" app "example-java" { build { use "pack" {} } deploy { use "docker" {} } } ================================================ FILE: docker/java/waypoint.hcl.paketo ================================================ project = "example-java" app "example-java" { build { use "pack" { builder="paketobuildpacks/builder:base" } } deploy { use "docker" { service_port=8080 } } } ================================================ FILE: docker/next-js/.gitignore ================================================ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies /node_modules /.pnp .pnp.js # testing /coverage # next.js /.next/ /out/ # production /build # misc .DS_Store *.pem # debug npm-debug.log* yarn-debug.log* yarn-error.log* # local env files .env.local .env.development.local .env.test.local .env.production.local # vercel .vercel ================================================ FILE: docker/next-js/README.md ================================================ # Waypoint Next.js Example |Title|Description| |---|---| |Pack|Cloud Native Buildpack| |Cloud|Local| |Language|JavaScript| |Docs|[Docker](https://www.waypointproject.io/plugins/docker)| |Tutorial|[HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/get-started-docker)| ================================================ FILE: docker/next-js/package.json ================================================ { "name": "next-js", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev", "build": "next build", "start": "next start" }, "dependencies": { "next": "9.5.1", "react": "16.13.1", "react-dom": "16.13.1" } } ================================================ FILE: docker/next-js/pages/_app.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ import '../styles/globals.css' function MyApp({ Component, pageProps }) { return } export default MyApp ================================================ FILE: docker/next-js/pages/api/hello.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ // Next.js API route support: https://nextjs.org/docs/api-routes/introduction export default (req, res) => { res.statusCode = 200 res.json({ name: 'John Doe' }) } ================================================ FILE: docker/next-js/pages/index.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ import Head from 'next/head' import styles from '../styles/Home.module.css' export default function Home() { return (
Waypoint Next.js Example
Logo
Next.js Icon

This Next.js app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

) } ================================================ FILE: docker/next-js/styles/Home.module.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } .content { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } .content h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } .content p { padding-top: 12px; } .content code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } .content a { color: rgb(var(--brand)); } .language { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } ================================================ FILE: docker/next-js/styles/globals.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/pattern-tl.svg), url(/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } ================================================ FILE: docker/next-js/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "example-nextjs" app "example-nextjs" { labels = { "service" = "example-nextjs", "env" = "dev" } build { use "pack" {} } deploy { use "docker" {} } } ================================================ FILE: docker/nodejs/.gitignore ================================================ # Node build artifacts node_modules npm-debug.log # Local development *.env *.dev .DS_Store # Docker Dockerfile docker-compose.yml ================================================ FILE: docker/nodejs/Procfile ================================================ web: node index.js ================================================ FILE: docker/nodejs/README.md ================================================ # Waypoint NodeJS Example |Title|Description| |---|---| |Pack|Cloud Native Buildpack| |Cloud|Local| |Language|JavaScript| |Docs|[Docker](https://www.waypointproject.io/plugins/docker)| |Tutorial|[HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/get-started-docker)| ================================================ FILE: docker/nodejs/index.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ const express = require('express') const path = require('path') const PORT = process.env.PORT || 5000 express() .use(express.static(path.join(__dirname, 'public'))) .set('views', path.join(__dirname, 'views')) .set('view engine', 'ejs') .get('/', (req, res) => res.render('pages/index')) .listen(PORT, () => console.log(`Listening on ${ PORT }`)) ================================================ FILE: docker/nodejs/package.json ================================================ { "name": "node-js-getting-started", "version": "0.3.0", "description": "A sample Node.js app using Express 4", "engines": { "node": "12.x" }, "main": "index.js", "scripts": { "start": "node index.js", "test": "node test.js" }, "dependencies": { "ejs": "^2.5.6", "express": "^4.15.2" }, "devDependencies": { "got": "^11.3.0", "tape": "^4.7.0" }, "keywords": [ "node", "express" ], "license": "MIT" } ================================================ FILE: docker/nodejs/public/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/pattern-tl.svg), url(/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: docker/nodejs/views/pages/index.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> <% include ../partials/header.ejs %>
Node.js Icon

This Node.js app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: docker/nodejs/views/partials/header.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> Waypoint Node.js Example ================================================ FILE: docker/nodejs/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "example-nodejs" app "example-nodejs" { labels = { "service" = "example-nodejs", "env" = "dev" } build { use "pack" {} } deploy { use "docker" {} } } ================================================ FILE: docker/php/.editorconfig ================================================ root = true [*] charset = utf-8 end_of_line = lf insert_final_newline = true indent_style = space indent_size = 4 trim_trailing_whitespace = true [*.md] trim_trailing_whitespace = false [*.{yml,yaml}] indent_size = 2 ================================================ FILE: docker/php/.gitattributes ================================================ * text=auto *.css linguist-vendored *.scss linguist-vendored *.js linguist-vendored CHANGELOG.md export-ignore ================================================ FILE: docker/php/.gitignore ================================================ /node_modules /public/hot /public/storage /storage/*.key /vendor .env.backup .phpunit.result.cache Homestead.json Homestead.yaml npm-debug.log yarn-error.log ================================================ FILE: docker/php/.styleci.yml ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 php: preset: laravel disabled: - unused_use finder: not-name: - index.php - server.php js: finder: not-name: - webpack.mix.js css: true ================================================ FILE: docker/php/Procfile ================================================ web: vendor/bin/heroku-php-nginx public/ ================================================ FILE: docker/php/README.md ================================================ # Waypoint PHP Example |Title|Description| |---|---| |Pack|Cloud Native Buildpack| |Cloud|Local| |Language|PHP| |Docs|[Docker](https://www.waypointproject.io/plugins/docker)| |Tutorial|[HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/get-started-docker)| A barebones Laravel 8 app, which can easily be deployed by Waypoint. This repository provides an .env file to make it easy to deploy the example, however these environment variables should be managed using `waypoint config`. Laravel `TrustProxies` has been set to `*` as an example to allow Laravel to generate the correct SSL asset URL. ================================================ FILE: docker/php/app/Console/Kernel.php ================================================ command('inspire')->hourly(); } /** * Register the commands for the application. * * @return void */ protected function commands() { $this->load(__DIR__.'/Commands'); require base_path('routes/console.php'); } } ================================================ FILE: docker/php/app/Exceptions/Handler.php ================================================ [ \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, // \Illuminate\Session\Middleware\AuthenticateSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, ], 'api' => [ 'throttle:api', \Illuminate\Routing\Middleware\SubstituteBindings::class, ], ]; /** * The application's route middleware. * * These middleware may be assigned to groups or used individually. * * @var array */ protected $routeMiddleware = [ 'auth' => \App\Http\Middleware\Authenticate::class, 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 'can' => \Illuminate\Auth\Middleware\Authorize::class, 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, ]; } ================================================ FILE: docker/php/app/Http/Middleware/Authenticate.php ================================================ expectsJson()) { return route('login'); } } } ================================================ FILE: docker/php/app/Http/Middleware/EncryptCookies.php ================================================ check()) { return redirect(RouteServiceProvider::HOME); } } return $next($request); } } ================================================ FILE: docker/php/app/Http/Middleware/TrimStrings.php ================================================ allSubdomainsOfApplicationUrl(), ]; } } ================================================ FILE: docker/php/app/Http/Middleware/TrustProxies.php ================================================ 'datetime', ]; } ================================================ FILE: docker/php/app/Providers/AppServiceProvider.php ================================================ 'App\Policies\ModelPolicy', ]; /** * Register any authentication / authorization services. * * @return void */ public function boot() { $this->registerPolicies(); // } } ================================================ FILE: docker/php/app/Providers/BroadcastServiceProvider.php ================================================ [ SendEmailVerificationNotification::class, ], ]; /** * Register any events for your application. * * @return void */ public function boot() { // } } ================================================ FILE: docker/php/app/Providers/RouteServiceProvider.php ================================================ configureRateLimiting(); $this->routes(function () { Route::middleware('web') ->group(base_path('routes/web.php')); Route::prefix('api') ->middleware('api') ->group(base_path('routes/api.php')); }); } /** * Configure the rate limiters for the application. * * @return void */ protected function configureRateLimiting() { RateLimiter::for('api', function (Request $request) { return Limit::perMinute(60); }); } } ================================================ FILE: docker/php/artisan ================================================ #!/usr/bin/env php make(Illuminate\Contracts\Console\Kernel::class); $status = $kernel->handle( $input = new Symfony\Component\Console\Input\ArgvInput, new Symfony\Component\Console\Output\ConsoleOutput ); /* |-------------------------------------------------------------------------- | Shutdown The Application |-------------------------------------------------------------------------- | | Once Artisan has finished running, we will fire off the shutdown events | so that any final work may be done by the application before we shut | down the process. This is the last thing to happen to the request. | */ $kernel->terminate($input, $status); exit($status); ================================================ FILE: docker/php/bootstrap/app.php ================================================ singleton( Illuminate\Contracts\Http\Kernel::class, App\Http\Kernel::class ); $app->singleton( Illuminate\Contracts\Console\Kernel::class, App\Console\Kernel::class ); $app->singleton( Illuminate\Contracts\Debug\ExceptionHandler::class, App\Exceptions\Handler::class ); /* |-------------------------------------------------------------------------- | Return The Application |-------------------------------------------------------------------------- | | This script returns the application instance. The instance is given to | the calling script so we can separate the building of the instances | from the actual running of the application and sending responses. | */ return $app; ================================================ FILE: docker/php/bootstrap/cache/.gitignore ================================================ * !.gitignore ================================================ FILE: docker/php/composer.json ================================================ { "name": "laravel/laravel", "type": "project", "description": "The Laravel Framework.", "keywords": [ "framework", "laravel" ], "license": "MIT", "require": { "php": "^7.3", "fideloper/proxy": "^4.2", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^7.0.1", "laravel/framework": "^8.0", "laravel/tinker": "^2.0" }, "require-dev": { "facade/ignition": "^2.3.6", "fzaninotto/faker": "^1.9.1", "mockery/mockery": "^1.3.1", "nunomaduro/collision": "^5.0", "phpunit/phpunit": "^9.3" }, "config": { "optimize-autoloader": true, "preferred-install": "dist", "sort-packages": true }, "extra": { "laravel": { "dont-discover": [] } }, "autoload": { "psr-4": { "App\\": "app/", "Database\\Factories\\": "database/factories/", "Database\\Seeders\\": "database/seeders/" } }, "autoload-dev": { "psr-4": { "Tests\\": "tests/" } }, "minimum-stability": "dev", "prefer-stable": true, "scripts": { "post-autoload-dump": [ "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", "@php artisan package:discover --ansi" ], "post-root-package-install": [ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" ], "post-create-project-cmd": [ "@php artisan key:generate --ansi" ] } } ================================================ FILE: docker/php/config/app.php ================================================ env('APP_NAME', 'Laravel'), /* |-------------------------------------------------------------------------- | Application Environment |-------------------------------------------------------------------------- | | This value determines the "environment" your application is currently | running in. This may determine how you prefer to configure various | services the application utilizes. Set this in your ".env" file. | */ 'env' => env('APP_ENV', 'production'), /* |-------------------------------------------------------------------------- | Application Debug Mode |-------------------------------------------------------------------------- | | When your application is in debug mode, detailed error messages with | stack traces will be shown on every error that occurs within your | application. If disabled, a simple generic error page is shown. | */ 'debug' => (bool) env('APP_DEBUG', false), /* |-------------------------------------------------------------------------- | Application URL |-------------------------------------------------------------------------- | | This URL is used by the console to properly generate URLs when using | the Artisan command line tool. You should set this to the root of | your application so that it is used when running Artisan tasks. | */ 'url' => env('APP_URL', 'http://localhost'), 'asset_url' => env('ASSET_URL', null), /* |-------------------------------------------------------------------------- | Application Timezone |-------------------------------------------------------------------------- | | Here you may specify the default timezone for your application, which | will be used by the PHP date and date-time functions. We have gone | ahead and set this to a sensible default for you out of the box. | */ 'timezone' => 'UTC', /* |-------------------------------------------------------------------------- | Application Locale Configuration |-------------------------------------------------------------------------- | | The application locale determines the default locale that will be used | by the translation service provider. You are free to set this value | to any of the locales which will be supported by the application. | */ 'locale' => 'en', /* |-------------------------------------------------------------------------- | Application Fallback Locale |-------------------------------------------------------------------------- | | The fallback locale determines the locale to use when the current one | is not available. You may change the value to correspond to any of | the language folders that are provided through your application. | */ 'fallback_locale' => 'en', /* |-------------------------------------------------------------------------- | Faker Locale |-------------------------------------------------------------------------- | | This locale will be used by the Faker PHP library when generating fake | data for your database seeds. For example, this will be used to get | localized telephone numbers, street address information and more. | */ 'faker_locale' => 'en_US', /* |-------------------------------------------------------------------------- | Encryption Key |-------------------------------------------------------------------------- | | This key is used by the Illuminate encrypter service and should be set | to a random, 32 character string, otherwise these encrypted strings | will not be safe. Please do this before deploying an application! | */ 'key' => env('APP_KEY'), 'cipher' => 'AES-256-CBC', /* |-------------------------------------------------------------------------- | Autoloaded Service Providers |-------------------------------------------------------------------------- | | The service providers listed here will be automatically loaded on the | request to your application. Feel free to add your own services to | this array to grant expanded functionality to your applications. | */ 'providers' => [ /* * Laravel Framework Service Providers... */ Illuminate\Auth\AuthServiceProvider::class, Illuminate\Broadcasting\BroadcastServiceProvider::class, Illuminate\Bus\BusServiceProvider::class, Illuminate\Cache\CacheServiceProvider::class, Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, Illuminate\Cookie\CookieServiceProvider::class, Illuminate\Database\DatabaseServiceProvider::class, Illuminate\Encryption\EncryptionServiceProvider::class, Illuminate\Filesystem\FilesystemServiceProvider::class, Illuminate\Foundation\Providers\FoundationServiceProvider::class, Illuminate\Hashing\HashServiceProvider::class, Illuminate\Mail\MailServiceProvider::class, Illuminate\Notifications\NotificationServiceProvider::class, Illuminate\Pagination\PaginationServiceProvider::class, Illuminate\Pipeline\PipelineServiceProvider::class, Illuminate\Queue\QueueServiceProvider::class, Illuminate\Redis\RedisServiceProvider::class, Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, Illuminate\Session\SessionServiceProvider::class, Illuminate\Translation\TranslationServiceProvider::class, Illuminate\Validation\ValidationServiceProvider::class, Illuminate\View\ViewServiceProvider::class, /* * Package Service Providers... */ /* * Application Service Providers... */ App\Providers\AppServiceProvider::class, App\Providers\AuthServiceProvider::class, // App\Providers\BroadcastServiceProvider::class, App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, ], /* |-------------------------------------------------------------------------- | Class Aliases |-------------------------------------------------------------------------- | | This array of class aliases will be registered when this application | is started. However, feel free to register as many as you wish as | the aliases are "lazy" loaded so they don't hinder performance. | */ 'aliases' => [ 'App' => Illuminate\Support\Facades\App::class, 'Arr' => Illuminate\Support\Arr::class, 'Artisan' => Illuminate\Support\Facades\Artisan::class, 'Auth' => Illuminate\Support\Facades\Auth::class, 'Blade' => Illuminate\Support\Facades\Blade::class, 'Broadcast' => Illuminate\Support\Facades\Broadcast::class, 'Bus' => Illuminate\Support\Facades\Bus::class, 'Cache' => Illuminate\Support\Facades\Cache::class, 'Config' => Illuminate\Support\Facades\Config::class, 'Cookie' => Illuminate\Support\Facades\Cookie::class, 'Crypt' => Illuminate\Support\Facades\Crypt::class, 'DB' => Illuminate\Support\Facades\DB::class, 'Eloquent' => Illuminate\Database\Eloquent\Model::class, 'Event' => Illuminate\Support\Facades\Event::class, 'File' => Illuminate\Support\Facades\File::class, 'Gate' => Illuminate\Support\Facades\Gate::class, 'Hash' => Illuminate\Support\Facades\Hash::class, 'Http' => Illuminate\Support\Facades\Http::class, 'Lang' => Illuminate\Support\Facades\Lang::class, 'Log' => Illuminate\Support\Facades\Log::class, 'Mail' => Illuminate\Support\Facades\Mail::class, 'Notification' => Illuminate\Support\Facades\Notification::class, 'Password' => Illuminate\Support\Facades\Password::class, 'Queue' => Illuminate\Support\Facades\Queue::class, 'Redirect' => Illuminate\Support\Facades\Redirect::class, 'Redis' => Illuminate\Support\Facades\Redis::class, 'Request' => Illuminate\Support\Facades\Request::class, 'Response' => Illuminate\Support\Facades\Response::class, 'Route' => Illuminate\Support\Facades\Route::class, 'Schema' => Illuminate\Support\Facades\Schema::class, 'Session' => Illuminate\Support\Facades\Session::class, 'Storage' => Illuminate\Support\Facades\Storage::class, 'Str' => Illuminate\Support\Str::class, 'URL' => Illuminate\Support\Facades\URL::class, 'Validator' => Illuminate\Support\Facades\Validator::class, 'View' => Illuminate\Support\Facades\View::class, ], ]; ================================================ FILE: docker/php/config/auth.php ================================================ [ 'guard' => 'web', 'passwords' => 'users', ], /* |-------------------------------------------------------------------------- | Authentication Guards |-------------------------------------------------------------------------- | | Next, you may define every authentication guard for your application. | Of course, a great default configuration has been defined for you | here which uses session storage and the Eloquent user provider. | | All authentication drivers have a user provider. This defines how the | users are actually retrieved out of your database or other storage | mechanisms used by this application to persist your user's data. | | Supported: "session", "token" | */ 'guards' => [ 'web' => [ 'driver' => 'session', 'provider' => 'users', ], 'api' => [ 'driver' => 'token', 'provider' => 'users', 'hash' => false, ], ], /* |-------------------------------------------------------------------------- | User Providers |-------------------------------------------------------------------------- | | All authentication drivers have a user provider. This defines how the | users are actually retrieved out of your database or other storage | mechanisms used by this application to persist your user's data. | | If you have multiple user tables or models you may configure multiple | sources which represent each model / table. These sources may then | be assigned to any extra authentication guards you have defined. | | Supported: "database", "eloquent" | */ 'providers' => [ 'users' => [ 'driver' => 'eloquent', 'model' => App\Models\User::class, ], // 'users' => [ // 'driver' => 'database', // 'table' => 'users', // ], ], /* |-------------------------------------------------------------------------- | Resetting Passwords |-------------------------------------------------------------------------- | | You may specify multiple password reset configurations if you have more | than one user table or model in the application and you want to have | separate password reset settings based on the specific user types. | | The expire time is the number of minutes that the reset token should be | considered valid. This security feature keeps tokens short-lived so | they have less time to be guessed. You may change this as needed. | */ 'passwords' => [ 'users' => [ 'provider' => 'users', 'table' => 'password_resets', 'expire' => 60, 'throttle' => 60, ], ], /* |-------------------------------------------------------------------------- | Password Confirmation Timeout |-------------------------------------------------------------------------- | | Here you may define the amount of seconds before a password confirmation | times out and the user is prompted to re-enter their password via the | confirmation screen. By default, the timeout lasts for three hours. | */ 'password_timeout' => 10800, ]; ================================================ FILE: docker/php/config/broadcasting.php ================================================ env('BROADCAST_DRIVER', 'null'), /* |-------------------------------------------------------------------------- | Broadcast Connections |-------------------------------------------------------------------------- | | Here you may define all of the broadcast connections that will be used | to broadcast events to other systems or over websockets. Samples of | each available type of connection are provided inside this array. | */ 'connections' => [ 'pusher' => [ 'driver' => 'pusher', 'key' => env('PUSHER_APP_KEY'), 'secret' => env('PUSHER_APP_SECRET'), 'app_id' => env('PUSHER_APP_ID'), 'options' => [ 'cluster' => env('PUSHER_APP_CLUSTER'), 'useTLS' => true, ], ], 'redis' => [ 'driver' => 'redis', 'connection' => 'default', ], 'log' => [ 'driver' => 'log', ], 'null' => [ 'driver' => 'null', ], ], ]; ================================================ FILE: docker/php/config/cache.php ================================================ env('CACHE_DRIVER', 'file'), /* |-------------------------------------------------------------------------- | Cache Stores |-------------------------------------------------------------------------- | | Here you may define all of the cache "stores" for your application as | well as their drivers. You may even define multiple stores for the | same cache driver to group types of items stored in your caches. | */ 'stores' => [ 'apc' => [ 'driver' => 'apc', ], 'array' => [ 'driver' => 'array', 'serialize' => false, ], 'database' => [ 'driver' => 'database', 'table' => 'cache', 'connection' => null, ], 'file' => [ 'driver' => 'file', 'path' => storage_path('framework/cache/data'), ], 'memcached' => [ 'driver' => 'memcached', 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 'sasl' => [ env('MEMCACHED_USERNAME'), env('MEMCACHED_PASSWORD'), ], 'options' => [ // Memcached::OPT_CONNECT_TIMEOUT => 2000, ], 'servers' => [ [ 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 'port' => env('MEMCACHED_PORT', 11211), 'weight' => 100, ], ], ], 'redis' => [ 'driver' => 'redis', 'connection' => 'cache', ], 'dynamodb' => [ 'driver' => 'dynamodb', 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), 'endpoint' => env('DYNAMODB_ENDPOINT'), ], ], /* |-------------------------------------------------------------------------- | Cache Key Prefix |-------------------------------------------------------------------------- | | When utilizing a RAM based store such as APC or Memcached, there might | be other applications utilizing the same cache. So, we'll specify a | value to get prefixed to all our keys so we can avoid collisions. | */ 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'), ]; ================================================ FILE: docker/php/config/cors.php ================================================ ['api/*'], 'allowed_methods' => ['*'], 'allowed_origins' => ['*'], 'allowed_origins_patterns' => [], 'allowed_headers' => ['*'], 'exposed_headers' => [], 'max_age' => 0, 'supports_credentials' => false, ]; ================================================ FILE: docker/php/config/database.php ================================================ env('DB_CONNECTION', 'mysql'), /* |-------------------------------------------------------------------------- | Database Connections |-------------------------------------------------------------------------- | | Here are each of the database connections setup for your application. | Of course, examples of configuring each database platform that is | supported by Laravel is shown below to make development simple. | | | All database work in Laravel is done through the PHP PDO facilities | so make sure you have the driver for your particular database of | choice installed on your machine before you begin development. | */ 'connections' => [ 'sqlite' => [ 'driver' => 'sqlite', 'url' => env('DATABASE_URL'), 'database' => env('DB_DATABASE', database_path('database.sqlite')), 'prefix' => '', 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), ], 'mysql' => [ 'driver' => 'mysql', 'url' => env('DATABASE_URL'), 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '3306'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'unix_socket' => env('DB_SOCKET', ''), 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', 'prefix_indexes' => true, 'strict' => true, 'engine' => null, 'options' => extension_loaded('pdo_mysql') ? array_filter([ PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), ]) : [], ], 'pgsql' => [ 'driver' => 'pgsql', 'url' => env('DATABASE_URL'), 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '5432'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'charset' => 'utf8', 'prefix' => '', 'prefix_indexes' => true, 'schema' => 'public', 'sslmode' => 'prefer', ], 'sqlsrv' => [ 'driver' => 'sqlsrv', 'url' => env('DATABASE_URL'), 'host' => env('DB_HOST', 'localhost'), 'port' => env('DB_PORT', '1433'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'charset' => 'utf8', 'prefix' => '', 'prefix_indexes' => true, ], ], /* |-------------------------------------------------------------------------- | Migration Repository Table |-------------------------------------------------------------------------- | | This table keeps track of all the migrations that have already run for | your application. Using this information, we can determine which of | the migrations on disk haven't actually been run in the database. | */ 'migrations' => 'migrations', /* |-------------------------------------------------------------------------- | Redis Databases |-------------------------------------------------------------------------- | | Redis is an open source, fast, and advanced key-value store that also | provides a richer body of commands than a typical key-value system | such as APC or Memcached. Laravel makes it easy to dig right in. | */ 'redis' => [ 'client' => env('REDIS_CLIENT', 'phpredis'), 'options' => [ 'cluster' => env('REDIS_CLUSTER', 'redis'), 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), ], 'default' => [ 'url' => env('REDIS_URL'), 'host' => env('REDIS_HOST', '127.0.0.1'), 'password' => env('REDIS_PASSWORD', null), 'port' => env('REDIS_PORT', '6379'), 'database' => env('REDIS_DB', '0'), ], 'cache' => [ 'url' => env('REDIS_URL'), 'host' => env('REDIS_HOST', '127.0.0.1'), 'password' => env('REDIS_PASSWORD', null), 'port' => env('REDIS_PORT', '6379'), 'database' => env('REDIS_CACHE_DB', '1'), ], ], ]; ================================================ FILE: docker/php/config/filesystems.php ================================================ env('FILESYSTEM_DRIVER', 'local'), /* |-------------------------------------------------------------------------- | Default Cloud Filesystem Disk |-------------------------------------------------------------------------- | | Many applications store files both locally and in the cloud. For this | reason, you may specify a default "cloud" driver here. This driver | will be bound as the Cloud disk implementation in the container. | */ 'cloud' => env('FILESYSTEM_CLOUD', 's3'), /* |-------------------------------------------------------------------------- | Filesystem Disks |-------------------------------------------------------------------------- | | Here you may configure as many filesystem "disks" as you wish, and you | may even configure multiple disks of the same driver. Defaults have | been setup for each driver as an example of the required options. | | Supported Drivers: "local", "ftp", "sftp", "s3" | */ 'disks' => [ 'local' => [ 'driver' => 'local', 'root' => storage_path('app'), ], 'public' => [ 'driver' => 'local', 'root' => storage_path('app/public'), 'url' => env('APP_URL').'/storage', 'visibility' => 'public', ], 's3' => [ 'driver' => 's3', 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('AWS_DEFAULT_REGION'), 'bucket' => env('AWS_BUCKET'), 'url' => env('AWS_URL'), 'endpoint' => env('AWS_ENDPOINT'), ], ], /* |-------------------------------------------------------------------------- | Symbolic Links |-------------------------------------------------------------------------- | | Here you may configure the symbolic links that will be created when the | `storage:link` Artisan command is executed. The array keys should be | the locations of the links and the values should be their targets. | */ 'links' => [ public_path('storage') => storage_path('app/public'), ], ]; ================================================ FILE: docker/php/config/hashing.php ================================================ 'bcrypt', /* |-------------------------------------------------------------------------- | Bcrypt Options |-------------------------------------------------------------------------- | | Here you may specify the configuration options that should be used when | passwords are hashed using the Bcrypt algorithm. This will allow you | to control the amount of time it takes to hash the given password. | */ 'bcrypt' => [ 'rounds' => env('BCRYPT_ROUNDS', 10), ], /* |-------------------------------------------------------------------------- | Argon Options |-------------------------------------------------------------------------- | | Here you may specify the configuration options that should be used when | passwords are hashed using the Argon algorithm. These will allow you | to control the amount of time it takes to hash the given password. | */ 'argon' => [ 'memory' => 1024, 'threads' => 2, 'time' => 2, ], ]; ================================================ FILE: docker/php/config/logging.php ================================================ env('LOG_CHANNEL', 'stack'), /* |-------------------------------------------------------------------------- | Log Channels |-------------------------------------------------------------------------- | | Here you may configure the log channels for your application. Out of | the box, Laravel uses the Monolog PHP logging library. This gives | you a variety of powerful log handlers / formatters to utilize. | | Available Drivers: "single", "daily", "slack", "syslog", | "errorlog", "monolog", | "custom", "stack" | */ 'channels' => [ 'stack' => [ 'driver' => 'stack', 'channels' => ['single'], 'ignore_exceptions' => false, ], 'single' => [ 'driver' => 'single', 'path' => storage_path('logs/laravel.log'), 'level' => 'debug', ], 'daily' => [ 'driver' => 'daily', 'path' => storage_path('logs/laravel.log'), 'level' => 'debug', 'days' => 14, ], 'slack' => [ 'driver' => 'slack', 'url' => env('LOG_SLACK_WEBHOOK_URL'), 'username' => 'Laravel Log', 'emoji' => ':boom:', 'level' => 'critical', ], 'papertrail' => [ 'driver' => 'monolog', 'level' => 'debug', 'handler' => SyslogUdpHandler::class, 'handler_with' => [ 'host' => env('PAPERTRAIL_URL'), 'port' => env('PAPERTRAIL_PORT'), ], ], 'stderr' => [ 'driver' => 'monolog', 'handler' => StreamHandler::class, 'formatter' => env('LOG_STDERR_FORMATTER'), 'with' => [ 'stream' => 'php://stderr', ], ], 'syslog' => [ 'driver' => 'syslog', 'level' => 'debug', ], 'errorlog' => [ 'driver' => 'errorlog', 'level' => 'debug', ], 'null' => [ 'driver' => 'monolog', 'handler' => NullHandler::class, ], 'emergency' => [ 'path' => storage_path('logs/laravel.log'), ], ], ]; ================================================ FILE: docker/php/config/mail.php ================================================ env('MAIL_MAILER', 'smtp'), /* |-------------------------------------------------------------------------- | Mailer Configurations |-------------------------------------------------------------------------- | | Here you may configure all of the mailers used by your application plus | their respective settings. Several examples have been configured for | you and you are free to add your own as your application requires. | | Laravel supports a variety of mail "transport" drivers to be used while | sending an e-mail. You will specify which one you are using for your | mailers below. You are free to add additional mailers as required. | | Supported: "smtp", "sendmail", "mailgun", "ses", | "postmark", "log", "array" | */ 'mailers' => [ 'smtp' => [ 'transport' => 'smtp', 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 'port' => env('MAIL_PORT', 587), 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 'username' => env('MAIL_USERNAME'), 'password' => env('MAIL_PASSWORD'), 'timeout' => null, 'auth_mode' => null, ], 'ses' => [ 'transport' => 'ses', ], 'mailgun' => [ 'transport' => 'mailgun', ], 'postmark' => [ 'transport' => 'postmark', ], 'sendmail' => [ 'transport' => 'sendmail', 'path' => '/usr/sbin/sendmail -bs', ], 'log' => [ 'transport' => 'log', 'channel' => env('MAIL_LOG_CHANNEL'), ], 'array' => [ 'transport' => 'array', ], ], /* |-------------------------------------------------------------------------- | Global "From" Address |-------------------------------------------------------------------------- | | You may wish for all e-mails sent by your application to be sent from | the same address. Here, you may specify a name and address that is | used globally for all e-mails that are sent by your application. | */ 'from' => [ 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), 'name' => env('MAIL_FROM_NAME', 'Example'), ], /* |-------------------------------------------------------------------------- | Markdown Mail Settings |-------------------------------------------------------------------------- | | If you are using Markdown based email rendering, you may configure your | theme and component paths here, allowing you to customize the design | of the emails. Or, you may simply stick with the Laravel defaults! | */ 'markdown' => [ 'theme' => 'default', 'paths' => [ resource_path('views/vendor/mail'), ], ], ]; ================================================ FILE: docker/php/config/queue.php ================================================ env('QUEUE_CONNECTION', 'sync'), /* |-------------------------------------------------------------------------- | Queue Connections |-------------------------------------------------------------------------- | | Here you may configure the connection information for each server that | is used by your application. A default configuration has been added | for each back-end shipped with Laravel. You are free to add more. | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" | */ 'connections' => [ 'sync' => [ 'driver' => 'sync', ], 'database' => [ 'driver' => 'database', 'table' => 'jobs', 'queue' => 'default', 'retry_after' => 90, ], 'beanstalkd' => [ 'driver' => 'beanstalkd', 'host' => 'localhost', 'queue' => 'default', 'retry_after' => 90, 'block_for' => 0, ], 'sqs' => [ 'driver' => 'sqs', 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 'queue' => env('SQS_QUEUE', 'your-queue-name'), 'suffix' => env('SQS_SUFFIX'), 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], 'redis' => [ 'driver' => 'redis', 'connection' => 'default', 'queue' => env('REDIS_QUEUE', 'default'), 'retry_after' => 90, 'block_for' => null, ], ], /* |-------------------------------------------------------------------------- | Failed Queue Jobs |-------------------------------------------------------------------------- | | These options configure the behavior of failed queue job logging so you | can control which database and table are used to store the jobs that | have failed. You may change them to any database / table you wish. | */ 'failed' => [ 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), 'database' => env('DB_CONNECTION', 'mysql'), 'table' => 'failed_jobs', ], ]; ================================================ FILE: docker/php/config/services.php ================================================ [ 'domain' => env('MAILGUN_DOMAIN'), 'secret' => env('MAILGUN_SECRET'), 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), ], 'postmark' => [ 'token' => env('POSTMARK_TOKEN'), ], 'ses' => [ 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], ]; ================================================ FILE: docker/php/config/session.php ================================================ env('SESSION_DRIVER', 'file'), /* |-------------------------------------------------------------------------- | Session Lifetime |-------------------------------------------------------------------------- | | Here you may specify the number of minutes that you wish the session | to be allowed to remain idle before it expires. If you want them | to immediately expire on the browser closing, set that option. | */ 'lifetime' => env('SESSION_LIFETIME', 120), 'expire_on_close' => false, /* |-------------------------------------------------------------------------- | Session Encryption |-------------------------------------------------------------------------- | | This option allows you to easily specify that all of your session data | should be encrypted before it is stored. All encryption will be run | automatically by Laravel and you can use the Session like normal. | */ 'encrypt' => false, /* |-------------------------------------------------------------------------- | Session File Location |-------------------------------------------------------------------------- | | When using the native session driver, we need a location where session | files may be stored. A default has been set for you but a different | location may be specified. This is only needed for file sessions. | */ 'files' => storage_path('framework/sessions'), /* |-------------------------------------------------------------------------- | Session Database Connection |-------------------------------------------------------------------------- | | When using the "database" or "redis" session drivers, you may specify a | connection that should be used to manage these sessions. This should | correspond to a connection in your database configuration options. | */ 'connection' => env('SESSION_CONNECTION', null), /* |-------------------------------------------------------------------------- | Session Database Table |-------------------------------------------------------------------------- | | When using the "database" session driver, you may specify the table we | should use to manage the sessions. Of course, a sensible default is | provided for you; however, you are free to change this as needed. | */ 'table' => 'sessions', /* |-------------------------------------------------------------------------- | Session Cache Store |-------------------------------------------------------------------------- | | While using one of the framework's cache driven session backends you may | list a cache store that should be used for these sessions. This value | must match with one of the application's configured cache "stores". | | Affects: "apc", "dynamodb", "memcached", "redis" | */ 'store' => env('SESSION_STORE', null), /* |-------------------------------------------------------------------------- | Session Sweeping Lottery |-------------------------------------------------------------------------- | | Some session drivers must manually sweep their storage location to get | rid of old sessions from storage. Here are the chances that it will | happen on a given request. By default, the odds are 2 out of 100. | */ 'lottery' => [2, 100], /* |-------------------------------------------------------------------------- | Session Cookie Name |-------------------------------------------------------------------------- | | Here you may change the name of the cookie used to identify a session | instance by ID. The name specified here will get used every time a | new session cookie is created by the framework for every driver. | */ 'cookie' => env( 'SESSION_COOKIE', Str::slug(env('APP_NAME', 'laravel'), '_').'_session' ), /* |-------------------------------------------------------------------------- | Session Cookie Path |-------------------------------------------------------------------------- | | The session cookie path determines the path for which the cookie will | be regarded as available. Typically, this will be the root path of | your application but you are free to change this when necessary. | */ 'path' => '/', /* |-------------------------------------------------------------------------- | Session Cookie Domain |-------------------------------------------------------------------------- | | Here you may change the domain of the cookie used to identify a session | in your application. This will determine which domains the cookie is | available to in your application. A sensible default has been set. | */ 'domain' => env('SESSION_DOMAIN', null), /* |-------------------------------------------------------------------------- | HTTPS Only Cookies |-------------------------------------------------------------------------- | | By setting this option to true, session cookies will only be sent back | to the server if the browser has a HTTPS connection. This will keep | the cookie from being sent to you if it can not be done securely. | */ 'secure' => env('SESSION_SECURE_COOKIE'), /* |-------------------------------------------------------------------------- | HTTP Access Only |-------------------------------------------------------------------------- | | Setting this value to true will prevent JavaScript from accessing the | value of the cookie and the cookie will only be accessible through | the HTTP protocol. You are free to modify this option if needed. | */ 'http_only' => true, /* |-------------------------------------------------------------------------- | Same-Site Cookies |-------------------------------------------------------------------------- | | This option determines how your cookies behave when cross-site requests | take place, and can be used to mitigate CSRF attacks. By default, we | will set this value to "lax" since this is a secure default value. | | Supported: "lax", "strict", "none", null | */ 'same_site' => 'lax', ]; ================================================ FILE: docker/php/config/view.php ================================================ [ resource_path('views'), ], /* |-------------------------------------------------------------------------- | Compiled View Path |-------------------------------------------------------------------------- | | This option determines where all the compiled Blade templates will be | stored for your application. Typically, this is within the storage | directory. However, as usual, you are free to change this value. | */ 'compiled' => env( 'VIEW_COMPILED_PATH', realpath(storage_path('framework/views')) ), ]; ================================================ FILE: docker/php/database/.gitignore ================================================ *.sqlite *.sqlite-journal ================================================ FILE: docker/php/database/factories/UserFactory.php ================================================ $this->faker->name, 'email' => $this->faker->unique()->safeEmail, 'email_verified_at' => now(), 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 'remember_token' => Str::random(10), ]; } } ================================================ FILE: docker/php/database/migrations/2014_10_12_000000_create_users_table.php ================================================ id(); $table->string('name'); $table->string('email')->unique(); $table->timestamp('email_verified_at')->nullable(); $table->string('password'); $table->rememberToken(); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('users'); } } ================================================ FILE: docker/php/database/migrations/2014_10_12_100000_create_password_resets_table.php ================================================ string('email')->index(); $table->string('token'); $table->timestamp('created_at')->nullable(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('password_resets'); } } ================================================ FILE: docker/php/database/migrations/2019_08_19_000000_create_failed_jobs_table.php ================================================ id(); $table->string('uuid')->unique(); $table->text('connection'); $table->text('queue'); $table->longText('payload'); $table->longText('exception'); $table->timestamp('failed_at')->useCurrent(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('failed_jobs'); } } ================================================ FILE: docker/php/database/seeders/DatabaseSeeder.php ================================================ create(); } } ================================================ FILE: docker/php/package.json ================================================ { "private": true, "scripts": { "dev": "npm run development", "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "watch": "npm run development -- --watch", "watch-poll": "npm run watch -- --watch-poll", "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --disable-host-check --config=node_modules/laravel-mix/setup/webpack.config.js", "prod": "npm run production", "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" }, "devDependencies": { "axios": "^0.19", "cross-env": "^7.0", "laravel-mix": "^5.0.1", "lodash": "^4.17.19", "resolve-url-loader": "^3.1.0" } } ================================================ FILE: docker/php/phpunit.xml ================================================ ./tests/Unit ./tests/Feature ./app ================================================ FILE: docker/php/public/.htaccess ================================================ Options -MultiViews -Indexes RewriteEngine On # Handle Authorization Header RewriteCond %{HTTP:Authorization} . RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] # Redirect Trailing Slashes If Not A Folder... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} (.+)/$ RewriteRule ^ %1 [L,R=301] # Send Requests To Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] ================================================ FILE: docker/php/public/css/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(../images/pattern-tl.svg), url(../images/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: docker/php/public/index.php ================================================ make(Kernel::class); $response = tap($kernel->handle( $request = Request::capture() ))->send(); $kernel->terminate($request, $response); ================================================ FILE: docker/php/public/robots.txt ================================================ User-agent: * Disallow: ================================================ FILE: docker/php/public/web.config ================================================ ================================================ FILE: docker/php/resources/css/app.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ ================================================ FILE: docker/php/resources/js/app.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ require('./bootstrap'); ================================================ FILE: docker/php/resources/js/bootstrap.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ window._ = require('lodash'); /** * We'll load the axios HTTP library which allows us to easily issue requests * to our Laravel back-end. This library automatically handles sending the * CSRF token as a header based on the value of the "XSRF" token cookie. */ window.axios = require('axios'); window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; /** * Echo exposes an expressive API for subscribing to channels and listening * for events that are broadcast by Laravel. Echo and event broadcasting * allows your team to easily build robust real-time web applications. */ // import Echo from 'laravel-echo'; // window.Pusher = require('pusher-js'); // window.Echo = new Echo({ // broadcaster: 'pusher', // key: process.env.MIX_PUSHER_APP_KEY, // cluster: process.env.MIX_PUSHER_APP_CLUSTER, // forceTLS: true // }); ================================================ FILE: docker/php/resources/lang/en/auth.php ================================================ 'These credentials do not match our records.', 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', ]; ================================================ FILE: docker/php/resources/lang/en/pagination.php ================================================ '« Previous', 'next' => 'Next »', ]; ================================================ FILE: docker/php/resources/lang/en/passwords.php ================================================ 'Your password has been reset!', 'sent' => 'We have emailed your password reset link!', 'throttled' => 'Please wait before retrying.', 'token' => 'This password reset token is invalid.', 'user' => "We can't find a user with that email address.", ]; ================================================ FILE: docker/php/resources/lang/en/validation.php ================================================ 'The :attribute must be accepted.', 'active_url' => 'The :attribute is not a valid URL.', 'after' => 'The :attribute must be a date after :date.', 'after_or_equal' => 'The :attribute must be a date after or equal to :date.', 'alpha' => 'The :attribute may only contain letters.', 'alpha_dash' => 'The :attribute may only contain letters, numbers, dashes and underscores.', 'alpha_num' => 'The :attribute may only contain letters and numbers.', 'array' => 'The :attribute must be an array.', 'before' => 'The :attribute must be a date before :date.', 'before_or_equal' => 'The :attribute must be a date before or equal to :date.', 'between' => [ 'numeric' => 'The :attribute must be between :min and :max.', 'file' => 'The :attribute must be between :min and :max kilobytes.', 'string' => 'The :attribute must be between :min and :max characters.', 'array' => 'The :attribute must have between :min and :max items.', ], 'boolean' => 'The :attribute field must be true or false.', 'confirmed' => 'The :attribute confirmation does not match.', 'date' => 'The :attribute is not a valid date.', 'date_equals' => 'The :attribute must be a date equal to :date.', 'date_format' => 'The :attribute does not match the format :format.', 'different' => 'The :attribute and :other must be different.', 'digits' => 'The :attribute must be :digits digits.', 'digits_between' => 'The :attribute must be between :min and :max digits.', 'dimensions' => 'The :attribute has invalid image dimensions.', 'distinct' => 'The :attribute field has a duplicate value.', 'email' => 'The :attribute must be a valid email address.', 'ends_with' => 'The :attribute must end with one of the following: :values.', 'exists' => 'The selected :attribute is invalid.', 'file' => 'The :attribute must be a file.', 'filled' => 'The :attribute field must have a value.', 'gt' => [ 'numeric' => 'The :attribute must be greater than :value.', 'file' => 'The :attribute must be greater than :value kilobytes.', 'string' => 'The :attribute must be greater than :value characters.', 'array' => 'The :attribute must have more than :value items.', ], 'gte' => [ 'numeric' => 'The :attribute must be greater than or equal :value.', 'file' => 'The :attribute must be greater than or equal :value kilobytes.', 'string' => 'The :attribute must be greater than or equal :value characters.', 'array' => 'The :attribute must have :value items or more.', ], 'image' => 'The :attribute must be an image.', 'in' => 'The selected :attribute is invalid.', 'in_array' => 'The :attribute field does not exist in :other.', 'integer' => 'The :attribute must be an integer.', 'ip' => 'The :attribute must be a valid IP address.', 'ipv4' => 'The :attribute must be a valid IPv4 address.', 'ipv6' => 'The :attribute must be a valid IPv6 address.', 'json' => 'The :attribute must be a valid JSON string.', 'lt' => [ 'numeric' => 'The :attribute must be less than :value.', 'file' => 'The :attribute must be less than :value kilobytes.', 'string' => 'The :attribute must be less than :value characters.', 'array' => 'The :attribute must have less than :value items.', ], 'lte' => [ 'numeric' => 'The :attribute must be less than or equal :value.', 'file' => 'The :attribute must be less than or equal :value kilobytes.', 'string' => 'The :attribute must be less than or equal :value characters.', 'array' => 'The :attribute must not have more than :value items.', ], 'max' => [ 'numeric' => 'The :attribute may not be greater than :max.', 'file' => 'The :attribute may not be greater than :max kilobytes.', 'string' => 'The :attribute may not be greater than :max characters.', 'array' => 'The :attribute may not have more than :max items.', ], 'mimes' => 'The :attribute must be a file of type: :values.', 'mimetypes' => 'The :attribute must be a file of type: :values.', 'min' => [ 'numeric' => 'The :attribute must be at least :min.', 'file' => 'The :attribute must be at least :min kilobytes.', 'string' => 'The :attribute must be at least :min characters.', 'array' => 'The :attribute must have at least :min items.', ], 'not_in' => 'The selected :attribute is invalid.', 'not_regex' => 'The :attribute format is invalid.', 'numeric' => 'The :attribute must be a number.', 'password' => 'The password is incorrect.', 'present' => 'The :attribute field must be present.', 'regex' => 'The :attribute format is invalid.', 'required' => 'The :attribute field is required.', 'required_if' => 'The :attribute field is required when :other is :value.', 'required_unless' => 'The :attribute field is required unless :other is in :values.', 'required_with' => 'The :attribute field is required when :values is present.', 'required_with_all' => 'The :attribute field is required when :values are present.', 'required_without' => 'The :attribute field is required when :values is not present.', 'required_without_all' => 'The :attribute field is required when none of :values are present.', 'same' => 'The :attribute and :other must match.', 'size' => [ 'numeric' => 'The :attribute must be :size.', 'file' => 'The :attribute must be :size kilobytes.', 'string' => 'The :attribute must be :size characters.', 'array' => 'The :attribute must contain :size items.', ], 'starts_with' => 'The :attribute must start with one of the following: :values.', 'string' => 'The :attribute must be a string.', 'timezone' => 'The :attribute must be a valid zone.', 'unique' => 'The :attribute has already been taken.', 'uploaded' => 'The :attribute failed to upload.', 'url' => 'The :attribute format is invalid.', 'uuid' => 'The :attribute must be a valid UUID.', /* |-------------------------------------------------------------------------- | Custom Validation Language Lines |-------------------------------------------------------------------------- | | Here you may specify custom validation messages for attributes using the | convention "attribute.rule" to name the lines. This makes it quick to | specify a specific custom language line for a given attribute rule. | */ 'custom' => [ 'attribute-name' => [ 'rule-name' => 'custom-message', ], ], /* |-------------------------------------------------------------------------- | Custom Validation Attributes |-------------------------------------------------------------------------- | | The following language lines are used to swap our attribute placeholder | with something more reader friendly such as "E-Mail Address" instead | of "email". This simply helps us make our message more expressive. | */ 'attributes' => [], ]; ================================================ FILE: docker/php/resources/views/welcome.blade.php ================================================ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 Waypoint Laravel Example
PHP Icon

This Laravel app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: docker/php/routes/api.php ================================================ get('/user', function (Request $request) { return $request->user(); }); ================================================ FILE: docker/php/routes/channels.php ================================================ id === (int) $id; }); ================================================ FILE: docker/php/routes/console.php ================================================ comment(Inspiring::quote()); })->purpose('Display an inspiring quote'); ================================================ FILE: docker/php/routes/web.php ================================================ */ $uri = urldecode( parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) ); // This file allows us to emulate Apache's "mod_rewrite" functionality from the // built-in PHP web server. This provides a convenient way to test a Laravel // application without having installed a "real" web server software here. if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) { return false; } require_once __DIR__.'/public/index.php'; ================================================ FILE: docker/php/storage/app/.gitignore ================================================ * !public/ !.gitignore ================================================ FILE: docker/php/storage/framework/.gitignore ================================================ compiled.php config.php down events.scanned.php maintenance.php routes.php routes.scanned.php schedule-* services.json ================================================ FILE: docker/php/storage/framework/cache/.gitignore ================================================ * !data/ !.gitignore ================================================ FILE: docker/php/storage/framework/sessions/.gitignore ================================================ * !.gitignore ================================================ FILE: docker/php/storage/framework/testing/.gitignore ================================================ * !.gitignore ================================================ FILE: docker/php/storage/framework/views/.gitignore ================================================ * !.gitignore ================================================ FILE: docker/php/storage/logs/.gitignore ================================================ * !.gitignore ================================================ FILE: docker/php/tests/CreatesApplication.php ================================================ make(Kernel::class)->bootstrap(); return $app; } } ================================================ FILE: docker/php/tests/Feature/ExampleTest.php ================================================ get('/'); $response->assertStatus(200); } } ================================================ FILE: docker/php/tests/TestCase.php ================================================ assertTrue(true); } } ================================================ FILE: docker/php/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "example-php" app "example-php" { labels = { "service" = "example-php", "env" = "dev" } build { use "pack" {} } deploy { use "docker" {} } } ================================================ FILE: docker/php/webpack.mix.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ const mix = require('laravel-mix'); /* |-------------------------------------------------------------------------- | Mix Asset Management |-------------------------------------------------------------------------- | | Mix provides a clean, fluent API for defining some Webpack build steps | for your Laravel applications. By default, we are compiling the CSS | file for the application as well as bundling up all the JS files. | */ mix.js('resources/js/app.js', 'public/js') .postCss('resources/css/app.css', 'public/css', [ // ]); ================================================ FILE: docker/python/Dockerfile ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 FROM ubuntu:20.04 ENV LC_ALL=C.UTF-8 ENV LANG=C.UTF-8 RUN apt-get update -y && apt-get install python3-pip -y ADD requirements.txt /app/ WORKDIR /app RUN /bin/bash -c "pip3 install --no-cache-dir -r requirements.txt" ADD /app/ /app/ EXPOSE 8080 CMD ["gunicorn", "-b", "0.0.0.0:8080", "wsgi", "-k", "gevent"] ================================================ FILE: docker/python/README.md ================================================ # Getting Started with Waypoint and Flask 1. Run `waypoint init` in this example directory with `waypoint.hcl`. 1. Run `waypoint up` to build and deploy the application. For more information on Flask, see [https://palletsprojects.com/p/flask/](https://palletsprojects.com/p/flask/). ================================================ FILE: docker/python/app/app.py ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 from flask import Flask, render_template application = Flask(__name__) @application.route("/") def index(): return (render_template('index.html')) if __name__ == "__main__": application.run(host='0.0.0.0') ================================================ FILE: docker/python/app/static/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/static/images/pattern-tl.svg), url(/static/images/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } .language-image { width: 60px; height: 60px; } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: docker/python/app/templates/index.html ================================================ Waypoint Flask Example
Flask Icon

This Flask app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: docker/python/app/wsgi.py ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 from app import application if __name__ == "__main__": application.run() ================================================ FILE: docker/python/requirements.txt ================================================ gevent gunicorn flask ================================================ FILE: docker/python/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "example-python" app "example-python" { labels = { "service" = "example-python", "env" = "dev" } build { use "docker" {} } deploy { use "docker" { service_port = 8080 } } } ================================================ FILE: docker/reactjs/.gitignore ================================================ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies /node_modules /.pnp .pnp.js # testing /coverage # production /build # misc .DS_Store .env.local .env.development.local .env.test.local .env.production.local npm-debug.log* yarn-debug.log* yarn-error.log* .waypoint ================================================ FILE: docker/reactjs/Dockerfile ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 # build environment FROM node:13.12.0-alpine as build WORKDIR /app ENV PATH /app/node_modules/.bin:$PATH COPY package.json ./ COPY package-lock.json ./ RUN npm ci --silent RUN npm install react-scripts@3.4.1 -g --silent COPY . ./ RUN npm run build # production environment FROM nginx:stable-alpine COPY nginx/default.conf /etc/nginx/conf.d/ COPY --from=build /app/build /usr/share/nginx/html EXPOSE 80 CMD ["nginx", "-g", "daemon off;"] ================================================ FILE: docker/reactjs/README.md ================================================ # Waypoint React.js Example |Title|Description| |---|---| |Pack|Cloud Native Buildpack| |Cloud|Local| |Language|JavaScript| |Docs|[Docker](https://www.waypointproject.io/plugins/docker)| |Tutorial|[HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/get-started-docker)| ================================================ FILE: docker/reactjs/nginx/default.conf ================================================ server { listen 80; sendfile on; default_type application/octet-stream; gzip on; gzip_http_version 1.1; gzip_disable "MSIE [1-6]\."; gzip_min_length 1100; gzip_vary on; gzip_proxied expired no-cache no-store private auth; gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; gzip_comp_level 9; root /usr/share/nginx/html; location / { try_files $uri $uri/ /index.html; proxy_read_timeout 300s; proxy_connect_timeout 75s; } } ================================================ FILE: docker/reactjs/package.json ================================================ { "name": "reactjs", "version": "0.1.0", "private": true, "dependencies": { "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.5.0", "@testing-library/user-event": "^7.2.1", "react": "^16.13.1", "react-dom": "^16.13.1", "react-scripts": "3.4.3" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": "react-app" }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] } } ================================================ FILE: docker/reactjs/public/index.html ================================================ Waypoint React Example
================================================ FILE: docker/reactjs/public/manifest.json ================================================ { "short_name": "React App", "name": "Create React App Sample", "icons": [ { "src": "favicon.ico", "sizes": "64x64 32x32 24x24 16x16", "type": "image/x-icon" }, { "src": "logo192.png", "type": "image/png", "sizes": "192x192" }, { "src": "logo512.png", "type": "image/png", "sizes": "512x512" } ], "start_url": ".", "display": "standalone", "theme_color": "#000000", "background_color": "#ffffff" } ================================================ FILE: docker/reactjs/public/robots.txt ================================================ # https://www.robotstxt.org/robotstxt.html User-agent: * Disallow: ================================================ FILE: docker/reactjs/src/App.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(pattern-tl.svg), url(pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: docker/reactjs/src/App.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ import React from 'react'; import logo from './logo.svg'; import language from './language.svg'; import hashi from './hashi.svg'; import './App.css'; function App() { return (

This React app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

); } export default App; ================================================ FILE: docker/reactjs/src/App.test.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ import React from 'react'; import { render } from '@testing-library/react'; import App from './App'; test('renders learn react link', () => { const { getByText } = render(); const linkElement = getByText(/learn react/i); expect(linkElement).toBeInTheDocument(); }); ================================================ FILE: docker/reactjs/src/index.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; import * as serviceWorker from './serviceWorker'; ReactDOM.render( , document.getElementById('root') ); // If you want your app to work offline and load faster, you can change // unregister() to register() below. Note this comes with some pitfalls. // Learn more about service workers: https://bit.ly/CRA-PWA serviceWorker.unregister(); ================================================ FILE: docker/reactjs/src/serviceWorker.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ // This optional code is used to register a service worker. // register() is not called by default. // This lets the app load faster on subsequent visits in production, and gives // it offline capabilities. However, it also means that developers (and users) // will only see deployed updates on subsequent visits to a page, after all the // existing tabs open on the page have been closed, since previously cached // resources are updated in the background. // To learn more about the benefits of this model and instructions on how to // opt-in, read https://bit.ly/CRA-PWA const isLocalhost = Boolean( window.location.hostname === 'localhost' || // [::1] is the IPv6 localhost address. window.location.hostname === '[::1]' || // 127.0.0.0/8 are considered localhost for IPv4. window.location.hostname.match( /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ ) ); export function register(config) { if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { // The URL constructor is available in all browsers that support SW. const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); if (publicUrl.origin !== window.location.origin) { // Our service worker won't work if PUBLIC_URL is on a different origin // from what our page is served on. This might happen if a CDN is used to // serve assets; see https://github.com/facebook/create-react-app/issues/2374 return; } window.addEventListener('load', () => { const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; if (isLocalhost) { // This is running on localhost. Let's check if a service worker still exists or not. checkValidServiceWorker(swUrl, config); // Add some additional logging to localhost, pointing developers to the // service worker/PWA documentation. navigator.serviceWorker.ready.then(() => { console.log( 'This web app is being served cache-first by a service ' + 'worker. To learn more, visit https://bit.ly/CRA-PWA' ); }); } else { // Is not localhost. Just register service worker registerValidSW(swUrl, config); } }); } } function registerValidSW(swUrl, config) { navigator.serviceWorker .register(swUrl) .then(registration => { registration.onupdatefound = () => { const installingWorker = registration.installing; if (installingWorker == null) { return; } installingWorker.onstatechange = () => { if (installingWorker.state === 'installed') { if (navigator.serviceWorker.controller) { // At this point, the updated precached content has been fetched, // but the previous service worker will still serve the older // content until all client tabs are closed. console.log( 'New content is available and will be used when all ' + 'tabs for this page are closed. See https://bit.ly/CRA-PWA.' ); // Execute callback if (config && config.onUpdate) { config.onUpdate(registration); } } else { // At this point, everything has been precached. // It's the perfect time to display a // "Content is cached for offline use." message. console.log('Content is cached for offline use.'); // Execute callback if (config && config.onSuccess) { config.onSuccess(registration); } } } }; }; }) .catch(error => { console.error('Error during service worker registration:', error); }); } function checkValidServiceWorker(swUrl, config) { // Check if the service worker can be found. If it can't reload the page. fetch(swUrl, { headers: { 'Service-Worker': 'script' }, }) .then(response => { // Ensure service worker exists, and that we really are getting a JS file. const contentType = response.headers.get('content-type'); if ( response.status === 404 || (contentType != null && contentType.indexOf('javascript') === -1) ) { // No service worker found. Probably a different app. Reload the page. navigator.serviceWorker.ready.then(registration => { registration.unregister().then(() => { window.location.reload(); }); }); } else { // Service worker found. Proceed as normal. registerValidSW(swUrl, config); } }) .catch(() => { console.log( 'No internet connection found. App is running in offline mode.' ); }); } export function unregister() { if ('serviceWorker' in navigator) { navigator.serviceWorker.ready .then(registration => { registration.unregister(); }) .catch(error => { console.error(error.message); }); } } ================================================ FILE: docker/reactjs/src/setupTests.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ // jest-dom adds custom jest matchers for asserting on DOM nodes. // allows you to do things like: // expect(element).toHaveTextContent(/react/i) // learn more: https://github.com/testing-library/jest-dom import '@testing-library/jest-dom/extend-expect'; ================================================ FILE: docker/reactjs/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 # The name of your project. A project typically maps 1:1 to a VCS repository. # This name must be unique for your Waypoint server. If you're running in # local mode, this must be unique to your machine. project = "example-reactjs" # Labels can be specified for organizational purposes. # labels = { "foo" = "bar" } # An application to deploy. app "example-reactjs" { # Build specifies how an application should be deployed. In this case, # we'll build using a Dockerfile and keeping it in a local registry. build { use "docker" {} # Uncomment below to use a remote docker registry to push your built images. # # registry { # use "docker" { # image = "registry.example.com/image" # tag = "latest" # } # } } # Deploy to Docker deploy { use "docker" { #Waypoint defaults inbound requests to port 3000 #This reactjs example app image listens on port 80, so we need to tell Waypoint to use the right port service_port = 80 } } } ================================================ FILE: docker/reactjs-packer/.gitignore ================================================ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies /node_modules /.pnp .pnp.js # testing /coverage # production /build # misc .DS_Store .env.local .env.development.local .env.test.local .env.production.local npm-debug.log* yarn-debug.log* yarn-error.log* .waypoint ================================================ FILE: docker/reactjs-packer/Dockerfile ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 # build environment FROM node:13.12.0-alpine as build WORKDIR /app ENV PATH /app/node_modules/.bin:$PATH COPY package.json ./ COPY package-lock.json ./ RUN npm ci --silent RUN npm install react-scripts@3.4.1 -g --silent COPY . ./ RUN npm run build # production environment FROM ${base_image} COPY nginx/default.conf /etc/nginx/conf.d/ COPY --from=build /app/build /usr/share/nginx/html EXPOSE 80 CMD ["nginx", "-g", "daemon off;"] ================================================ FILE: docker/reactjs-packer/README.md ================================================ # Waypoint React.js Example |Title|Description| |---|---| |Pack|Cloud Native Buildpack| |Cloud|Local| |Language|JavaScript| |Docs|[Docker](https://www.waypointproject.io/plugins/docker)| |Tutorial|[HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/get-started-docker)| This example demonstrates the usage of the Packer config sourcer plugin with a ReactJS application. To use the `nginx:stable-alpine` Docker image as the base image for the ReactJS application, firstly the Packer build must be run with the command below. This will pull the `nginx:stable-alpine` image from DockerHub, and push it to a local registry, hosted at `localhost:5000`. Additionally, the configuration will push the image metadata to a bucket in the HCP Packer registry, named `nginx`. ```shell $ packer build nginx.pkr.hcl ``` To use the Packer plugin, the configuration for the Packer plugin must be set with the command below. An HCP client ID and secret, organization ID and project ID must be set. ```shell $ waypoint config source-set -type=packer -config=client_id=sunset -config=client_secret=sarsaparilla -config=organization_id=nuka-cola -config=project_id=quantum ``` With that set, the dynamic input variable for the base image will retrieve the image ID from your HCP Packer registry. The image ID returned will be the one whose cloud provider and region match the one in the configuration. In this example, this is `docker` for both, as the Docker plugin for Packer will set this metadata, though other cloud providers may do thing differently. ```hcl variable "image" { default = dynamic("packer", { bucket = "nginx" channel = "base" region = "docker" cloud = "docker" }) type = string description = "The name of the base image to use for building app Docker images." } ``` This dynamic input variable is used during the build portion of the Waypoint app lifecycle. ```hcl build { use "docker" { dockerfile = templatefile("${path.app}/Dockerfile", { base_image = var.image }) } } ``` In the Dockerfile, this value is templated into the base image. ```Dockerfile FROM node:13.12.0-alpine as build WORKDIR /app ENV PATH /app/node_modules/.bin:$PATH COPY package.json ./ COPY package-lock.json ./ RUN npm ci --silent RUN npm install react-scripts@3.4.1 -g --silent COPY . ./ RUN npm run build # The image ID is templated here FROM ${base_image} COPY nginx/default.conf /etc/nginx/conf.d/ COPY --from=build /app/build /usr/share/nginx/html EXPOSE 80 CMD ["nginx", "-g", "daemon off;"] ``` ================================================ FILE: docker/reactjs-packer/nginx/default.conf ================================================ server { listen 80; sendfile on; default_type application/octet-stream; gzip on; gzip_http_version 1.1; gzip_disable "MSIE [1-6]\."; gzip_min_length 1100; gzip_vary on; gzip_proxied expired no-cache no-store private auth; gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; gzip_comp_level 9; root /usr/share/nginx/html; location / { try_files $uri $uri/ /index.html; proxy_read_timeout 300s; proxy_connect_timeout 75s; } } ================================================ FILE: docker/reactjs-packer/nginx.pkr.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 build { hcp_packer_registry { bucket_name = "nginx" description = "Nginx image." } sources = [ "source.docker.nginx" ] post-processors { // The two postprocessors here will push the image to a local registry post-processor "docker-tag" { repository = "localhost:5000/nginx" tags = [ "stable-alpine" ] } post-processor "docker-push" { login = false } } } source "docker" "nginx" { image = "nginx:stable-alpine" commit = true } ================================================ FILE: docker/reactjs-packer/package.json ================================================ { "name": "reactjs", "version": "0.1.0", "private": true, "dependencies": { "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.5.0", "@testing-library/user-event": "^7.2.1", "react": "^16.13.1", "react-dom": "^16.13.1", "react-scripts": "3.4.3" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": "react-app" }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] } } ================================================ FILE: docker/reactjs-packer/public/index.html ================================================ Waypoint React Example
================================================ FILE: docker/reactjs-packer/public/manifest.json ================================================ { "short_name": "React App", "name": "Create React App Sample", "icons": [ { "src": "favicon.ico", "sizes": "64x64 32x32 24x24 16x16", "type": "image/x-icon" }, { "src": "logo192.png", "type": "image/png", "sizes": "192x192" }, { "src": "logo512.png", "type": "image/png", "sizes": "512x512" } ], "start_url": ".", "display": "standalone", "theme_color": "#000000", "background_color": "#ffffff" } ================================================ FILE: docker/reactjs-packer/public/robots.txt ================================================ # https://www.robotstxt.org/robotstxt.html User-agent: * Disallow: ================================================ FILE: docker/reactjs-packer/src/App.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(pattern-tl.svg), url(pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: docker/reactjs-packer/src/App.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ import React from 'react'; import logo from './logo.svg'; import language from './language.svg'; import hashi from './hashi.svg'; import './App.css'; function App() { return (

This React app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

); } export default App; ================================================ FILE: docker/reactjs-packer/src/App.test.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ import React from 'react'; import { render } from '@testing-library/react'; import App from './App'; test('renders learn react link', () => { const { getByText } = render(); const linkElement = getByText(/learn react/i); expect(linkElement).toBeInTheDocument(); }); ================================================ FILE: docker/reactjs-packer/src/index.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; import * as serviceWorker from './serviceWorker'; ReactDOM.render( , document.getElementById('root') ); // If you want your app to work offline and load faster, you can change // unregister() to register() below. Note this comes with some pitfalls. // Learn more about service workers: https://bit.ly/CRA-PWA serviceWorker.unregister(); ================================================ FILE: docker/reactjs-packer/src/serviceWorker.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ // This optional code is used to register a service worker. // register() is not called by default. // This lets the app load faster on subsequent visits in production, and gives // it offline capabilities. However, it also means that developers (and users) // will only see deployed updates on subsequent visits to a page, after all the // existing tabs open on the page have been closed, since previously cached // resources are updated in the background. // To learn more about the benefits of this model and instructions on how to // opt-in, read https://bit.ly/CRA-PWA const isLocalhost = Boolean( window.location.hostname === 'localhost' || // [::1] is the IPv6 localhost address. window.location.hostname === '[::1]' || // 127.0.0.0/8 are considered localhost for IPv4. window.location.hostname.match( /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ ) ); export function register(config) { if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { // The URL constructor is available in all browsers that support SW. const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); if (publicUrl.origin !== window.location.origin) { // Our service worker won't work if PUBLIC_URL is on a different origin // from what our page is served on. This might happen if a CDN is used to // serve assets; see https://github.com/facebook/create-react-app/issues/2374 return; } window.addEventListener('load', () => { const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; if (isLocalhost) { // This is running on localhost. Let's check if a service worker still exists or not. checkValidServiceWorker(swUrl, config); // Add some additional logging to localhost, pointing developers to the // service worker/PWA documentation. navigator.serviceWorker.ready.then(() => { console.log( 'This web app is being served cache-first by a service ' + 'worker. To learn more, visit https://bit.ly/CRA-PWA' ); }); } else { // Is not localhost. Just register service worker registerValidSW(swUrl, config); } }); } } function registerValidSW(swUrl, config) { navigator.serviceWorker .register(swUrl) .then(registration => { registration.onupdatefound = () => { const installingWorker = registration.installing; if (installingWorker == null) { return; } installingWorker.onstatechange = () => { if (installingWorker.state === 'installed') { if (navigator.serviceWorker.controller) { // At this point, the updated precached content has been fetched, // but the previous service worker will still serve the older // content until all client tabs are closed. console.log( 'New content is available and will be used when all ' + 'tabs for this page are closed. See https://bit.ly/CRA-PWA.' ); // Execute callback if (config && config.onUpdate) { config.onUpdate(registration); } } else { // At this point, everything has been precached. // It's the perfect time to display a // "Content is cached for offline use." message. console.log('Content is cached for offline use.'); // Execute callback if (config && config.onSuccess) { config.onSuccess(registration); } } } }; }; }) .catch(error => { console.error('Error during service worker registration:', error); }); } function checkValidServiceWorker(swUrl, config) { // Check if the service worker can be found. If it can't reload the page. fetch(swUrl, { headers: { 'Service-Worker': 'script' }, }) .then(response => { // Ensure service worker exists, and that we really are getting a JS file. const contentType = response.headers.get('content-type'); if ( response.status === 404 || (contentType != null && contentType.indexOf('javascript') === -1) ) { // No service worker found. Probably a different app. Reload the page. navigator.serviceWorker.ready.then(registration => { registration.unregister().then(() => { window.location.reload(); }); }); } else { // Service worker found. Proceed as normal. registerValidSW(swUrl, config); } }) .catch(() => { console.log( 'No internet connection found. App is running in offline mode.' ); }); } export function unregister() { if ('serviceWorker' in navigator) { navigator.serviceWorker.ready .then(registration => { registration.unregister(); }) .catch(error => { console.error(error.message); }); } } ================================================ FILE: docker/reactjs-packer/src/setupTests.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ // jest-dom adds custom jest matchers for asserting on DOM nodes. // allows you to do things like: // expect(element).toHaveTextContent(/react/i) // learn more: https://github.com/testing-library/jest-dom import '@testing-library/jest-dom/extend-expect'; ================================================ FILE: docker/reactjs-packer/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "packer-plugin-project" runner { enabled = true data_source "git" { url = "https://github.com/paladin-devops/waypoint-examples" path = "docker/reactjs-packer" ref = "packer-plugin-example" } poll { enabled = true interval = "30s" } } variable "image" { default = dynamic("packer", { bucket = "nginx" channel = "base" region = "docker" cloud = "docker" }) type = string description = "The name of the base image to use for building app Docker images." } app "packer-plugin-app" { build { use "docker" { dockerfile = templatefile("${path.app}/Dockerfile", { base_image = var.image }) } } deploy { use "docker" {} } } ================================================ FILE: docker/ruby/.gitignore ================================================ # See https://help.github.com/articles/ignoring-files for more about ignoring files. # # If you find yourself ignoring temporary files generated by your text editor # or operating system, you probably want to add a global ignore instead: # git config --global core.excludesfile '~/.gitignore_global' # Ignore bundler config. /.bundle # Ignore the default SQLite database. /db/*.sqlite3 /db/*.sqlite3-journal # Ignore all logfiles and tempfiles. /log/*.log /tmp # Ignore ruby-version /.ruby-version ================================================ FILE: docker/ruby/Gemfile ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 source 'https://rubygems.org' ruby '>= 2.3.5', '< 2.8' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.2.0' # Use postgresql as the database for Active Record gem 'pg', '~> 0.18' # Use SCSS for stylesheets gem 'sass-rails' # Use Uglifier as compressor for JavaScript assets gem 'uglifier' # Use CoffeeScript for .js.coffee assets and views gem 'coffee-rails' # See https://github.com/sstephenson/execjs#readme for more supported runtimes # gem 'therubyracer', platforms: :ruby gem 'bootsnap', require: false gem 'listen' # Use jquery as the JavaScript library gem 'jquery-rails' # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks gem 'turbolinks' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder' # bundle exec rake doc:rails generates the API under doc/api. gem 'sdoc', group: :doc # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring', group: :development # Use ActiveModel has_secure_password # gem 'bcrypt', '~> 3.1.7' gem 'puma' # Use Capistrano for deployment # gem 'capistrano-rails', group: :development # Use debugger # gem 'debugger', group: [:development, :test] gem 'sprockets', '~> 3.7' ================================================ FILE: docker/ruby/Procfile ================================================ web: bundle exec puma -C config/puma.rb ================================================ FILE: docker/ruby/README.md ================================================ # Waypoint Ruby on Rails Example |Title|Description| |---|---| |Pack|Cloud Native Buildpack| |Cloud|Local| |Language|Ruby| |Docs|[Docker](https://www.waypointproject.io/plugins/docker)| |Tutorial|[HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/get-started-docker)| A barebones Rails app, which can easily be deployed by Waypoint. ================================================ FILE: docker/ruby/Rakefile ================================================ # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require File.expand_path('../config/application', __FILE__) Rails.application.load_tasks ================================================ FILE: docker/ruby/app/assets/images/.keep ================================================ ================================================ FILE: docker/ruby/app/assets/javascripts/application.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ // This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. // // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details // about supported directives. // //= require jquery //= require jquery_ujs //= require turbolinks //= require_tree . ================================================ FILE: docker/ruby/app/assets/javascripts/welcome.js.coffee ================================================ # Place all the behaviors and hooks related to the matching controller here. # All this logic will automatically be available in application.js. # You can use CoffeeScript in this file: http://coffeescript.org/ ================================================ FILE: docker/ruby/app/assets/javascripts/widgets.js.coffee ================================================ # Place all the behaviors and hooks related to the matching controller here. # All this logic will automatically be available in application.js. # You can use CoffeeScript in this file: http://coffeescript.org/ ================================================ FILE: docker/ruby/app/assets/stylesheets/application.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ /* * This is a manifest file that'll be compiled into application.css, which will include all the files * listed below. * * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. * * You're free to add application-wide styles to this file and they'll appear at the bottom of the * compiled file so the styles you add here take precedence over styles defined in any styles * defined in the other CSS/SCSS files in this directory. It is generally better to create a new * file per style scope. * *= require_tree . *= require_self */ ================================================ FILE: docker/ruby/app/assets/stylesheets/main.css.scss ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ $text: #E4E5E7; $background: #000; $brand: #04C6C2; $headline: #FFF; * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: $text; text-align: center; background-image: url(asset-path('pattern-tl.svg')), url(asset-path('pattern-br.svg')); background-position: top left, bottom right; background-repeat: no-repeat; background-color: $background; } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba($brand, .5); background: rgba($brand, .15); } section h1 { color: $headline; font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: $brand; } ================================================ FILE: docker/ruby/app/assets/stylesheets/scaffolds.css.scss ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ ================================================ FILE: docker/ruby/app/assets/stylesheets/theme.css.scss ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ $brand-primary: #532F8C; $brand-language: #B01302; .jumbotron { background: $brand-primary; color: white; padding-bottom: 80px; .btn-primary { background: lighten($brand-primary, 20%); border-color: lighten($brand-primary, 20%); &:hover { background: lighten($brand-primary, 15%); } } p { color: lighten($brand-primary, 50%); max-width: 75%; margin: 1em auto 2em; } .navbar + & { margin-top: -20px; } .lang-logo { display: block; background: $brand-language; border-radius: 50%; overflow: hidden; width: 100px; height: 100px; margin: auto; border: 2px solid white; img { max-width: 100%; } } } ================================================ FILE: docker/ruby/app/assets/stylesheets/welcome.css.scss ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ // Place all the styles related to the welcome controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ ================================================ FILE: docker/ruby/app/assets/stylesheets/widgets.css.scss ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ // Place all the styles related to the Widgets controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ ================================================ FILE: docker/ruby/app/controllers/application_controller.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception end ================================================ FILE: docker/ruby/app/controllers/concerns/.keep ================================================ ================================================ FILE: docker/ruby/app/controllers/welcome_controller.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 class WelcomeController < ApplicationController # GET /welcome def index @host = request.host_with_port end end ================================================ FILE: docker/ruby/app/controllers/widgets_controller.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 class WidgetsController < ApplicationController before_action :set_widget, only: [:show, :edit, :update, :destroy] # GET /widgets # GET /widgets.json def index @widgets = Widget.all end # GET /widgets/1 # GET /widgets/1.json def show end # GET /widgets/new def new @widget = Widget.new end # GET /widgets/1/edit def edit end # POST /widgets # POST /widgets.json def create @widget = Widget.new(widget_params) respond_to do |format| if @widget.save format.html { redirect_to @widget, notice: 'Widget was successfully created.' } format.json { render :show, status: :created, location: @widget } else format.html { render :new } format.json { render json: @widget.errors, status: :unprocessable_entity } end end end # PATCH/PUT /widgets/1 # PATCH/PUT /widgets/1.json def update respond_to do |format| if @widget.update(widget_params) format.html { redirect_to @widget, notice: 'Widget was successfully updated.' } format.json { render :show, status: :ok, location: @widget } else format.html { render :edit } format.json { render json: @widget.errors, status: :unprocessable_entity } end end end # DELETE /widgets/1 # DELETE /widgets/1.json def destroy @widget.destroy respond_to do |format| format.html { redirect_to widgets_url, notice: 'Widget was successfully destroyed.' } format.json { head :no_content } end end private # Use callbacks to share common setup or constraints between actions. def set_widget @widget = Widget.find(params[:id]) end # Never trust parameters from the scary internet, only allow the white list through. def widget_params params.require(:widget).permit(:name, :description, :stock) end end ================================================ FILE: docker/ruby/app/helpers/application_helper.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 module ApplicationHelper end ================================================ FILE: docker/ruby/app/helpers/welcome_helper.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 module WelcomeHelper end ================================================ FILE: docker/ruby/app/helpers/widgets_helper.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 module WidgetsHelper end ================================================ FILE: docker/ruby/app/mailers/.keep ================================================ ================================================ FILE: docker/ruby/app/models/.keep ================================================ ================================================ FILE: docker/ruby/app/models/concerns/.keep ================================================ ================================================ FILE: docker/ruby/app/models/widget.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 class Widget < ActiveRecord::Base end ================================================ FILE: docker/ruby/app/views/layouts/application.html.erb ================================================ Waypoint Ruby on Rails Example <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> <%= csrf_meta_tags %> <%= yield %> ================================================ FILE: docker/ruby/app/views/welcome/index.erb ================================================
Ruby Icon

This Ruby on Rails app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: docker/ruby/app/views/widgets/_form.html.erb ================================================ <%= form_for(@widget) do |f| %> <% if @widget.errors.any? %>

<%= pluralize(@widget.errors.count, "error") %> prohibited this widget from being saved:

    <% @widget.errors.full_messages.each do |message| %>
  • <%= message %>
  • <% end %>
<% end %>
<%= f.label :name %>
<%= f.text_field :name %>
<%= f.label :description %>
<%= f.text_area :description %>
<%= f.label :stock %>
<%= f.number_field :stock %>
<%= f.submit %>
<% end %> ================================================ FILE: docker/ruby/app/views/widgets/edit.html.erb ================================================

Editing widget

<%= render 'form' %> <%= link_to 'Show', @widget %> | <%= link_to 'Back', widgets_path %>
================================================ FILE: docker/ruby/app/views/widgets/index.html.erb ================================================

Listing widgets

<% @widgets.each do |widget| %> <% end %>
Name Description Stock
<%= widget.name %> <%= widget.description %> <%= widget.stock %> <%= link_to 'Show', widget %> <%= link_to 'Edit', edit_widget_path(widget) %> <%= link_to 'Destroy', widget, method: :delete, data: { confirm: 'Are you sure?' } %>

<%= link_to 'New Widget', new_widget_path %>
================================================ FILE: docker/ruby/app/views/widgets/index.json.jbuilder ================================================ json.array!(@widgets) do |widget| json.extract! widget, :id, :name, :description, :stock json.url widget_url(widget, format: :json) end ================================================ FILE: docker/ruby/app/views/widgets/new.html.erb ================================================

New widget

<%= render 'form' %> <%= link_to 'Back', widgets_path %>
================================================ FILE: docker/ruby/app/views/widgets/show.html.erb ================================================

<%= notice %>

Name: <%= @widget.name %>

Description: <%= @widget.description %>

Stock: <%= @widget.stock %>

<%= link_to 'Edit', edit_widget_path(@widget) %> | <%= link_to 'Back', widgets_path %>
================================================ FILE: docker/ruby/app/views/widgets/show.json.jbuilder ================================================ json.extract! @widget, :id, :name, :description, :stock, :created_at, :updated_at ================================================ FILE: docker/ruby/bin/bundle ================================================ #!/usr/bin/env ruby ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) load Gem.bin_path('bundler', 'bundle') ================================================ FILE: docker/ruby/bin/rails ================================================ #!/usr/bin/env ruby APP_PATH = File.expand_path('../config/application', __dir__) require_relative '../config/boot' require 'rails/commands' ================================================ FILE: docker/ruby/bin/rake ================================================ #!/usr/bin/env ruby require_relative '../config/boot' require 'rake' Rake.application.run ================================================ FILE: docker/ruby/bin/setup ================================================ #!/usr/bin/env ruby require 'fileutils' include FileUtils # path to your application root. APP_ROOT = File.expand_path('..', __dir__) def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") end chdir APP_ROOT do # This script is a starting point to setup your application. # Add necessary setup steps to this file. puts '== Installing dependencies ==' system! 'gem install bundler --conservative' system('bundle check') || system!('bundle install') # Install JavaScript dependencies if using Yarn # system('bin/yarn') # puts "\n== Copying sample files ==" # unless File.exist?('config/database.yml') # cp 'config/database.yml.sample', 'config/database.yml' # end puts "\n== Preparing database ==" system! 'bin/rails db:setup' puts "\n== Removing old logs and tempfiles ==" system! 'bin/rails log:clear tmp:clear' puts "\n== Restarting application server ==" system! 'bin/rails restart' end ================================================ FILE: docker/ruby/bin/spring ================================================ #!/usr/bin/env ruby # This file loads spring without using Bundler, in order to be fast # It gets overwritten when you run the `spring binstub` command unless defined?(Spring) require "rubygems" require "bundler" if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ spring \((.*?)\)$.*?^$/m) ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR) ENV["GEM_HOME"] = "" Gem.paths = ENV gem "spring", match[1] require "spring/binstub" end end ================================================ FILE: docker/ruby/bin/update ================================================ #!/usr/bin/env ruby require 'fileutils' include FileUtils # path to your application root. APP_ROOT = File.expand_path('..', __dir__) def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") end chdir APP_ROOT do # This script is a way to update your development environment automatically. # Add necessary update steps to this file. puts '== Installing dependencies ==' system! 'gem install bundler --conservative' system('bundle check') || system!('bundle install') # Install JavaScript dependencies if using Yarn # system('bin/yarn') puts "\n== Updating database ==" system! 'bin/rails db:migrate' puts "\n== Removing old logs and tempfiles ==" system! 'bin/rails log:clear tmp:clear' puts "\n== Restarting application server ==" system! 'bin/rails restart' end ================================================ FILE: docker/ruby/bin/yarn ================================================ #!/usr/bin/env ruby APP_ROOT = File.expand_path('..', __dir__) Dir.chdir(APP_ROOT) do begin exec "yarnpkg", *ARGV rescue Errno::ENOENT $stderr.puts "Yarn executable was not detected in the system." $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" exit 1 end end ================================================ FILE: docker/ruby/config/application.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 require_relative 'boot' require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module RubyGettingStarted class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. config.load_defaults 5.0 # Settings in config/environments/* take precedence over those specified here. # Application configuration can go into files in config/initializers # -- all .rb files in that directory are automatically loaded after loading # the framework and any gems in your application. end end ================================================ FILE: docker/ruby/config/boot.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) require 'bundler/setup' # Set up gems listed in the Gemfile. require 'bootsnap/setup' # Speed up boot time by caching expensive operations. ================================================ FILE: docker/ruby/config/cable.yml ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 development: adapter: async test: adapter: async production: adapter: redis url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> channel_prefix: ruby_getting_started_production ================================================ FILE: docker/ruby/config/database.yml ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 # PostgreSQL. Versions 8.2 and up are supported. # # Install the pg driver: # gem install pg # On OS X with Homebrew: # gem install pg -- --with-pg-config=/usr/local/bin/pg_config # On OS X with MacPorts: # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config # On Windows: # gem install pg # Choose the win32 build. # Install PostgreSQL and put its /bin directory on your path. # # Configure Using Gemfile # gem 'pg' # default: &default adapter: postgresql encoding: unicode # For details on connection pooling, see rails configuration guide # http://guides.rubyonrails.org/configuring.html#database-pooling pool: 5 development: <<: *default database: ruby-getting-started_development # The specified database role being used to connect to postgres. # To create additional roles in postgres see `$ createuser --help`. # When left blank, postgres will use the default role. This is # the same name as the operating system user that initialized the database. #username: ruby-getting-started # The password associated with the postgres role (username). #password: # Connect on a TCP socket. Omitted by default since the client uses a # domain socket that doesn't need configuration. Windows does not have # domain sockets, so uncomment these lines. #host: localhost # The TCP port the server listens on. Defaults to 5432. # If your server runs on a different port number, change accordingly. #port: 5432 # Schema search path. The server defaults to $user,public #schema_search_path: myapp,sharedapp,public # Minimum log levels, in increasing order: # debug5, debug4, debug3, debug2, debug1, # log, notice, warning, error, fatal, and panic # Defaults to warning. #min_messages: notice # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: <<: *default database: ruby-getting-started_test # As with config/secrets.yml, you never want to store sensitive information, # like your database password, in your source code. If your source code is # ever seen by anyone, they now have access to your database. # # Instead, provide the password as a unix environment variable when you boot # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database # for a full rundown on how to provide these environment variables in a # production deployment. # # On Heroku and other platform providers, you may have a full connection URL # available as an environment variable. For example: # # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase" # # You can use this database configuration with: # # production: # url: <%= ENV['DATABASE_URL'] %> # production: <<: *default database: ruby-getting-started_production username: ruby-getting-started password: <%= ENV['RUBY-GETTING-STARTED_DATABASE_PASSWORD'] %> ================================================ FILE: docker/ruby/config/environment.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 # Load the Rails application. require_relative 'application' # Initialize the Rails application. Rails.application.initialize! ================================================ FILE: docker/ruby/config/environments/development.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false # Do not eager load code on boot. config.eager_load = false # Show full error reports. config.consider_all_requests_local = true # Enable/disable caching. By default caching is disabled. # Run rails dev:cache to toggle caching. if Rails.root.join('tmp', 'caching-dev.txt').exist? config.action_controller.perform_caching = true config.cache_store = :memory_store config.public_file_server.headers = { 'Cache-Control' => "public, max-age=#{2.days.to_i}" } else config.action_controller.perform_caching = false config.cache_store = :null_store end # Store uploaded files on the local file system (see config/storage.yml for options) config.active_storage.service = :local # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false config.action_mailer.perform_caching = false # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load # Highlight code that triggered database queries in logs. config.active_record.verbose_query_logs = true # Debug mode disables concatenation and preprocessing of assets. # This option may cause significant delays in view rendering with a large # number of complex assets. config.assets.debug = true # Suppress logger output for asset requests. config.assets.quiet = true # Raises error for missing translations # config.action_view.raise_on_missing_translations = true # Use an evented file watcher to asynchronously detect changes in source code, # routes, locales, etc. This feature depends on the listen gem. config.file_watcher = ActiveSupport::EventedFileUpdateChecker end ================================================ FILE: docker/ruby/config/environments/production.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web servers # and those relying on copy on write to perform better. # Rake tasks automatically ignore this option for performance. config.eager_load = true # Full error reports are disabled and caching is turned on. config.consider_all_requests_local = false config.action_controller.perform_caching = true # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). # config.require_master_key = true # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier # config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb # Enable serving of images, stylesheets, and JavaScripts from an asset server. # config.action_controller.asset_host = 'http://assets.example.com' # Specifies the header that your server uses for sending files. # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX # Store uploaded files on the local file system (see config/storage.yml for options) config.active_storage.service = :local # Mount Action Cable outside main process or domain # config.action_cable.mount_path = nil # config.action_cable.url = 'wss://example.com/cable' # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true # Use the lowest log level to ensure availability of diagnostic information # when problems arise. config.log_level = :debug # Prepend all log lines with the following tags. config.log_tags = [ :request_id ] # Use a different cache store in production. # config.cache_store = :mem_cache_store # Use a real queuing backend for Active Job (and separate queues per environment) # config.active_job.queue_adapter = :resque # config.active_job.queue_name_prefix = "ruby_getting_started_#{Rails.env}" config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. # config.action_mailer.raise_delivery_errors = false # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new # Use a different logger for distributed setups. # require 'syslog/logger' # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') if ENV["RAILS_LOG_TO_STDOUT"].present? logger = ActiveSupport::Logger.new(STDOUT) logger.formatter = config.log_formatter config.logger = ActiveSupport::TaggedLogging.new(logger) end # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false end ================================================ FILE: docker/ruby/config/environments/test.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between test runs. Don't rely on the data there! config.cache_classes = true # Do not eager load code on boot. This avoids loading your whole application # just for the purpose of running a single test. If you are using a tool that # preloads Rails for running tests, you may have to set it to true. config.eager_load = false # Configure public file server for tests with Cache-Control for performance. config.public_file_server.enabled = true config.public_file_server.headers = { 'Cache-Control' => "public, max-age=#{1.hour.to_i}" } # Show full error reports and disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false # Raise exceptions instead of rendering exception templates. config.action_dispatch.show_exceptions = false # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false # Store uploaded files on the local file system in a temporary directory config.active_storage.service = :test config.action_mailer.perform_caching = false # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr # Raises error for missing translations # config.action_view.raise_on_missing_translations = true end ================================================ FILE: docker/ruby/config/initializers/application_controller_renderer.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 # Be sure to restart your server when you modify this file. # ActiveSupport::Reloader.to_prepare do # ApplicationController.renderer.defaults.merge!( # http_host: 'example.org', # https: false # ) # end ================================================ FILE: docker/ruby/config/initializers/assets.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 # Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = '1.0' # Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path # Add Yarn node_modules folder to the asset load path. Rails.application.config.assets.paths << Rails.root.join('node_modules') # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in the app/assets # folder are already added. # Rails.application.config.assets.precompile += %w( admin.js admin.css ) ================================================ FILE: docker/ruby/config/initializers/backtrace_silencers.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 # Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. # Rails.backtrace_cleaner.remove_silencers! ================================================ FILE: docker/ruby/config/initializers/content_security_policy.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 # Be sure to restart your server when you modify this file. # Define an application-wide content security policy # For further information see the following documentation # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy # Rails.application.config.content_security_policy do |policy| # policy.default_src :self, :https # policy.font_src :self, :https, :data # policy.img_src :self, :https, :data # policy.object_src :none # policy.script_src :self, :https # policy.style_src :self, :https # # Specify URI for violation reports # # policy.report_uri "/csp-violation-report-endpoint" # end # If you are using UJS then enable automatic nonce generation # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } # Report CSP violations to a specified URI # For further information see the following documentation: # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only # Rails.application.config.content_security_policy_report_only = true ================================================ FILE: docker/ruby/config/initializers/cookies_serializer.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 # Be sure to restart your server when you modify this file. # Specify a serializer for the signed and encrypted cookie jars. # Valid options are :json, :marshal, and :hybrid. Rails.application.config.action_dispatch.cookies_serializer = :json ================================================ FILE: docker/ruby/config/initializers/filter_parameter_logging.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 # Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. Rails.application.config.filter_parameters += [:password] ================================================ FILE: docker/ruby/config/initializers/inflections.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 # Be sure to restart your server when you modify this file. # Add new inflection rules using the following format. Inflections # are locale specific, and you may define rules for as many different # locales as you wish. All of these examples are active by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', 'people' # inflect.uncountable %w( fish sheep ) # end # These inflection rules are supported but not enabled by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| # inflect.acronym 'RESTful' # end ================================================ FILE: docker/ruby/config/initializers/mime_types.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 # Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf ================================================ FILE: docker/ruby/config/initializers/new_framework_defaults_5_2.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 # Be sure to restart your server when you modify this file. # # This file contains migration options to ease your Rails 5.2 upgrade. # # Once upgraded flip defaults one by one to migrate to the new default. # # Read the Guide for Upgrading Ruby on Rails for more info on each option. # Make Active Record use stable #cache_key alongside new #cache_version method. # This is needed for recyclable cache keys. # Rails.application.config.active_record.cache_versioning = true # Use AES-256-GCM authenticated encryption for encrypted cookies. # Also, embed cookie expiry in signed or encrypted cookies for increased security. # # This option is not backwards compatible with earlier Rails versions. # It's best enabled when your entire app is migrated and stable on 5.2. # # Existing cookies will be converted on read then written with the new scheme. # Rails.application.config.action_dispatch.use_authenticated_cookie_encryption = true # Use AES-256-GCM authenticated encryption as default cipher for encrypting messages # instead of AES-256-CBC, when use_authenticated_message_encryption is set to true. # Rails.application.config.active_support.use_authenticated_message_encryption = true # Add default protection from forgery to ActionController::Base instead of in # ApplicationController. # Rails.application.config.action_controller.default_protect_from_forgery = true # Store boolean values are in sqlite3 databases as 1 and 0 instead of 't' and # 'f' after migrating old data. # Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true # Use SHA-1 instead of MD5 to generate non-sensitive digests, such as the ETag header. # Rails.application.config.active_support.use_sha1_digests = true # Make `form_with` generate id attributes for any generated HTML tags. # Rails.application.config.action_view.form_with_generates_ids = true ================================================ FILE: docker/ruby/config/initializers/session_store.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 # Be sure to restart your server when you modify this file. Rails.application.config.session_store :cookie_store, key: '_ruby-getting-started_session' ================================================ FILE: docker/ruby/config/initializers/wrap_parameters.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 # Be sure to restart your server when you modify this file. # This file contains settings for ActionController::ParamsWrapper which # is enabled by default. # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do wrap_parameters format: [:json] end # To enable root element in JSON for ActiveRecord objects. # ActiveSupport.on_load(:active_record) do # self.include_root_in_json = true # end ================================================ FILE: docker/ruby/config/locales/en.yml ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 # Files in the config/locales directory are used for internationalization # and are automatically loaded by Rails. If you want to use locales other # than English, add the necessary files in this directory. # # To use the locales, use `I18n.t`: # # I18n.t 'hello' # # In views, this is aliased to just `t`: # # <%= t('hello') %> # # To use a different locale, set it with `I18n.locale`: # # I18n.locale = :es # # This would use the information in config/locales/es.yml. # # The following keys must be escaped otherwise they will not be retrieved by # the default I18n backend: # # true, false, on, off, yes, no # # Instead, surround them with single quotes. # # en: # 'true': 'foo' # # To learn more, please read the Rails Internationalization guide # available at http://guides.rubyonrails.org/i18n.html. en: hello: "Hello world" ================================================ FILE: docker/ruby/config/puma.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 workers ENV.fetch('WEB_CONCURRENCY') { 2 } threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 } threads threads_count, threads_count preload_app! rackup DefaultRackup port ENV.fetch("PORT") { 3000 } environment ENV.fetch("RAILS_ENV") { "development" } on_worker_boot do # Worker specific setup for Rails 4.1+ # See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot ActiveRecord::Base.establish_connection end # Allow puma to be restarted by `rails restart` command. plugin :tmp_restart ================================================ FILE: docker/ruby/config/routes.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 Rails.application.routes.draw do resources :widgets # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". # You can have the root of your site routed with "root" root 'welcome#index' # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html end ================================================ FILE: docker/ruby/config/secrets.yml ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 # Be sure to restart your server when you modify this file. # Your secret key is used for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. # You can use `rake secret` to generate a secure secret key. # Make sure the secrets in this file are kept private # if you're sharing your code publicly. development: secret_key_base: 86bc88971370072b5c3fb0122870b37ce0750d2c883f0890165dc45a43bad83b64625f9fba351730afe26002f006db3ecc193fffc63ff38a827825746041d28f test: secret_key_base: 189f8e836260fb93a522a78e6a157b34178bd09d65174da1e64a964f9c4010a76d620332e6b2106b3af215cc4522a0e6053aed7b108ef8c5ee0ae25cef38f7c0 # Do not keep production secrets in the repository, # instead read values from the environment. production: secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> ================================================ FILE: docker/ruby/config/spring.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 %w[ .ruby-version .rbenv-vars tmp/restart.txt tmp/caching-dev.txt ].each { |path| Spring.watch(path) } ================================================ FILE: docker/ruby/config/storage.yml ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 test: service: Disk root: <%= Rails.root.join("tmp/storage") %> local: service: Disk root: <%= Rails.root.join("storage") %> # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) # amazon: # service: S3 # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> # region: us-east-1 # bucket: your_own_bucket # Remember not to checkin your GCS keyfile to a repository # google: # service: GCS # project: your_project # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> # bucket: your_own_bucket # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) # microsoft: # service: AzureStorage # storage_account_name: your_account_name # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> # container: your_container_name # mirror: # service: Mirror # primary: local # mirrors: [ amazon, google, microsoft ] ================================================ FILE: docker/ruby/config.ru ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 # This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) run Rails.application ================================================ FILE: docker/ruby/db/migrate/20140707111715_create_widgets.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 class CreateWidgets < ActiveRecord::Migration[5.1] def change create_table :widgets do |t| t.string :name t.text :description t.integer :stock t.timestamps end end end ================================================ FILE: docker/ruby/db/schema.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative source for your # database schema. If you need to create the application database on another # system, you should be using db:schema:load, not running all the migrations # from scratch. The latter is a flawed and unsustainable approach (the more migrations # you'll amass, the slower it'll run and the greater likelihood for issues). # # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 20140707111715) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" create_table "widgets", force: :cascade do |t| t.string "name" t.text "description" t.integer "stock" t.datetime "created_at", null: false t.datetime "updated_at", null: false end end ================================================ FILE: docker/ruby/db/seeds.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 # This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel', city: cities.first) ================================================ FILE: docker/ruby/lib/assets/.keep ================================================ ================================================ FILE: docker/ruby/lib/tasks/.keep ================================================ ================================================ FILE: docker/ruby/log/.keep ================================================ ================================================ FILE: docker/ruby/public/404.html ================================================ The page you were looking for doesn't exist (404)

The page you were looking for doesn't exist.

You may have mistyped the address or the page may have moved.

If you are the application owner check the logs for more information.

================================================ FILE: docker/ruby/public/422.html ================================================ The change you wanted was rejected (422)

The change you wanted was rejected.

Maybe you tried to change something you didn't have access to.

If you are the application owner check the logs for more information.

================================================ FILE: docker/ruby/public/500.html ================================================ We're sorry, but something went wrong (500)

We're sorry, but something went wrong.

If you are the application owner check the logs for more information.

================================================ FILE: docker/ruby/public/robots.txt ================================================ # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file # # To ban all spiders from the entire site uncomment the next two lines: # User-agent: * # Disallow: / ================================================ FILE: docker/ruby/test/controllers/.keep ================================================ ================================================ FILE: docker/ruby/test/controllers/welcome_controller_test.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 require 'test_helper' class WelcomeControllerTest < ActionController::TestCase # test "the truth" do # assert true # end end ================================================ FILE: docker/ruby/test/controllers/widgets_controller_test.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 require 'test_helper' class WidgetsControllerTest < ActionController::TestCase setup do @widget = widgets(:one) end test "should get index" do get :index assert_response :success end test "should get new" do get :new assert_response :success end test "should create widget" do assert_difference('Widget.count') do post :create, params: { widget: { description: @widget.description, name: @widget.name, stock: @widget.stock } } end assert_redirected_to widget_path(@widget.id + 1) end test "should show widget" do get :show, params: { id: @widget } assert_response :success end test "should get edit" do get :edit, params: { id: @widget } assert_response :success end test "should update widget" do patch :update, params: { id: @widget, widget: { description: @widget.description, name: @widget.name, stock: @widget.stock } } assert_redirected_to widget_path(@widget) end test "should destroy widget" do assert_difference('Widget.count', -1) do delete :destroy, params: { id: @widget } end assert_redirected_to widgets_path end end ================================================ FILE: docker/ruby/test/fixtures/.keep ================================================ ================================================ FILE: docker/ruby/test/fixtures/widgets.yml ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html one: name: MyString description: MyText stock: 1 two: name: MyString description: MyText stock: 1 ================================================ FILE: docker/ruby/test/helpers/.keep ================================================ ================================================ FILE: docker/ruby/test/helpers/welcome_helper_test.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 require 'test_helper' class WelcomeHelperTest < ActionView::TestCase end ================================================ FILE: docker/ruby/test/helpers/widgets_helper_test.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 require 'test_helper' class WidgetsHelperTest < ActionView::TestCase end ================================================ FILE: docker/ruby/test/integration/.keep ================================================ ================================================ FILE: docker/ruby/test/mailers/.keep ================================================ ================================================ FILE: docker/ruby/test/models/.keep ================================================ ================================================ FILE: docker/ruby/test/models/widget_test.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 require 'test_helper' class WidgetTest < ActiveSupport::TestCase # test "the truth" do # assert true # end end ================================================ FILE: docker/ruby/test/test_helper.rb ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. fixtures :all # Add more helper methods to be used by all tests here... end ================================================ FILE: docker/ruby/vendor/assets/javascripts/.keep ================================================ ================================================ FILE: docker/ruby/vendor/assets/stylesheets/.keep ================================================ ================================================ FILE: docker/ruby/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "example-ruby" app "example-ruby" { labels = { "service" = "example-ruby", "env" = "dev" } build { use "pack" {} } deploy { use "docker" { static_environment = { GEM_PATH = "/layers/heroku_ruby/gems/vendor/bundle/ruby/2.6.0" PATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:bin:/layers/heroku_ruby/gems/vendor/bundle/ruby/2.6.0/bin" } } } } ================================================ FILE: docker/static/Dockerfile ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 FROM nginx:stable COPY ./public/ /var/www COPY ./nginx.conf /etc/nginx/conf.d/default.conf ================================================ FILE: docker/static/README.md ================================================ # Waypoint Static Website Example |Title|Description| |---|---| |Pack|Docker| |Cloud|Local| |Language|HTML| |Docs|[Docker](https://www.waypointproject.io/plugins/docker)| |Tutorial|[HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/get-started-docker)| A static HTML and CSS website that can be deployed with Docker. Uses the `nginx` image configured to run on the default Waypoint port 3000. ================================================ FILE: docker/static/nginx.conf ================================================ server { listen 3000; server_name _; root /var/www/; index index.html; # Send all single page app paths to index.html location / { try_files $uri /index.html; } } ================================================ FILE: docker/static/public/index.html ================================================ Waypoint Nginx Example
Icon

This static HTML app was deployed with Waypoint on Nginx.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: docker/static/public/static/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/static/images/pattern-tl.svg), url(/static/images/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } .language-image { width: 60px; height: 60px; } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: docker/static/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "nginx-project-logsmaybe2" # Labels can be specified for organizational purposes. # labels = { "foo" = "bar" } app "web" { build { use "docker" { } } deploy { use "docker" { } } } ================================================ FILE: docker/svelte/.gitignore ================================================ node_modules public/build ================================================ FILE: docker/svelte/Dockerfile ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 FROM node:14-alpine WORKDIR /usr/src/app COPY rollup.config.js ./ COPY package*.json ./ RUN npm install COPY ./src ./src COPY ./public ./public RUN npm run-script build EXPOSE 5000 ENV HOST=0.0.0.0 CMD [ "npm", "start" ] ================================================ FILE: docker/svelte/README.md ================================================ # Getting Started with Waypoint and Svelte 1. Run `waypoint init` in this example directory with `waypoint.hcl`. 1. Run `waypoint up` to build and deploy the application. For more information on Svelte, see [https://svelte.dev](https://svelte.dev). ================================================ FILE: docker/svelte/package.json ================================================ { "name": "svelte-app", "version": "1.0.0", "scripts": { "build": "rollup -c", "dev": "rollup -c -w", "start": "sirv public" }, "devDependencies": { "@rollup/plugin-commonjs": "^14.0.0", "@rollup/plugin-node-resolve": "^8.0.0", "rollup": "^2.3.4", "rollup-plugin-livereload": "^2.0.0", "rollup-plugin-svelte": "^6.0.0", "rollup-plugin-terser": "^7.0.0", "svelte": "^3.0.0" }, "dependencies": { "sirv-cli": "^1.0.0" } } ================================================ FILE: docker/svelte/public/index.html ================================================ ================================================ FILE: docker/svelte/public/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/pattern-tl.svg), url(/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } .language-image { width: 60px; height: 60px; } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: docker/svelte/rollup.config.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ import svelte from 'rollup-plugin-svelte'; import resolve from '@rollup/plugin-node-resolve'; import commonjs from '@rollup/plugin-commonjs'; import livereload from 'rollup-plugin-livereload'; import { terser } from 'rollup-plugin-terser'; const production = !process.env.ROLLUP_WATCH; function serve() { let server; function toExit() { if (server) server.kill(0); } return { writeBundle() { if (server) return; server = require('child_process').spawn('npm', ['run', 'start', '--', '--dev'], { stdio: ['ignore', 'inherit', 'inherit'], shell: true }); process.on('SIGTERM', toExit); process.on('exit', toExit); } }; } export default { input: 'src/main.js', output: { sourcemap: true, format: 'iife', name: 'app', file: 'public/build/bundle.js' }, plugins: [ svelte({ // enable run-time checks when not in production dev: !production, // we'll extract any component CSS out into // a separate file - better for performance css: css => { css.write('bundle.css'); } }), // If you have external dependencies installed from // npm, you'll most likely need these plugins. In // some cases you'll need additional configuration - // consult the documentation for details: // https://github.com/rollup/plugins/tree/master/packages/commonjs resolve({ browser: true, dedupe: ['svelte'] }), commonjs(), // In dev mode, call `npm run start` once // the bundle has been generated !production && serve(), // Watch the `public` directory and refresh the // browser on changes when not in production !production && livereload('public'), // If we're building for production (npm run build // instead of npm run dev), minify production && terser() ], watch: { clearScreen: false } }; ================================================ FILE: docker/svelte/src/App.svelte ================================================ Waypoint Svelte Demo ================================================ FILE: docker/svelte/src/main.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ import App from './App.svelte'; const app = new App({ target: document.body, }); export default app; ================================================ FILE: docker/svelte/src/views/Index.svelte ================================================
Svelte Icon

This Svelte app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: docker/svelte/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "example-svelte" app "example-svelte" { labels = { "service" = "example-svelte", "env" = "dev" } build { use "docker" {} } deploy { use "docker" { service_port = 5000 } } } ================================================ FILE: gcp/google-cloud-run/nodejs/.gitignore ================================================ # Node build artifacts node_modules npm-debug.log # Local development *.env *.dev .DS_Store # Docker Dockerfile docker-compose.yml ================================================ FILE: gcp/google-cloud-run/nodejs/Procfile ================================================ web: node index.js ================================================ FILE: gcp/google-cloud-run/nodejs/README.md ================================================ # Waypoint Google Cloud Run Example |Title|Description| |---|---| |Pack|Cloud Native Buildpack| |Cloud|Google Cloud| |Language|NodeJS| |Docs|[Google Cloud Run](https://www.waypointproject.io/plugins/google-cloud-run)| |Tutorial|[HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/google-cloud-run)| ================================================ FILE: gcp/google-cloud-run/nodejs/index.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ const express = require('express') const path = require('path') const PORT = process.env.PORT || 5000 express() .use(express.static(path.join(__dirname, 'public'))) .set('views', path.join(__dirname, 'views')) .set('view engine', 'ejs') .get('/', (req, res) => res.render('pages/index')) .listen(PORT, () => console.log(`Listening on ${ PORT }`)) ================================================ FILE: gcp/google-cloud-run/nodejs/package.json ================================================ { "name": "node-js-getting-started", "version": "0.3.0", "description": "A sample Node.js app using Express 4", "engines": { "node": "12.x" }, "main": "index.js", "scripts": { "start": "node index.js", "test": "node test.js" }, "dependencies": { "ejs": "^2.5.6", "express": "^4.15.2" }, "devDependencies": { "got": "^11.3.0", "tape": "^4.7.0" }, "keywords": [ "node", "express" ], "license": "MIT" } ================================================ FILE: gcp/google-cloud-run/nodejs/public/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/pattern-tl.svg), url(/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: gcp/google-cloud-run/nodejs/views/pages/index.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> <% include ../partials/header.ejs %>
Node.js Icon

This Node.js app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: gcp/google-cloud-run/nodejs/views/partials/header.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> Waypoint Node.js Example ================================================ FILE: gcp/google-cloud-run/nodejs/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "gcp-nodejs" app "gcp-nodejs-web" { labels = { "service" = "gcp-nodejs-web", "env" = "dev" } build { use "pack" {} registry { use "docker" { image = "gcr.io//example-nodejs" tag = "latest" } } } deploy { use "google-cloud-run" { project = "" location = "us-east1" port = 5000 static_environment = { "NAME" : "World" } capacity { memory = 128 cpu_count = 1 max_requests_per_container = 10 request_timeout = 300 } auto_scaling { max = 2 } } } release { use "google-cloud-run" {} } } ================================================ FILE: kubernetes/aws-eks/nodejs/.gitignore ================================================ # Node build artifacts node_modules npm-debug.log # Local development *.env *.dev .DS_Store # Docker Dockerfile docker-compose.yml ================================================ FILE: kubernetes/aws-eks/nodejs/Procfile ================================================ web: node index.js ================================================ FILE: kubernetes/aws-eks/nodejs/README.md ================================================ # Waypoint AWS-EKS Example |Title|Description| |---|---| |Pack|Cloud Native Buildpack| |Cloud|AWS| |Language|NodeJS| |Docs|[Kubernetes](https://www.waypointproject.io/plugins/kubernetes)| |Tutorial|[HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/get-started-kubernetes)| Requirements: - You must create an ECR registry named `waypoint-example` (or choose your own name and edit `waypoint.hcl`). - Create an EKS cluster as shown at [HashiCorp Learn](https://learn.hashicorp.com/tutorials/terraform/eks?in=terraform/kubernetes). - Configure `kubectl` to communicate to the Kubernetes cluster (also covered in the tutorial above). ================================================ FILE: kubernetes/aws-eks/nodejs/index.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ const express = require('express') const path = require('path') const PORT = process.env.PORT || 5000 express() .use(express.static(path.join(__dirname, 'public'))) .set('views', path.join(__dirname, 'views')) .set('view engine', 'ejs') .get('/', (req, res) => res.render('pages/index')) .listen(PORT, () => console.log(`Listening on ${ PORT }`)) ================================================ FILE: kubernetes/aws-eks/nodejs/package.json ================================================ { "name": "node-js-getting-started", "version": "0.3.0", "description": "A sample Node.js app using Express 4", "engines": { "node": "12.x" }, "main": "index.js", "scripts": { "start": "node index.js", "test": "node test.js" }, "dependencies": { "ejs": "^2.5.6", "express": "^4.15.2" }, "devDependencies": { "got": "^11.3.0", "tape": "^4.7.0" }, "keywords": [ "node", "express" ], "license": "MIT" } ================================================ FILE: kubernetes/aws-eks/nodejs/public/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/pattern-tl.svg), url(/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: kubernetes/aws-eks/nodejs/views/pages/index.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> <% include ../partials/header.ejs %>
Node.js Icon

This Node.js app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: kubernetes/aws-eks/nodejs/views/partials/header.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> Waypoint Node.js Example ================================================ FILE: kubernetes/aws-eks/nodejs/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "kubernetes-eks-nodejs" app "eks-nodejs-web" { labels = { "service" = "eks-nodejs-web", "env" = "dev" } build { use "pack" {} registry { use "aws-ecr" { region = "us-east-1" repository = "eks-nodejs-web" tag = "latest" } } } deploy { use "kubernetes" { probe_path = "/" } } release { use "kubernetes" { load_balancer = true port = 80 } } } ================================================ FILE: kubernetes/exec-kubectl-apply/README.md ================================================ # Exec Plugin Example with kubectl apply A Node.js app packaged with Buildpacks and deployed with Kubernetes. Rather than using the standard Waypoint `kubernetes` plugin that creates a Deployment and Service with a single port, this example uses the [`exec` plugin](https://www.waypointproject.io/plugins/exec#examples) to execute `kubectl apply -f` with a templated file. This approach may be helpful when you want to control precisely which Kubernetes resources are created such as a StatefulSet, an app with multiple ports, or similar levels of Kubernetes customizations. This approach is very flexible, yet does have some downsides such as not actually implementing the `waypoint destroy` command, which means resources must be cleaned up separately. Reference `waypoint.hcl` and `example-nodejs-exec.yml` to see how it works. Note the `{{.Input.DockerImageFull}}` and the loop for passing through the Environment Variables to the Kubernetes Deployment: ``` {{range $key, $value := .Env}} - name: {{$key}} value: "{{$value}}"{{end}} ``` An alternative access syntax for .Env if you know the keys is: ``` {{index .Env "WAYPOINT_CEB_INVITE_TOKEN"}} {{index .Env "WAYPOINT_DEPLOYMENT_ID"}} {{index .Env "WAYPOINT_SERVER_ADDR"}} {{index .Env "WAYPOINT_SERVER_TLS"}} {{index .Env "WAYPOINT_SERVER_TLS_SKIP_VERIFY"}} ``` Note that the Waypoint workspace name will be used to create a Kubernetes namespace of the same name with `{{.Workspace}}` syntax to retrieve the name in the template. ## Deployment steps 1. `waypoint init` 1. `waypoint up` 1. Validate that the app is available at the Deployment URL 1. Validate that k8s resources were deployed: `kubectl get deployment.apps/example-nodejs-exec service/example-nodejs-exec -n YOUR_NAMESPACE` ## Cleanup 1. `waypoint destroy` 1. Run `kubectl delete deployment.apps/example-nodejs-exec service/example-nodejs-exec -n YOUR_NAMESPACE` If you used a non-default Workspace, then you may want to also delete the workspace. 1. Run `kubectl delete namespaces YOUR_NAMESPACE` ## Example output ``` $ waypoint up » Building... Creating new buildpack-based image using builder: heroku/buildpacks:18 ✓ Creating pack client ✓ Building image │ [exporter] Adding 1/1 app layer(s) │ [exporter] Reusing layer 'launcher' │ [exporter] Reusing layer 'config' │ [exporter] Adding label 'io.buildpacks.lifecycle.metadata' │ [exporter] Adding label 'io.buildpacks.build.metadata' │ [exporter] Adding label 'io.buildpacks.project.metadata' │ [exporter] *** Images (aa6a41914ac8): │ [exporter] index.docker.io/library/example-nodejs-exec:latest │ [exporter] Reusing cache layer 'heroku/nodejs-engine:nodejs' │ [exporter] Reusing cache layer 'heroku/nodejs-engine:toolbox' ✓ Injecting entrypoint binary to image Generated new Docker image: example-nodejs-exec:latest ✓ Tagging Docker image: example-nodejs-exec:latest => example-nodejs-exec:1 » Deploying... ✓ Rendering templates... ✓ Executing command: kubectl apply -f /var/folders/3f/pgsg1xp16rx2l9hqnqs8ft1h0000gp/T/waypoint-exec344460138/example-nodejs-exec.yml │ deployment.apps/example-nodejs-exec configured │ service/example-nodejs-exec unchanged » Releasing... The deploy was successful! A Waypoint deployment URL is shown below. This can be used internally to check your deployment and is not meant for external traffic. You can manage this hostname using "waypoint hostname." URL: https://rationally-helped-antelope.waypoint.run Deployment URL: https://rationally-helped-antelope--v1.waypoint.run ``` ================================================ FILE: kubernetes/exec-kubectl-apply/example-nodejs-exec.yml ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 apiVersion: v1 kind: Namespace metadata: name: {{.Workspace}} --- apiVersion: apps/v1 kind: Deployment metadata: name: example-nodejs-exec namespace: {{.Workspace}} spec: selector: matchLabels: app: example-nodejs-exec replicas: 2 template: metadata: labels: app: example-nodejs-exec spec: containers: - name: example-nodejs-exec image: {{.Input.DockerImageFull}} ports: - containerPort: 5000 env: - name: WAYPOINT_ALT_TOKEN_EXAMPLE value: "{{index .Env "WAYPOINT_CEB_INVITE_TOKEN"}}"{{range $key, $value := .Env}} - name: {{$key}} value: "{{$value}}"{{end}} --- apiVersion: v1 kind: Service metadata: name: example-nodejs-exec namespace: {{.Workspace}} spec: externalTrafficPolicy: Cluster ports: - name: http port: 5000 protocol: TCP targetPort: 5000 selector: app: example-nodejs-exec sessionAffinity: None type: LoadBalancer ================================================ FILE: kubernetes/exec-kubectl-apply/index.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ const express = require('express') const path = require('path') const PORT = process.env.PORT || 5000 express() .use(express.static(path.join(__dirname, 'public'))) .set('views', path.join(__dirname, 'views')) .set('view engine', 'ejs') .get('/', (req, res) => res.render('pages/index')) .listen(PORT, () => console.log(`Listening on ${ PORT }`)) ================================================ FILE: kubernetes/exec-kubectl-apply/output.txt ================================================ apiVersion: apps/v1 kind: Deployment metadata: name: example-nodejs spec: selector: matchLabels: app: example-nodejs replicas: 2 template: metadata: labels: app: example-nodejs spec: containers: - name: example-nodejs image: nodejs-example:1 ports: - containerPort: 5000 - env: - name: WAYPOINT_CEB_INVITE_TOKEN value: "4RmBPBvZ1DkcuTAxAonjfk9VPncyHpKC4p76iD1BZZKKQ8n7FeeFvWnkN9sWkmHf9SNKBShwi9XTEFz4uSpKapkhs6sCM5Z4qyUBF4SFbcf6CrKYxVwLnmQxonBDY787gqGzebFKJR8YbKXubEM6" - name: WAYPOINT_DEPLOYMENT_ID value: "01EMFZMHNBGWF66A7D4MFGENSR" - name: WAYPOINT_SERVER_ADDR value: "waypoint:9701" - name: WAYPOINT_SERVER_TLS value: "1" - name: WAYPOINT_SERVER_TLS_SKIP_VERIFY value: "1" ================================================ FILE: kubernetes/exec-kubectl-apply/package.json ================================================ { "name": "node-js-getting-started", "version": "0.3.0", "description": "A sample Node.js app using Express 4", "engines": { "node": "12.x" }, "main": "index.js", "scripts": { "start": "node index.js", "test": "node test.js" }, "dependencies": { "ejs": "^2.5.6", "express": "^4.15.2" }, "devDependencies": { "got": "^11.3.0", "tape": "^4.7.0" }, "keywords": [ "node", "express" ], "license": "MIT" } ================================================ FILE: kubernetes/exec-kubectl-apply/public/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/pattern-tl.svg), url(/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: kubernetes/exec-kubectl-apply/views/pages/index.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> <% include ../partials/header.ejs %>
Node.js Icon

This Node.js app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: kubernetes/exec-kubectl-apply/views/partials/header.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> Waypoint Node.js Example ================================================ FILE: kubernetes/exec-kubectl-apply/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "kubernetes-nodejs-exec" app "nodejs-exec" { labels = { "service" = "nodejs-exec", "env" = "dev" } build { use "pack" {} registry { use "docker" { image = "nodejs-exec" tag = "1" local = true } } } deploy { use "exec" { # note "" means replace this with the path to # the templated file post-rendering command = ["kubectl", "apply", "-f", ""] # this file has go template syntax for {{.Input.DockerImageFull}} and # {{.Env}} environment variables template { path = "./example-nodejs-exec.yml" } } } } ================================================ FILE: kubernetes/go/Dockerfile ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 #-------------------------------------------------------------------- # builder #-------------------------------------------------------------------- FROM golang:1.18-alpine AS builder WORKDIR /app-src COPY go.mod ./ RUN go mod download COPY . ./ RUN GOOS=linux GOARCH=amd64 go build -tags netgo -ldflags="-w -s" -o /tmp/go-k8s #-------------------------------------------------------------------- # final image #-------------------------------------------------------------------- FROM scratch COPY --from=builder /tmp/go-k8s /go-k8s COPY --from=builder /app-src/static /static CMD [ "/go-k8s" ] ================================================ FILE: kubernetes/go/README.md ================================================ # Waypoint Go Example | Title | Description | | -------- | ---------------------------------------------------------------------------------------- | | Pack | Docker | | Cloud | Kubernetes | | Language | Go | | Docs | [Docker](https://www.waypointproject.io/plugins/kubernetes) | | Tutorial | [HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/get-started-kubernetes) | A barebones Go API, with a quick minimal docker build, deployed to Kubernetes. ================================================ FILE: kubernetes/go/go.mod ================================================ module github.com/hashicorp/waypoint-examples/kubernetes/go go 1.18 ================================================ FILE: kubernetes/go/main.go ================================================ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 package main import ( "fmt" "log" "net/http" ) func main() { fileServer := http.FileServer(http.Dir("./static")) http.Handle("/", fileServer) fmt.Printf("Starting server at: http://localhost:3000\n") if err := http.ListenAndServe(":3000", nil); err != nil { log.Fatal(err) } } ================================================ FILE: kubernetes/go/static/index.html ================================================ Waypoint Go Example
Icon

This static HTML app was deployed with Waypoint using Go.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: kubernetes/go/static/static/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/static/images/pattern-tl.svg), url(/static/images/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } .language-image { width: 60px; height: 60px; } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: kubernetes/go/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "go-k8s" app "go-k8s" { labels = { "service" = "go-k8s", "env" = "dev" } build { use "docker" {} registry { use "docker" { # Replace with your docker image name (i.e. registry.hub.docker.com/library/go-k8s) image = "your-image-here" tag = gitrefpretty() } } } deploy { use "kubernetes" { probe_path = "/" service_port = 3000 } } release { use "kubernetes" { load_balancer = true } } } ================================================ FILE: kubernetes/go-gitops/README.md ================================================ # Waypoint Go Example | Title | Description | | -------- | ------------------------------------------------------------------------------------ | | Pack | Cloud Native Buildpack | | Cloud | Local | | Language | Go | | Docs | [Docker](https://www.waypointproject.io/plugins/docker) | | Tutorial | [HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/get-started-docker) | A barebones Go API, which can easily be deployed by Waypoint. This example assumes you will be deploying the application onto Kubernetes. It also uses a remote container registry jFrog. You'll need to change the image value to point at your own registry. And be sure to setup your local Kubernetes cluster to have credentials to pull the image. This example also allows users to pull registry information out of Vault. For default values of a registry username and password, Waypoint can use its dynamic config sourcer plugin to obtain these values rather than requiring that they be set on the CLI or UI or checked into Git in a `waypoint.hcl`. If you wish to use Vault for configuring defaults, you may run the following vault command to set up the secrets inside your Vault server: ``` vault kv put secret/registry registry_username=USERNAME registry_password=PASSWORD ``` We'll need to update Waypoint to ensure the Vault dynamic config sourcer plugin has the proper hostname and root token to access Vault: ``` waypoint config source-set -type=vault -config=addr= -config=token= ``` Then, assuming your pod in Kubernetes can access Vault, when Waypoint goes to evaluate your input variables, it will use Vault to fill out these values. ================================================ FILE: kubernetes/go-gitops/go.mod ================================================ module github.com/briancain/go-gitops // +heroku goVersion go1.17 go 1.17 ================================================ FILE: kubernetes/go-gitops/main.go ================================================ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 package main import ( "fmt" "log" "net/http" ) func main() { fileServer := http.FileServer(http.Dir("./static")) http.Handle("/", fileServer) fmt.Printf("Starting server at: http://localhost:3000\n") if err := http.ListenAndServe(":3000", nil); err != nil { log.Fatal(err) } } ================================================ FILE: kubernetes/go-gitops/static/index.html ================================================ Waypoint Go Example
Icon

This static HTML app was deployed with Waypoint using Go.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: kubernetes/go-gitops/static/static/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/static/images/pattern-tl.svg), url(/static/images/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } .language-image { width: 60px; height: 60px; } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: kubernetes/go-gitops/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "kubernetes-go-gitops-0" variable "image" { default = "your.own.container.registry.example.com/go" type = string description = "Image name for the built image in the Docker registry." } variable "tag" { default = "latest" type = string description = "Image tag for the image" } variable "registry_username" { default = dynamic("vault", { path = "config/data/secret/registry" key = "data/registry_username" }) type = string sensitive = true description = "username for container registry" } variable "registry_password" { default = dynamic("vault", { path = "config/data/secret/registry" key = "data/registry_password" }) type = string sensitive = true description = "password for registry" // DO NOT COMMIT YOUR PASSWORD TO GIT } variable "regcred_secret" { default = "regcred" type = string description = "The existing secret name inside Kubernetes for authenticating to the container registry" } app "go-gitops" { build { use "pack" {} registry { use "docker" { image = var.image tag = var.tag username = var.registry_username password = var.registry_password local = false } } } deploy { use "kubernetes" { probe_path = "/" image_secret = var.regcred_secret } } release { use "kubernetes" { load_balancer = true port = 3000 } } } ================================================ FILE: kubernetes/go-multiapp-ingress/.gitignore ================================================ .DS_Store data.db # Local .waypoint directories **/.waypoint/* # Local .terraform directories **/.terraform/* # .tfstate files *.tfstate *.tfstate.* # Crash log files crash.log # Ignore any .tfvars files that are generated automatically for each Terraform run. Most # .tfvars files are managed as part of configuration and so should be included in # version control. # # example.tfvars # Ignore override files as they are usually used to override resources locally and so # are not checked in override.tf override.tf.json *_override.tf *_override.tf.json # Include override files you do wish to add to version control using negated pattern # # !example_override.tf # Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan # example: *tfplan* ================================================ FILE: kubernetes/go-multiapp-ingress/README.md ================================================ # Waypoint Kubernetes Example with Multiple Apps and Ingress |Title|Description| |---|---| |Pack|Cloud Native Buildpack| |Cloud|Any| |Language|Golang| |Docs|[Kubernetes](https://www.waypointproject.io/plugins/kubernetes)| Waypoint can deploy to a local Kubernetes server or a cloud-hosted cluster. See the tutorial for details. Note that an ingress controller is required prior to deploying applications. ================================================ FILE: kubernetes/go-multiapp-ingress/app-one/index.html ================================================ Waypoint Go Example
Icon

This static HTML app was deployed with Waypoint using Go.

This is the first applications website!!

Read the documentation for more about Waypoint.

================================================ FILE: kubernetes/go-multiapp-ingress/app-one/static/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/static/images/pattern-tl.svg), url(/static/images/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } .language-image { width: 60px; height: 60px; } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: kubernetes/go-multiapp-ingress/app-two/index.html ================================================ Waypoint Go Example
Icon

This static HTML app was deployed with Waypoint using Go.

This is the second applications site!!

Read the documentation for more about Waypoint.

================================================ FILE: kubernetes/go-multiapp-ingress/app-two/static/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/static/images/pattern-tl.svg), url(/static/images/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } .language-image { width: 60px; height: 60px; } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: kubernetes/go-multiapp-ingress/go.mod ================================================ module github.com/briancain/waypoint-k8s-ingress // +heroku goVersion go1.17 go 1.17 ================================================ FILE: kubernetes/go-multiapp-ingress/main.go ================================================ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 package main import ( "fmt" "log" "net/http" ) func main() { http.Handle("/app-one", http.StripPrefix("/app-one", http.FileServer(http.Dir("./app-one")))) http.Handle("/app-two", http.StripPrefix("/app-two", http.FileServer(http.Dir("./app-two")))) http.Handle("/", http.FileServer(http.Dir("./static"))) fmt.Printf("Starting server at: http://localhost:3000\n") if err := http.ListenAndServe(":3000", nil); err != nil { log.Fatal(err) } } ================================================ FILE: kubernetes/go-multiapp-ingress/static/index.html ================================================ Waypoint Go Example
Icon

This static HTML app was deployed with Waypoint using Go.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: kubernetes/go-multiapp-ingress/static/static/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/static/images/pattern-tl.svg), url(/static/images/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } .language-image { width: 60px; height: 60px; } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: kubernetes/go-multiapp-ingress/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "kubernetes-go-multiapp-k8s-ingress" variable "namespace" { default = "ingress-nginx" type = string description = "The namespace to deploy and release to in your Kubernetes cluster." } app "go-multiapp-one" { labels = { "service" = "go-multiapp-one", "env" = "dev" } config { env = { WP_NODE = "ONE" } } build { use "pack" {} registry { use "docker" { image = "go-multiapp-one" tag = "1" local = false } } } deploy { use "kubernetes" { probe_path = "/" namespace = var.namespace } } release { use "kubernetes" { namespace = var.namespace ingress "http" { path_type = "Prefix" path = "/app-one" } } } } app "go-multiapp-two" { labels = { "service" = "go-multiapp-two", "env" = "dev" } config { env = { WP_NODE = "TWO" } } build { use "pack" {} registry { use "docker" { image = "go-multiapp-two" tag = "1" local = false } } } deploy { use "kubernetes" { probe_path = "/" namespace = var.namespace } } release { use "kubernetes" { namespace = var.namespace ingress "http" { path_type = "Prefix" path = "/app-two" } } } } app "default-app" { labels = { "service" = "default-app", "env" = "dev" } build { use "pack" {} registry { use "docker" { image = "default-app" tag = "1" local = false } } } deploy { use "kubernetes" { probe_path = "/" namespace = var.namespace } } release { use "kubernetes" { namespace = var.namespace ingress "http" { default = true path_type = "Prefix" path = "/" } } } } ================================================ FILE: kubernetes/go-multiworkspace/Dockerfile ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 #-------------------------------------------------------------------- # builder #-------------------------------------------------------------------- FROM golang:1.17.2-alpine3.14 AS builder WORKDIR /app-src COPY go.mod ./ COPY go.sum ./ RUN go mod download COPY . ./ RUN go build -o /tmp/go-multiworkspace #-------------------------------------------------------------------- # final image #-------------------------------------------------------------------- FROM alpine:3.14 # Config is expected to be delivered here at runtime RUN mkdir /opt/config COPY --from=builder /tmp/go-multiworkspace /go-multiworkspace CMD [ "/go-multiworkspace" ] ================================================ FILE: kubernetes/go-multiworkspace/README.md ================================================ # Waypoint Multi-Workspace example (in go) | Title | Description | | -------- | ------------------------------------------------------------------------------------ | | Pack | Docker | | Cloud | Kubernetes/AWS | | Language | Go | | Tutorial | coming soon | This is a complex example showing how workspaces can be used to model dev and prod environments, where dev and prod have different namespaces, different config (sourced from vault), and different load balancers, with only the prod load balancer public. ## Prerequisites ### Kubernetes namespaces You should have namespaces in your k8s cluster named `dev` and `prod`. These names are used in the waypoint.hcl. ### Waypoint installation Waypoint will need to be installed in such a way that it can access the dev and prod k8s namespaces. This is most easily accomplished by installing Waypoint with the [helm chart](https://www.Waypointproject.io/docs/kubernetes/helm-deploy). ### Vault setup A Vault cluster is required. Its api address must be reachable from pods in your dev and prod namespaces. The best way to set this up is by configuring the [Vault Kubernetes auth method](https://www.vaultproject.io/docs/auth/kubernetes), and the Waypoint Vault config sourcer using [Kubernetes auth](https://www.Waypointproject.io/plugins/vault#kubernetes_role). This also presumes that dev and prod exist in Vault under a KV secrets engine named `config`, with the path `gomultiapp/{dev,prod}/config.yml` This has been tested with an [HCP Vault](https://cloud.hashicorp.com/#vault) cluster peered to the AWS VPC that contains the EKS cluster. ### AWS setup This project uses the AWS ECR container registry, AWS loadbalancers, and has been tested on EKS. To support gitops workflows, Waypoint runners need push access to ECR - this can be accomplished by adding the `AmazonEc2ContainerRegistryFullAccess` policy to the EKS node group role, but more granular access is also possible. ## Dev and Prod Environments In this example, the dev environment is represented by the "default" Waypoint workspace, and prod by the "prod" workspace. To deploy to dev: ```shell-session $ waypoint up ``` To interact with the prod environment, add the `-workspace=prod` flag to any Waypoint command. After verifying changes in dev, they can be deployed to prod with: ```shell-session $ waypoint up -workspace=prod ``` ================================================ FILE: kubernetes/go-multiworkspace/config.yml ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 hello_message: "hello from local" port: 8080 ================================================ FILE: kubernetes/go-multiworkspace/go.mod ================================================ module go-multiworkspace go 1.16 require gopkg.in/yaml.v2 v2.4.0 ================================================ FILE: kubernetes/go-multiworkspace/go.sum ================================================ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= ================================================ FILE: kubernetes/go-multiworkspace/main.go ================================================ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 package main import ( "fmt" "log" "io/ioutil" "net/http" "os" "gopkg.in/yaml.v2" ) const CONFIG_PATH_KEY = "CONFIG_PATH" type config struct { HelloMessage string `yaml:"hello_message"` Port int `yaml:"port"` } func loadConfig() (*config, error) { configPath := os.Getenv(CONFIG_PATH_KEY) if configPath == "" { return nil, fmt.Errorf("%s not set", CONFIG_PATH_KEY) } configFile, err := ioutil.ReadFile(configPath) if err != nil { return nil, err } var c config if err := yaml.Unmarshal(configFile, &c); err != nil { return nil, fmt.Errorf("failed parsing config: %s", err) } return &c, nil } func main() { cfg, err := loadConfig() if err != nil { panic(err) } http.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) { w.Write([]byte("healthy\n")) return }) http.HandleFunc("/hello", func(w http.ResponseWriter, r *http.Request) { log.Printf("Hello request from Addr: %s, Host: %s", r.RemoteAddr, r.Host) w.Write([]byte(fmt.Sprintf("Here is today's message: %q\n", cfg.HelloMessage))) return }) // Apply default port if necessary var port int if cfg.Port != 0 { port = cfg.Port } else { port = 8080 log.Printf("Defaulting to port %d", port) } serveAddr := fmt.Sprintf(":%d", port) log.Printf("Starting server at: %s\n", serveAddr) if err := http.ListenAndServe(serveAddr, nil); err != nil { log.Fatal(err) } } ================================================ FILE: kubernetes/go-multiworkspace/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "kubernetes-go-multiworkspace" app "backend" { config { env = { "CONFIG_PATH" = "/opt/config/config.yml" } workspace "default" { file = { "/opt/config/config.yml" = configdynamic("vault", { path = "config/data/go-multiworkspace/dev" key = "data/config.yml" }) } } workspace "prod" { file = { "/opt/config/config.yml" = configdynamic("vault", { path = "config/data/go-multiworkspace/prod" key = "data/config.yml" }) } } } build { use "docker" {} registry { use "aws-ecr" { region = "us-east-2" repository = "acmecorp" tag = gitrefpretty() } } } deploy { use "kubernetes" { # Use the dev kubernetes namespace with the dev workspace, and prod with prod. # Error on any other workspace. namespace = { "default" = "dev" "prod" = "prod" }[workspace.name] probe_path = "/health" service_account = "go-multiworkspace" service_port = 8080 } } release { use "kubernetes" { # Use the dev kubernetes namespace with the dev workspace, and prod with prod. # Error on any other workspace. namespace = { "default" = "dev" "prod" = "prod" }[workspace.name] load_balancer = true annotations = { # Assign an internal load balancer in dev, and external in prod "service.beta.kubernetes.io/aws-load-balancer-internal" = { "default" = "true" "prod" = "false" }[workspace.name] # # Use the correct cert for the workspace # "service.beta.kubernetes.io/aws-load-balancer-ssl-cert" = { # "dev" = "dev-cert-arn" # "prod" = "prod-cert-arn" # }[workspace.name] } } } } ================================================ FILE: kubernetes/go-workspace-pull/Dockerfile ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 #-------------------------------------------------------------------- # builder #-------------------------------------------------------------------- FROM golang:1.18-alpine AS builder WORKDIR /app-src COPY go.mod ./ RUN go mod download COPY . ./ RUN GOOS=linux GOARCH=amd64 go build -tags netgo -ldflags="-w -s" -o /tmp/go-k8s #-------------------------------------------------------------------- # final image #-------------------------------------------------------------------- FROM scratch COPY --from=builder /tmp/go-k8s /go-k8s COPY --from=builder /app-src/static /static CMD [ "/go-k8s" ] ================================================ FILE: kubernetes/go-workspace-pull/README.md ================================================ # Waypoint Go Example with Docker and Docker Pull | Title | Description | | -------- | ---------------------------------------------------------------------------------------- | | Pack | Docker, Docker Pull | | Cloud | Kubernetes | | Language | Go | | Docs | [Kubernetes](https://www.waypointproject.io/plugins/kubernetes) | A barebones Go API, with a quick minimal docker build, deployed to Kubernetes. This example demonstrates using the `docker-pull` plugin, to pull the image build in a non-production build/release, and use it for a production deployment. The included `waypoint.hcl` file contains several variables with defaults, but users will need to supply their own registry credentials. It is not recommended to include credentials in the `waypoint.hcl` file itself, instead an easy way to try this example would be to create a local `wpvars` files and use them when running `waypoint` commands. Technically users could use the same registry, credentials, and image for this example, so long as the tag value changes between production and development to ensure `dev` and `prod` workspaces aren't pushing and pulling to the same image. ### Example: Creating a development build Create the initial development build using the `dev.wpvars` file like so: ``` # dev.wpvars // push to the dev registry push_image="dev-registry-url/example-go-pull" push_registry_username="developer" push_registry_password="some password" ``` Then execute a `waypoint build`, referencing the file: ``` $ waypoint build -var-file=dev.wpvars » Building go-k8s... Performing operation on "kubernetes" with runner profile "01GGACDWSQZ1BR3TNR8EW0KY1A" » Cloning data from Git URL: https://github.com/hashicorp/waypoint-examples.git Ref: go-workspace-pull » Downloading from Git Git Commit: a59c6a6a518bc22259db35cc0ba02b1dd56d4483 Timestamp: 2022-10-28 17:19:00 +0000 UTC Message: more updates ✓ Running build v17 ✓ Building Docker image with kaniko... ✓ Testing registry and uploading entrypoint layer ✓ Executing kaniko... │ INFO[0012] Executing 0 build triggers │ INFO[0012] Unpacking rootfs as cmd COPY --from=builder /tmp/go-k8s /go-k8s requi │ res it. │ INFO[0012] COPY --from=builder /tmp/go-k8s /go-k8s │ INFO[0012] Taking snapshot of files... │ INFO[0012] COPY --from=builder /app-src/static /static │ INFO[0012] Taking snapshot of files... │ INFO[0012] CMD [ "/go-k8s" ] │ INFO[0012] Pushing image to localhost:37809/catsby/example-go-pull:dev │ INFO[0014] Pushed image to 1 destinations ✓ Image pushed to 'catsby/example-go-pull:dev' ✓ Running push build v16 Created artifact v16 » Variables used: VARIABLE | VALUE | TYPE | SOURCE -------------------------+-----------------------------------------------+-----------+---------- pull_registry_password | b1f991bfcaf3ab4dc9383bae461e2b9ce331103bb55a0 | sensitive | default | 63d66c378a40980c817 | | pull_registry_username | 890e8f907513987332a9679089def709997ac359a11e8 | sensitive | default | e378c0810e9eac12e16 | | pull_tag | dev | string | default push_registry_password | 122bc444b708853582dafe3cda069461b2a2c6ebce9a9 | sensitive | file | d38aee531a98d6d3d03 | | push_registry_username | 890e8f907513987332a9679089def709997ac359a11e8 | sensitive | file | e378c0810e9eac12e16 | | push_tag | dev | string | default port | 3000 | int | default pull_image | catsby/example-go-pull | string | default push_image | catsby/example-go-pull | string | file ``` This will create the first docker image and push it up to the registry defined in the `dev.wpvars` file. Specifically note that: - The output from Kaniko demonstrates actually building the container image - the `SOURCE` for the `push_` variables are read from file - the `SOURCE` for the `pull_` variables use the defaults because they were not overriden in the `dev.wpvars` file ### Example: Creating a production build Users can then use the dev image with the `docker-pull` plugin by using another wpvars file, `prod.wpvars`, which adds the `pull_` variables and changes the `push_` variables. In this example, the values use for `push_` variables in `dev.wpvars` are now the values used for the `pull_` variable values, and new `push_` values are added in the `prod.wpvars` file. Technically they could be the same values for both, as the `push_tag` and `pull_tag` are not overridden in either wpvar files and are coded in the `waypoint.hcl` file. This was done to ensure default workspace builds push with the `dev` tag and production workspace builds pull with the `dev` tag and push with the `latest` tag. ``` # prod.wpvars // pull from the dev registry pull_image="dev-registry-url/example-go-pull" pull_registry_username="developer" pull_registry_password="some password" // push to the prod registry push_image="prov-registry-url/example-go-pull" push_registry_username="releaser" push_registry_password="some password" ``` Run a production build with `waypoint build`, referencing the prod wpvars file: ``` $ waypoint build -workspace=production -var-file=prod.wpvars » Building go-k8s... Performing operation on "kubernetes" with runner profile "01GGACDWSQZ1BR3TNR8EW0KY1A" » Cloning data from Git URL: https://github.com/hashicorp/waypoint-examples.git Ref: go-workspace-pull Git Commit: a59c6a6a518bc22259db35cc0ba02b1dd56d4483 Timestamp: 2022-10-28 17:19:00 +0000 UTC Message: more updates ✓ Running build v18 ✓ Injecting entrypoint... ⠋ Executing Kaniko... │ INFO[0000] Retrieving image manifest localhost:33775/catsby/example-go-pull:dev │ INFO[0000] Retrieving image localhost:33775/catsby/example-go-pull:dev from regi │ stry localhost:33775 │ INFO[0000] Built cross stage deps: map[] │ INFO[0000] Retrieving image manifest localhost:33775/catsby/example-go-pull:dev │ INFO[0000] Returning cached image manifest │ INFO[0000] Executing 0 build triggers │ INFO[0000] Skipping unpacking as no commands require it. │ INFO[0000] Pushing image to localhost:45983/catsby/example-go-pull:latest │ INFO[0001] Pushed image to 1 destinations ✓ Image pull completed. ✓ Running push build v17 Created artifact v17 » Variables used: VARIABLE | VALUE | TYPE | SOURCE -------------------------+-----------------------------------------------+-----------+---------- pull_registry_password | 122bc444b708853582dafe3cda069461b2a2c6ebce9a9 | sensitive | file | d38aee531a98d6d3d03 | | pull_tag | dev | string | default push_image | catsby/example-go-pull | string | file push_registry_username | 890e8f907513987332a9679089def709997ac359a11e8 | sensitive | file | e378c0810e9eac12e16 | | push_tag | latest | string | default port | 3030 | int | default pull_image | catsby/example-go-pull | string | file pull_registry_username | 890e8f907513987332a9679089def709997ac359a11e8 | sensitive | file | e378c0810e9eac12e16 | | push_registry_password | 122bc444b708853582dafe3cda069461b2a2c6ebce9a9 | sensitive | file | d38aee531a98d6d3d03 | | ``` That command will pull the image tagged as `dev` from the registry used in the first `build` operation and push it to the prod registry with the `latest` tag. Specifically note that: - The output from Kaniko demonstrates simply pulling the image - the `SOURCE` for the `push_` and `pull_` variables are read from file - In `prod.wpvars` the `pull_` values should match the `push_` values from `dev.wpvars` ================================================ FILE: kubernetes/go-workspace-pull/go.mod ================================================ module github.com/hashicorp/waypoint-examples/kubernetes/go go 1.18 ================================================ FILE: kubernetes/go-workspace-pull/main.go ================================================ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 package main import ( "fmt" "log" "net/http" ) func main() { fileServer := http.FileServer(http.Dir("./static")) http.Handle("/", fileServer) fmt.Printf("Starting server at: http://localhost:3000\n") if err := http.ListenAndServe(":3000", nil); err != nil { log.Fatal(err) } } ================================================ FILE: kubernetes/go-workspace-pull/static/index.html ================================================ Waypoint Go Example
Icon

This static HTML app was deployed with Waypoint using Go.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: kubernetes/go-workspace-pull/static/static/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/static/images/pattern-tl.svg), url(/static/images/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } .language-image { width: 60px; height: 60px; } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: kubernetes/go-workspace-pull/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "go-k8s" app "go-k8s" { labels = { "service" = "go-k8s", "env" = { "default" = "dev" "production" = "latest" }[workspace.name] } build { // by default, build the Dockerfile use "docker" {} // in production, pull the latest "dev" image workspace "production" { use "docker-pull" { image = var.pull_image tag = var.pull_tag auth { username = var.pull_registry_username password = var.pull_registry_password } } } registry { use "docker" { image = var.push_image tag = var.push_tag auth { username = var.push_registry_username password = var.push_registry_password } } } } deploy { use "kubernetes" { probe_path = "/" service_port = 3000 annotations = labels } } release { use "kubernetes" { load_balancer = true port = 3000 } workspace "production" { use "kubernetes" { load_balancer = true port = 3030 } } } } // Variables for use when pushing images to a registry variable "push_image" { default = "catsby/example-go-pull" type = string description = "Image name for the built image to push to the Docker registry." } variable "push_tag" { default = { "default" = "dev" "production" = "latest" }[workspace.name] type = string description = "Tag to use when pushing the image to a registry" } variable "push_registry_username" { default = "catsby" type = string sensitive = true description = "username for container push registry" } variable "push_registry_password" { default = "nope" type = string sensitive = true description = "password for push registry" } // Variables for use when pulling an image from a registry variable "pull_image" { default = "catsby/example-go-pull" type = string description = "Image name to pull with docker-pull." } variable "pull_tag" { default = "dev" type = string description = "Tag to use when pulling an image with docker-pull" } variable "pull_registry_username" { default = "catsby" type = string sensitive = true description = "username for container pull registry" } variable "pull_registry_password" { default = "nope" type = string sensitive = true description = "password for pull registry" } // Miscellaneous variables variable "port" { type = number default = { "default" = 3000 "production" = 3030 }[workspace.name] description = "Port number exposed to the outside, e.g. localhost:3000" } runner { enabled = true data_source "git" { url = "https://github.com/hashicorp/waypoint-examples.git" path = "kubernetes/go-workspace-pull" } } ================================================ FILE: kubernetes/java/.gitignore ================================================ target/ .env .waypoint/ ### STS ### .apt_generated .classpath .factorypath .project .settings .springBeans .sts4-cache ### IntelliJ IDEA ### .idea *.iws *.iml *.ipr ### NetBeans ### /nbproject/private/ /nbbuild/ /dist/ /nbdist/ /.nb-gradle/ build/ !**/src/main/**/build/ !**/src/test/**/build/ ### VS Code ### .vscode/ ================================================ FILE: kubernetes/java/.mvn/wrapper/maven-wrapper.properties ================================================ distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip ================================================ FILE: kubernetes/java/README.md ================================================ # Java Getting Started |Title|Description| |---|---| |Pack|GCR| |Cloud|Multiple| |Language|Java| |Docs|[Kubernetes](https://www.waypointproject.io/plugins/kubernetes)| |Tutorial|[HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/get-started-docker)| This is an example Java Spring application that can be deployed with Waypoint. Waypoint defaults to using Heroku buildpacks if you do not specify a [builder variable](https://waypointproject.io/plugins/pack#builder) in the `waypoint.hcl` configuration section for `pack` within the `build` section. This example uses Heroku buildpacks by default. # Deploying the example application. 1. Install a Waypoint Server up and ensure `waypoint context verify` is successful. 1. `waypoint init` 1. `waypoint up` 1. Visit a URL provided in the `waypoint` output. ================================================ FILE: kubernetes/java/mvnw ================================================ #!/bin/sh # ---------------------------------------------------------------------------- # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # ---------------------------------------------------------------------------- # ---------------------------------------------------------------------------- # Maven2 Start Up Batch script # # Required ENV vars: # ------------------ # JAVA_HOME - location of a JDK home dir # # Optional ENV vars # ----------------- # M2_HOME - location of maven2's installed home dir # MAVEN_OPTS - parameters passed to the Java VM when running Maven # e.g. to debug Maven itself, use # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 # MAVEN_SKIP_RC - flag to disable loading of mavenrc files # ---------------------------------------------------------------------------- if [ -z "$MAVEN_SKIP_RC" ] ; then if [ -f /etc/mavenrc ] ; then . /etc/mavenrc fi if [ -f "$HOME/.mavenrc" ] ; then . "$HOME/.mavenrc" fi fi # OS specific support. $var _must_ be set to either true or false. cygwin=false; darwin=false; mingw=false case "`uname`" in CYGWIN*) cygwin=true ;; MINGW*) mingw=true;; Darwin*) darwin=true # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home # See https://developer.apple.com/library/mac/qa/qa1170/_index.html if [ -z "$JAVA_HOME" ]; then if [ -x "/usr/libexec/java_home" ]; then export JAVA_HOME="`/usr/libexec/java_home`" else export JAVA_HOME="/Library/Java/Home" fi fi ;; esac if [ -z "$JAVA_HOME" ] ; then if [ -r /etc/gentoo-release ] ; then JAVA_HOME=`java-config --jre-home` fi fi if [ -z "$M2_HOME" ] ; then ## resolve links - $0 may be a link to maven's home PRG="$0" # need this for relative symlinks while [ -h "$PRG" ] ; do ls=`ls -ld "$PRG"` link=`expr "$ls" : '.*-> \(.*\)$'` if expr "$link" : '/.*' > /dev/null; then PRG="$link" else PRG="`dirname "$PRG"`/$link" fi done saveddir=`pwd` M2_HOME=`dirname "$PRG"`/.. # make it fully qualified M2_HOME=`cd "$M2_HOME" && pwd` cd "$saveddir" # echo Using m2 at $M2_HOME fi # For Cygwin, ensure paths are in UNIX format before anything is touched if $cygwin ; then [ -n "$M2_HOME" ] && M2_HOME=`cygpath --unix "$M2_HOME"` [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"` fi # For Mingw, ensure paths are in UNIX format before anything is touched if $mingw ; then [ -n "$M2_HOME" ] && M2_HOME="`(cd "$M2_HOME"; pwd)`" [ -n "$JAVA_HOME" ] && JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" # TODO classpath? fi if [ -z "$JAVA_HOME" ]; then javaExecutable="`which javac`" if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then # readlink(1) is not available as standard on Solaris 10. readLink=`which readlink` if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then if $darwin ; then javaHome="`dirname \"$javaExecutable\"`" javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" else javaExecutable="`readlink -f \"$javaExecutable\"`" fi javaHome="`dirname \"$javaExecutable\"`" javaHome=`expr "$javaHome" : '\(.*\)/bin'` JAVA_HOME="$javaHome" export JAVA_HOME fi fi fi if [ -z "$JAVACMD" ] ; then if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables JAVACMD="$JAVA_HOME/jre/sh/java" else JAVACMD="$JAVA_HOME/bin/java" fi else JAVACMD="`which java`" fi fi if [ ! -x "$JAVACMD" ] ; then echo "Error: JAVA_HOME is not defined correctly." >&2 echo " We cannot execute $JAVACMD" >&2 exit 1 fi if [ -z "$JAVA_HOME" ] ; then echo "Warning: JAVA_HOME environment variable is not set." fi CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher # traverses directory structure from process work directory to filesystem root # first directory with .mvn subdirectory is considered project base directory find_maven_basedir() { if [ -z "$1" ] then echo "Path not specified to find_maven_basedir" return 1 fi basedir="$1" wdir="$1" while [ "$wdir" != '/' ] ; do if [ -d "$wdir"/.mvn ] ; then basedir=$wdir break fi # workaround for JBEAP-8937 (on Solaris 10/Sparc) if [ -d "${wdir}" ]; then wdir=`cd "$wdir/.."; pwd` fi # end of workaround done echo "${basedir}" } # concatenates all lines of a file concat_lines() { if [ -f "$1" ]; then echo "$(tr -s '\n' ' ' < "$1")" fi } BASE_DIR=`find_maven_basedir "$(pwd)"` if [ -z "$BASE_DIR" ]; then exit 1; fi export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} if [ "$MVNW_VERBOSE" = true ]; then echo $MAVEN_PROJECTBASEDIR fi MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" # For Cygwin, switch paths to Windows format before running java if $cygwin; then [ -n "$M2_HOME" ] && M2_HOME=`cygpath --path --windows "$M2_HOME"` [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --windows "$CLASSPATH"` [ -n "$MAVEN_PROJECTBASEDIR" ] && MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` fi WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain exec "$JAVACMD" \ $MAVEN_OPTS \ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" #!/bin/sh # ---------------------------------------------------------------------------- # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # ---------------------------------------------------------------------------- # ---------------------------------------------------------------------------- # Maven Start Up Batch script # # Required ENV vars: # ------------------ # JAVA_HOME - location of a JDK home dir # # Optional ENV vars # ----------------- # M2_HOME - location of maven2's installed home dir # MAVEN_OPTS - parameters passed to the Java VM when running Maven # e.g. to debug Maven itself, use # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 # MAVEN_SKIP_RC - flag to disable loading of mavenrc files # ---------------------------------------------------------------------------- if [ -z "$MAVEN_SKIP_RC" ] ; then if [ -f /etc/mavenrc ] ; then . /etc/mavenrc fi if [ -f "$HOME/.mavenrc" ] ; then . "$HOME/.mavenrc" fi fi # OS specific support. $var _must_ be set to either true or false. cygwin=false; darwin=false; mingw=false case "`uname`" in CYGWIN*) cygwin=true ;; MINGW*) mingw=true;; Darwin*) darwin=true # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home # See https://developer.apple.com/library/mac/qa/qa1170/_index.html if [ -z "$JAVA_HOME" ]; then if [ -x "/usr/libexec/java_home" ]; then export JAVA_HOME="`/usr/libexec/java_home`" else export JAVA_HOME="/Library/Java/Home" fi fi ;; esac if [ -z "$JAVA_HOME" ] ; then if [ -r /etc/gentoo-release ] ; then JAVA_HOME=`java-config --jre-home` fi fi if [ -z "$M2_HOME" ] ; then ## resolve links - $0 may be a link to maven's home PRG="$0" # need this for relative symlinks while [ -h "$PRG" ] ; do ls=`ls -ld "$PRG"` link=`expr "$ls" : '.*-> \(.*\)$'` if expr "$link" : '/.*' > /dev/null; then PRG="$link" else PRG="`dirname "$PRG"`/$link" fi done saveddir=`pwd` M2_HOME=`dirname "$PRG"`/.. # make it fully qualified M2_HOME=`cd "$M2_HOME" && pwd` cd "$saveddir" # echo Using m2 at $M2_HOME fi # For Cygwin, ensure paths are in UNIX format before anything is touched if $cygwin ; then [ -n "$M2_HOME" ] && M2_HOME=`cygpath --unix "$M2_HOME"` [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"` fi # For Mingw, ensure paths are in UNIX format before anything is touched if $mingw ; then [ -n "$M2_HOME" ] && M2_HOME="`(cd "$M2_HOME"; pwd)`" [ -n "$JAVA_HOME" ] && JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" fi if [ -z "$JAVA_HOME" ]; then javaExecutable="`which javac`" if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then # readlink(1) is not available as standard on Solaris 10. readLink=`which readlink` if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then if $darwin ; then javaHome="`dirname \"$javaExecutable\"`" javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" else javaExecutable="`readlink -f \"$javaExecutable\"`" fi javaHome="`dirname \"$javaExecutable\"`" javaHome=`expr "$javaHome" : '\(.*\)/bin'` JAVA_HOME="$javaHome" export JAVA_HOME fi fi fi if [ -z "$JAVACMD" ] ; then if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables JAVACMD="$JAVA_HOME/jre/sh/java" else JAVACMD="$JAVA_HOME/bin/java" fi else JAVACMD="`which java`" fi fi if [ ! -x "$JAVACMD" ] ; then echo "Error: JAVA_HOME is not defined correctly." >&2 echo " We cannot execute $JAVACMD" >&2 exit 1 fi if [ -z "$JAVA_HOME" ] ; then echo "Warning: JAVA_HOME environment variable is not set." fi CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher # traverses directory structure from process work directory to filesystem root # first directory with .mvn subdirectory is considered project base directory find_maven_basedir() { if [ -z "$1" ] then echo "Path not specified to find_maven_basedir" return 1 fi basedir="$1" wdir="$1" while [ "$wdir" != '/' ] ; do if [ -d "$wdir"/.mvn ] ; then basedir=$wdir break fi # workaround for JBEAP-8937 (on Solaris 10/Sparc) if [ -d "${wdir}" ]; then wdir=`cd "$wdir/.."; pwd` fi # end of workaround done echo "${basedir}" } # concatenates all lines of a file concat_lines() { if [ -f "$1" ]; then echo "$(tr -s '\n' ' ' < "$1")" fi } BASE_DIR=`find_maven_basedir "$(pwd)"` if [ -z "$BASE_DIR" ]; then exit 1; fi ########################################################################################## # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central # This allows using the maven wrapper in projects that prohibit checking in binary data. ########################################################################################## if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then if [ "$MVNW_VERBOSE" = true ]; then echo "Found .mvn/wrapper/maven-wrapper.jar" fi else if [ "$MVNW_VERBOSE" = true ]; then echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." fi if [ -n "$MVNW_REPOURL" ]; then jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" else jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" fi while IFS="=" read key value; do case "$key" in (wrapperUrl) jarUrl="$value"; break ;; esac done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" if [ "$MVNW_VERBOSE" = true ]; then echo "Downloading from: $jarUrl" fi wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" if $cygwin; then wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` fi if command -v wget > /dev/null; then if [ "$MVNW_VERBOSE" = true ]; then echo "Found wget ... using wget" fi if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then wget "$jarUrl" -O "$wrapperJarPath" else wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" fi elif command -v curl > /dev/null; then if [ "$MVNW_VERBOSE" = true ]; then echo "Found curl ... using curl" fi if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then curl -o "$wrapperJarPath" "$jarUrl" -f else curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f fi else if [ "$MVNW_VERBOSE" = true ]; then echo "Falling back to using Java to download" fi javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" # For Cygwin, switch paths to Windows format before running javac if $cygwin; then javaClass=`cygpath --path --windows "$javaClass"` fi if [ -e "$javaClass" ]; then if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then if [ "$MVNW_VERBOSE" = true ]; then echo " - Compiling MavenWrapperDownloader.java ..." fi # Compiling the Java class ("$JAVA_HOME/bin/javac" "$javaClass") fi if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then # Running the downloader if [ "$MVNW_VERBOSE" = true ]; then echo " - Running MavenWrapperDownloader.java ..." fi ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") fi fi fi fi ########################################################################################## # End of extension ########################################################################################## export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} if [ "$MVNW_VERBOSE" = true ]; then echo $MAVEN_PROJECTBASEDIR fi MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" # For Cygwin, switch paths to Windows format before running java if $cygwin; then [ -n "$M2_HOME" ] && M2_HOME=`cygpath --path --windows "$M2_HOME"` [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --windows "$CLASSPATH"` [ -n "$MAVEN_PROJECTBASEDIR" ] && MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` fi # Provide a "standardized" way to retrieve the CLI args that will # work with both Windows and non-Windows executions. MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" export MAVEN_CMD_LINE_ARGS WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain exec "$JAVACMD" \ $MAVEN_OPTS \ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" ================================================ FILE: kubernetes/java/mvnw.cmd ================================================ @REM ---------------------------------------------------------------------------- @REM Licensed to the Apache Software Foundation (ASF) under one @REM or more contributor license agreements. See the NOTICE file @REM distributed with this work for additional information @REM regarding copyright ownership. The ASF licenses this file @REM to you under the Apache License, Version 2.0 (the @REM "License"); you may not use this file except in compliance @REM with the License. You may obtain a copy of the License at @REM @REM https://www.apache.org/licenses/LICENSE-2.0 @REM @REM Unless required by applicable law or agreed to in writing, @REM software distributed under the License is distributed on an @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @REM KIND, either express or implied. See the License for the @REM specific language governing permissions and limitations @REM under the License. @REM ---------------------------------------------------------------------------- @REM ---------------------------------------------------------------------------- @REM Maven Start Up Batch script @REM @REM Required ENV vars: @REM JAVA_HOME - location of a JDK home dir @REM @REM Optional ENV vars @REM M2_HOME - location of maven2's installed home dir @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven @REM e.g. to debug Maven itself, use @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files @REM ---------------------------------------------------------------------------- @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' @echo off @REM set title of command window title %0 @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% @REM set %HOME% to equivalent of $HOME if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") @REM Execute a user defined script before this one if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre @REM check for pre script, once with legacy .bat ending and once with .cmd ending if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" :skipRcPre @setlocal set ERROR_CODE=0 @REM To isolate internal variables from possible post scripts, we use another setlocal @setlocal @REM ==== START VALIDATION ==== if not "%JAVA_HOME%" == "" goto OkJHome echo. echo Error: JAVA_HOME not found in your environment. >&2 echo Please set the JAVA_HOME variable in your environment to match the >&2 echo location of your Java installation. >&2 echo. goto error :OkJHome if exist "%JAVA_HOME%\bin\java.exe" goto init echo. echo Error: JAVA_HOME is set to an invalid directory. >&2 echo JAVA_HOME = "%JAVA_HOME%" >&2 echo Please set the JAVA_HOME variable in your environment to match the >&2 echo location of your Java installation. >&2 echo. goto error @REM ==== END VALIDATION ==== :init @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". @REM Fallback to current working directory if not found. set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir set EXEC_DIR=%CD% set WDIR=%EXEC_DIR% :findBaseDir IF EXIST "%WDIR%"\.mvn goto baseDirFound cd .. IF "%WDIR%"=="%CD%" goto baseDirNotFound set WDIR=%CD% goto findBaseDir :baseDirFound set MAVEN_PROJECTBASEDIR=%WDIR% cd "%EXEC_DIR%" goto endDetectBaseDir :baseDirNotFound set MAVEN_PROJECTBASEDIR=%EXEC_DIR% cd "%EXEC_DIR%" :endDetectBaseDir IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig @setlocal EnableExtensions EnableDelayedExpansion for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% :endReadAdditionalConfig SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B ) @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central @REM This allows using the maven wrapper in projects that prohibit checking in binary data. if exist %WRAPPER_JAR% ( if "%MVNW_VERBOSE%" == "true" ( echo Found %WRAPPER_JAR% ) ) else ( if not "%MVNW_REPOURL%" == "" ( SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" ) if "%MVNW_VERBOSE%" == "true" ( echo Couldn't find %WRAPPER_JAR%, downloading it ... echo Downloading from: %DOWNLOAD_URL% ) powershell -Command "&{"^ "$webclient = new-object System.Net.WebClient;"^ "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ "}"^ "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ "}" if "%MVNW_VERBOSE%" == "true" ( echo Finished downloading %WRAPPER_JAR% ) ) @REM End of extension @REM Provide a "standardized" way to retrieve the CLI args that will @REM work with both Windows and non-Windows executions. set MAVEN_CMD_LINE_ARGS=%* %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* if ERRORLEVEL 1 goto error goto end :error set ERROR_CODE=1 :end @endlocal & set ERROR_CODE=%ERROR_CODE% if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost @REM check for post script, once with legacy .bat ending and once with .cmd ending if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" :skipRcPost @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' if "%MAVEN_BATCH_PAUSE%" == "on" pause if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% exit /B %ERROR_CODE% ================================================ FILE: kubernetes/java/pom.xml ================================================ 4.0.0 org.springframework.boot spring-boot-starter-parent 2.3.4.RELEASE com.example waypoint 0.0.1-SNAPSHOT waypoint Demo project for Spring Boot 11 org.springframework.boot spring-boot-starter-actuator org.springframework.boot spring-boot-starter-thymeleaf org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-test test org.junit.vintage junit-vintage-engine org.springframework.boot spring-boot-maven-plugin ================================================ FILE: kubernetes/java/src/main/java/com/example/waypoint/WaypointApplication.java ================================================ /* * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ package com.example.waypoint; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller @SpringBootApplication public class WaypointApplication { public static void main(String[] args) { SpringApplication.run(WaypointApplication.class, args); } @RequestMapping("/") String index() { return "index"; } } ================================================ FILE: kubernetes/java/src/main/resources/application.properties ================================================ ================================================ FILE: kubernetes/java/src/main/resources/public/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/pattern-tl.svg), url(/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: kubernetes/java/src/main/resources/templates/fragments/layout.html ================================================ Waypoint Java Example
================================================ FILE: kubernetes/java/src/main/resources/templates/index.html ================================================
Java Icon

This Java app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: kubernetes/java/src/test/java/com/example/waypoint/WaypointApplicationTests.java ================================================ /* * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ package com.example.waypoint; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class WaypointApplicationTests { @Test void contextLoads() { } } ================================================ FILE: kubernetes/java/system.properties ================================================ java.runtime.version=11 ================================================ FILE: kubernetes/java/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "kubernetes-java" app "kubernetes-java-app" { build { use "pack" { builder="gcr.io/buildpacks/builder:v1" } registry { use "docker" { image = "kubernetes-java-app" tag = "1" local = true } } } deploy { use "kubernetes" { namespace = "default" probe_path = "/" service_port = 8080 } } release { use "kubernetes" { node_port = 32000 } } } ================================================ FILE: kubernetes/nodejs/README.md ================================================ # Waypoint Kubernetes Example |Title|Description| |---|---| |Pack|Cloud Native Buildpack| |Cloud|Any| |Language|NodeJS| |Docs|[Kubernetes](https://www.waypointproject.io/plugins/kubernetes)| |Tutorial|[HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/get-started-kubernetes)| Waypoint can deploy to a local Kubernetes server or a cloud-hosted cluster. See the tutorial for details. ================================================ FILE: kubernetes/nodejs/index.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ const express = require('express') const path = require('path') const PORT = process.env.PORT || 5000 express() .use(express.static(path.join(__dirname, 'public'))) .set('views', path.join(__dirname, 'views')) .set('view engine', 'ejs') .get('/', (req, res) => res.render('pages/index')) .listen(PORT, () => console.log(`Listening on ${ PORT }`)) ================================================ FILE: kubernetes/nodejs/package.json ================================================ { "name": "node-js-getting-started", "version": "0.3.0", "description": "A sample Node.js app using Express 4", "engines": { "node": "12.x" }, "main": "index.js", "scripts": { "start": "node index.js", "test": "node test.js" }, "dependencies": { "ejs": "^2.5.6", "express": "^4.15.2" }, "devDependencies": { "got": "^11.3.0", "tape": "^4.7.0" }, "keywords": [ "node", "express" ], "license": "MIT" } ================================================ FILE: kubernetes/nodejs/public/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/pattern-tl.svg), url(/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: kubernetes/nodejs/views/pages/index.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> <% include ../partials/header.ejs %>
Node.js Icon

This Node.js app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: kubernetes/nodejs/views/partials/header.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> Waypoint Node.js Example ================================================ FILE: kubernetes/nodejs/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "kubernetes-nodejs" app "kubernetes-nodejs-web" { labels = { "service" = "kubernetes-nodejs-web", "env" = "dev" } build { use "pack" {} registry { use "docker" { image = "kubernetes-nodejs-web" tag = "1" local = true } } } deploy { use "kubernetes" { probe_path = "/" } } release { use "kubernetes" { // Sets up a load balancer to access released application load_balancer = true port = 3000 } } } ================================================ FILE: kubernetes/nodejs-apply/README.md ================================================ # Waypoint Kubernetes Example (using `kubernetes-apply`) |Title|Description| |---|---| |Pack|Cloud Native Buildpack| |Cloud|Any| |Language|NodeJS| |Docs|[Kubernetes](https://www.waypointproject.io/plugins/kubernetes)| This example shows how to deploy an application built with buildpacks to Kubernetes using templated Kubernetes YAML files. This would also work with JSON or Jsonnet files. ================================================ FILE: kubernetes/nodejs-apply/index.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ const express = require('express') const path = require('path') const PORT = process.env.PORT || 5000 express() .use(express.static(path.join(__dirname, 'public'))) .set('views', path.join(__dirname, 'views')) .set('view engine', 'ejs') .get('/', (req, res) => res.render('pages/index')) .listen(PORT, () => console.log(`Listening on ${ PORT }`)) ================================================ FILE: kubernetes/nodejs-apply/k8s/deployment.yaml ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 apiVersion: apps/v1 kind: Deployment metadata: name: my-deployment labels: app: myapp spec: replicas: 1 selector: matchLabels: app: myapp template: metadata: labels: app: myapp spec: containers: - name: myapp image: ${artifact.image}:${artifact.tag} env: %{ for k,v in entrypoint.env } - name: ${k} value: "${v}" %{ endfor } # Ensure we set PORT for the URL service. This is only necessary # if we want the URL service to function. - name: PORT value: "3000" ================================================ FILE: kubernetes/nodejs-apply/package.json ================================================ { "name": "node-js-getting-started", "version": "0.3.0", "description": "A sample Node.js app using Express 4", "engines": { "node": "12.x" }, "main": "index.js", "scripts": { "start": "node index.js", "test": "node test.js" }, "dependencies": { "ejs": "^2.5.6", "express": "^4.15.2" }, "devDependencies": { "got": "^11.3.0", "tape": "^4.7.0" }, "keywords": [ "node", "express" ], "license": "MIT" } ================================================ FILE: kubernetes/nodejs-apply/public/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/pattern-tl.svg), url(/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: kubernetes/nodejs-apply/views/pages/index.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> <% include ../partials/header.ejs %>
Node.js Icon

This Node.js app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: kubernetes/nodejs-apply/views/partials/header.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> Waypoint Node.js Example ================================================ FILE: kubernetes/nodejs-apply/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "kubernetes-apply-nodejs" app "apply-nodejs-web" { labels = { "service" = "apply-nodejs-web", "env" = "dev" } build { use "pack" {} registry { use "docker" { image = "apply-nodejs-web" tag = "1" local = true } } } deploy { use "kubernetes-apply" { // Template the directory so that we process each file in the directory // as a template. This lets us inject the artifact from the previous step. path = templatedir("${path.app}/k8s") // This label determines what resources we own. Any that aren't present // in our folder that match this label will be deleted. prune_label = "app=myapp" } } } ================================================ FILE: kubernetes/nodejs-helm/README.md ================================================ # Waypoint Kubernetes Example (using Helm) |Title|Description| |---|---| |Pack|Cloud Native Buildpack| |Cloud|Any| |Language|NodeJS| |Docs|[Kubernetes](https://www.waypointproject.io/plugins/kubernetes)| This example shows how to deploy an application built with buildpacks to Kubernetes using a local Helm chart. ================================================ FILE: kubernetes/nodejs-helm/helm/.helmignore ================================================ # Patterns to ignore when building packages. # This supports shell glob matching, relative path matching, and # negation (prefixed with !). Only one pattern per line. .DS_Store # Common VCS dirs .git/ .gitignore .bzr/ .bzrignore .hg/ .hgignore .svn/ # Common backup files *.swp *.bak *.tmp *.orig *~ # Various IDEs .project .idea/ *.tmproj .vscode/ ================================================ FILE: kubernetes/nodejs-helm/helm/Chart.yaml ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 apiVersion: v2 name: waypoint-nodejs description: Helm chart example for Waypoint type: application version: 0.1.0 appVersion: "1.0.0" ================================================ FILE: kubernetes/nodejs-helm/helm/templates/NOTES.txt ================================================ Hello! ================================================ FILE: kubernetes/nodejs-helm/helm/templates/_helpers.tpl ================================================ {{/* Expand the name of the chart. */}} {{- define "app.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). If release name contains chart name it will be used as a full name. */}} {{- define "app.fullname" -}} {{- if .Values.fullnameOverride }} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} {{- else }} {{- $name := default .Chart.Name .Values.nameOverride }} {{- if contains $name .Release.Name }} {{- .Release.Name | trunc 63 | trimSuffix "-" }} {{- else }} {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} {{- end }} {{- end }} {{- end }} {{/* Create chart name and version as used by the chart label. */}} {{- define "app.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Common labels */}} {{- define "app.labels" -}} helm.sh/chart: {{ include "app.chart" . }} {{ include "app.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} app.kubernetes.io/managed-by: {{ .Release.Service }} {{- end }} {{/* Selector labels */}} {{- define "app.selectorLabels" -}} app.kubernetes.io/name: {{ include "app.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} {{/* Create the name of the service account to use */}} {{- define "app.serviceAccountName" -}} {{- if .Values.serviceAccount.create }} {{- default (include "app.fullname" .) .Values.serviceAccount.name }} {{- else }} {{- default "default" .Values.serviceAccount.name }} {{- end }} {{- end }} ================================================ FILE: kubernetes/nodejs-helm/helm/templates/deployment.yaml ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "app.fullname" . }} labels: {{- include "app.labels" . | nindent 4 }} spec: replicas: 1 selector: matchLabels: {{- include "app.selectorLabels" . | nindent 6 }} template: metadata: labels: {{- include "app.selectorLabels" . | nindent 8 }} spec: {{- with .Values.image.pullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} containers: - name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - name: http containerPort: 3000 protocol: TCP env: - name: PORT value: "3000" {{- with .Values.env }} {{- toYaml . | nindent 12 }} {{- end }} resources: {{- toYaml .Values.resources | nindent 12 }} ================================================ FILE: kubernetes/nodejs-helm/helm/templates/service.yaml ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 apiVersion: v1 kind: Service metadata: name: {{ include "app.fullname" . }} labels: {{- include "app.labels" . | nindent 4 }} spec: type: LoadBalancer ports: - port: 80 targetPort: http protocol: TCP name: http selector: {{- include "app.selectorLabels" . | nindent 4 }} ================================================ FILE: kubernetes/nodejs-helm/helm/values.yaml ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 image: repository: "" tag: "" pullPolicy: IfNotPresent pullSecrets: null env: null resources: {} # We usually recommend not to specify default resources and to leave this as a conscious # choice for the user. This also increases chances charts run on environments with little # resources, such as Minikube. If you do want to specify resources, uncomment the following # lines, adjust them as necessary, and remove the curly braces after 'resources:'. # limits: # cpu: 100m # memory: 128Mi # requests: # cpu: 100m # memory: 128Mi ================================================ FILE: kubernetes/nodejs-helm/index.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ const express = require('express') const path = require('path') const PORT = process.env.PORT || 5000 express() .use(express.static(path.join(__dirname, 'public'))) .set('views', path.join(__dirname, 'views')) .set('view engine', 'ejs') .get('/', (req, res) => res.render('pages/index')) .listen(PORT, () => console.log(`Listening on ${ PORT }`)) ================================================ FILE: kubernetes/nodejs-helm/package.json ================================================ { "name": "node-js-getting-started", "version": "0.3.0", "description": "A sample Node.js app using Express 4", "engines": { "node": "12.x" }, "main": "index.js", "scripts": { "start": "node index.js", "test": "node test.js" }, "dependencies": { "ejs": "^2.5.6", "express": "^4.15.2" }, "devDependencies": { "got": "^11.3.0", "tape": "^4.7.0" }, "keywords": [ "node", "express" ], "license": "MIT" } ================================================ FILE: kubernetes/nodejs-helm/public/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/pattern-tl.svg), url(/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: kubernetes/nodejs-helm/values.yaml.tpl ================================================ env: %{ for k,v in entrypoint.env ~} - name: ${k} value: "${v}" %{ endfor ~} ================================================ FILE: kubernetes/nodejs-helm/views/pages/index.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> <% include ../partials/header.ejs %>
Node.js Icon

This Node.js app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: kubernetes/nodejs-helm/views/partials/header.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> Waypoint Node.js Example ================================================ FILE: kubernetes/nodejs-helm/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "kubernetes-nodejs-helm" app "nodejs-helm-web" { labels = { "service" = "nodejs-helm-web", "env" = "dev" } build { use "pack" {} registry { use "docker" { image = "nodejs-helm-web" tag = gitrefpretty() local = true } } } deploy { use "helm" { name = app.name chart = "${path.app}/helm" // We use a values file so we can set the entrypoint environment // variables into a rich YAML structure. This is easier than --set values = [ file(templatefile("${path.app}/values.yaml.tpl")), ] set { name = "image.repository" value = artifact.image } set { name = "image.tag" value = artifact.tag } } } } ================================================ FILE: kubernetes/nodejs-ingress/README.md ================================================ # Waypoint Kubernetes Example using Ingress for Release |Title|Description| |---|---| |Pack|Cloud Native Buildpack| |Cloud|Any| |Language|NodeJS| |Docs|[Kubernetes](https://www.waypointproject.io/plugins/kubernetes)| |Tutorial|[HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/get-started-kubernetes)| Waypoint can deploy to a local Kubernetes server or a cloud-hosted cluster. See the tutorial for details. ## Prerequisites Your kubernetes cluster must have an ingress controller already running. We recommend using the (NGINX ingress controller](https://kubernetes.github.io/ingress-nginx/). ================================================ FILE: kubernetes/nodejs-ingress/index.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ const express = require('express') const path = require('path') const PORT = process.env.PORT || 5000 express() .use(express.static(path.join(__dirname, 'public'))) .set('views', path.join(__dirname, 'views')) .set('view engine', 'ejs') .get('/', (req, res) => res.render('pages/index')) .listen(PORT, () => console.log(`Listening on ${ PORT }`)) ================================================ FILE: kubernetes/nodejs-ingress/package.json ================================================ { "name": "node-js-getting-started", "version": "0.3.0", "description": "A sample Node.js app using Express 4", "engines": { "node": "12.x" }, "main": "index.js", "scripts": { "start": "node index.js", "test": "node test.js" }, "dependencies": { "ejs": "^2.5.6", "express": "^4.15.2" }, "devDependencies": { "got": "^11.3.0", "tape": "^4.7.0" }, "keywords": [ "node", "express" ], "license": "MIT" } ================================================ FILE: kubernetes/nodejs-ingress/public/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/pattern-tl.svg), url(/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: kubernetes/nodejs-ingress/views/pages/index.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> <% include ../partials/header.ejs %>
Node.js Icon

This Node.js app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: kubernetes/nodejs-ingress/views/partials/header.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> Waypoint Node.js Example ================================================ FILE: kubernetes/nodejs-ingress/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "kubernetes-nodejs-ingress" app "nodejs-ingress-app" { labels = { "service" = "nodejs-ingress-app", "env" = "dev" } build { use "pack" {} registry { use "docker" { image = "nodejs-ingress-app" tag = "1" local = true } } } deploy { use "kubernetes" { probe_path = "/" } } release { use "kubernetes" { ingress "http" { path_type = "Prefix" path = "/" } } } } ================================================ FILE: kubernetes/nodejs-ingress-sidecar/README.md ================================================ # Waypoint Kubernetes Ingress Proxy Example using Sidecar |Title|Description| |---|---| |Pack|Cloud Native Buildpack| |Cloud|Any| |Language|NodeJS| |Docs|[Kubernetes](https://www.waypointproject.io/plugins/kubernetes)| |Tutorial|[HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/get-started-kubernetes)| This example shows ingress to an app being proxied by an Nginx sidecar container. ## Config Nginx config is stored in Vault, and is delivered by the CEB to a shared memory volume at container startup, and the Nginx container entrypoint override moves it to `/etc/nginx` before starting Nginx itself. ## Prerequisites You must have Vault running and Waypoint configured matching to use the [Vault config sourcer](https://www.waypointproject.io/plugins/vault). 1. Start a simple local Vault cluster with token auth, run `vault server -dev -dev-listen-address=` * This address must be accessible by the pods in your Kubernetes cluster. 2. Configure the Vault config sourcer on Waypoint by running: `waypoint config source-set -type=vault -config=addr= -config=token=`. 3. Add the 'nginx.conf' secret to Vault at the same path as inside the `configdynamic` block in 'waypoint.hcl': `cat nginx.conf | VAULT_ADDR= VAULT_TOKEN= vault kv put /secret/apps/sample-app nginx.conf=-` ================================================ FILE: kubernetes/nodejs-ingress-sidecar/index.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ const express = require('express') const path = require('path') const PORT = process.env.PORT || 5000 express() .use(express.static(path.join(__dirname, 'public'))) .set('views', path.join(__dirname, 'views')) .set('view engine', 'ejs') .get('/', (req, res) => res.render('pages/index')) .listen(PORT, () => console.log(`Listening on ${ PORT }`)) ================================================ FILE: kubernetes/nodejs-ingress-sidecar/nginx.conf ================================================ worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; location / { proxy_pass http://localhost:8080/; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } } } ================================================ FILE: kubernetes/nodejs-ingress-sidecar/package.json ================================================ { "name": "node-js-getting-started", "version": "0.3.0", "description": "A sample Node.js app using Express 4", "engines": { "node": "12.x" }, "main": "index.js", "scripts": { "start": "node index.js", "test": "node test.js" }, "dependencies": { "ejs": "^2.5.6", "express": "^4.15.2" }, "devDependencies": { "got": "^11.3.0", "tape": "^4.7.0" }, "keywords": [ "node", "express" ], "license": "MIT" } ================================================ FILE: kubernetes/nodejs-ingress-sidecar/views/pages/index.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> <% include ../partials/header.ejs %>
Node.js Icon

This Node.js app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: kubernetes/nodejs-ingress-sidecar/views/partials/header.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> Waypoint Node.js Example ================================================ FILE: kubernetes/nodejs-ingress-sidecar/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "kubernetes-nodejs-ingress" app "nodejs-ingress-sidecar" { labels = { "service" = "nodejs-ingress-sidecar", "env" = "dev" } build { use "pack" {} registry { use "docker" { image = "nodejs-ingress-sidecar" tag = "1" local = true } } } config { file = { "/shared-config/nginx.conf" = configdynamic("vault", { path = "secret/data/apps/sample-app" key = "data/nginx.conf" }) } } deploy { use "kubernetes" { namespace = "default" probe_path = "/" scratch_path = ["/shared-config"] service_port = 8080 pod { sidecar { image = "nginx:1.21.1" container { name = "nginx" port { name = "http" port = 80 } command = ["/bin/sh"] args = ["-c", "until [ -f /shared-config/nginx.conf ]; do sleep 1; echo 'waiting for waypoint app container to inject config at /shared-config/nginx.conf...'; done; cp /shared-config/nginx.conf /etc/nginx/nginx.conf; nginx -g 'daemon off;'"] } } } } } release { use "kubernetes" { port = 443 } } } ================================================ FILE: kubernetes/nodejs-local-registry/README.md ================================================ # Waypoint Kubernetes Example |Title|Description| |---|---| |Pack|Cloud Native Buildpack| |Cloud|Any| |Language|NodeJS| |Docs|[Kubernetes](https://www.waypointproject.io/plugins/kubernetes)| |Tutorial|[HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/get-started-kubernetes)| Waypoint can deploy to a local Kubernetes server or a cloud-hosted cluster. See the tutorial for details. ================================================ FILE: kubernetes/nodejs-local-registry/index.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ const express = require('express') const path = require('path') const PORT = process.env.PORT || 5000 express() .use(express.static(path.join(__dirname, 'public'))) .set('views', path.join(__dirname, 'views')) .set('view engine', 'ejs') .get('/', (req, res) => res.render('pages/index')) .listen(PORT, () => console.log(`Listening on ${ PORT }`)) ================================================ FILE: kubernetes/nodejs-local-registry/package.json ================================================ { "name": "node-js-getting-started", "version": "0.3.0", "description": "A sample Node.js app using Express 4", "engines": { "node": "12.x" }, "main": "index.js", "scripts": { "start": "node index.js", "test": "node test.js" }, "dependencies": { "ejs": "^2.5.6", "express": "^4.15.2" }, "devDependencies": { "got": "^11.3.0", "tape": "^4.7.0" }, "keywords": [ "node", "express" ], "license": "MIT" } ================================================ FILE: kubernetes/nodejs-local-registry/public/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/pattern-tl.svg), url(/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: kubernetes/nodejs-local-registry/views/pages/index.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> <% include ../partials/header.ejs %>
Node.js Icon

This Node.js app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: kubernetes/nodejs-local-registry/views/partials/header.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> Waypoint Node.js Example ================================================ FILE: kubernetes/nodejs-local-registry/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "kubernetes-nodejs-local" app "nodejs-local-app" { labels = { "service" = "nodejs-local-app", "env" = "dev" } build { use "pack" {} registry { use "docker" { image = "localhost:5000/nodejs-local-app" tag = "1" local = false } } } deploy { use "kubernetes" { probe_path = "/" } } release { use "kubernetes" { // Sets up a load balancer to access released application load_balancer = true port = 3000 } } } ================================================ FILE: kubernetes/nodejs-metrics-sidecar/README.md ================================================ # Waypoint Kubernetes Sidecar Local Proxy Example |Title|Description| |---|---| |Pack|Cloud Native Buildpack| |Cloud|Any| |Language|NodeJS| |Docs|[Kubernetes](https://www.waypointproject.io/plugins/kubernetes)| |Tutorial|[HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/get-started-kubernetes)| This is an example of an app with a Telegraf sidecar that listens for StatsD metrics on port 8125 and prints them. ================================================ FILE: kubernetes/nodejs-metrics-sidecar/index.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ const express = require('express') const path = require('path') const PORT = process.env.PORT || 5000 express() .use(express.static(path.join(__dirname, 'public'))) .set('views', path.join(__dirname, 'views')) .set('view engine', 'ejs') .get('/', (req, res) => res.render('pages/index')) .listen(PORT, () => console.log(`Listening on ${ PORT }`)) ================================================ FILE: kubernetes/nodejs-metrics-sidecar/package.json ================================================ { "name": "node-js-getting-started", "version": "0.3.0", "description": "A sample Node.js app using Express 4", "engines": { "node": "12.x" }, "main": "index.js", "scripts": { "start": "node index.js", "test": "node test.js" }, "dependencies": { "ejs": "^2.5.6", "express": "^4.15.2" }, "devDependencies": { "got": "^11.3.0", "tape": "^4.7.0" }, "keywords": [ "node", "express" ], "license": "MIT" } ================================================ FILE: kubernetes/nodejs-metrics-sidecar/public/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/pattern-tl.svg), url(/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: kubernetes/nodejs-metrics-sidecar/telegraf.conf ================================================ [global_tags] platform = "waypoint" [[outputs.health]] service_address = "http://:8127" [[outputs.file]] files = ["stdout"] data_format = "influx" [[inputs.statsd]] protocol = "udp" service_address = ":8125" [[inputs.statsd]] protocol = "tcp" service_address = ":8126" ================================================ FILE: kubernetes/nodejs-metrics-sidecar/views/pages/index.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> <% include ../partials/header.ejs %>
Node.js Icon

This Node.js app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: kubernetes/nodejs-metrics-sidecar/views/partials/header.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> Waypoint Node.js Example ================================================ FILE: kubernetes/nodejs-metrics-sidecar/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "kubernetes-nodejs-metrics-sidecar" app "nodejs-metrics-sidecar" { labels = { "service" = "nodejs-metrics-sidecar", "env" = "dev" } build { use "pack" {} registry { use "docker" { image = "nodejs-metrics-sidecar" tag = "1" local = true } } } deploy { use "kubernetes" { namespace = "default" probe_path = "/" scratch_path = ["/shared-config"] service_port = 8080 pod { sidecar { image = "telegraf:1.19.3" container { name = "telegraf" port { name = "health" port = 8127 } port { name = "statsd-tcp" port = 8126 } port { name = "statsd-udp" port = 8125 } probe_path = "/health" command = ["/bin/sh"] args = ["-c", "echo $TELEGRAF_CONF | base64 --decode > /opt/telegraf.conf; telegraf --config /opt/telegraf.conf"] static_environment = { "TELEGRAF_CONF" : filebase64("${path.app}/telegraf.conf") } } } } } } release { use "kubernetes" { port = 443 } } } ================================================ FILE: learn/dynamic-application-configuration/README.md ================================================ # Waypoint Go Example | Title | Description | | -------- |-----------------------------------------------------------------------------------------------------------------------------| | Pack | Cloud Native Buildpack | | Cloud | Nomad | | Language | Go | | Docs | [Docker](https://www.waypointproject.io/plugins/docker) | | Tutorial | [HashiCorp Waypoint Use Case](https://developer.hashicorp.com/waypoint/docs/use-cases/dynamic-config-vault-dynamic-secrets) | A minimal Go HTTP server, which connects to a Postgres database, and informs the client if it has done so successfully. The Waypoint configuration makes use of Waypoint's [dynamic configuration](https://developer.hashicorp.com/waypoint/docs/app-config/dynamic) feature. The [HashiCorp Vault config sourcer plugin](https://developer.hashicorp.com/waypoint/plugins/vault) is used to retrieve a dynamic credential for the Postgres database from a database secret engine mount in Vault. ## Pre-requisites ### Nomad cluster You should have a Nomad cluster up and running to which your Waypoint runner can connect to deploy the Nomad job. ### Vault cluster A Vault cluster is required, and must be reachable from containers running in your Nomad cluster. It is also assumed that there is a database secrets engine mount, with a connection configured for a Postgres database. There should also be a role, named `readonly`. ### Postgres Database The Nomad job file, `postgres.nomad.hcl`, in this path is a quick, _development_ environment jobspec to get Postgres up and running. It is not intended for production use, but can optionally be the database that the server connects to, and from which Vault sources dynamic credentials. ================================================ FILE: learn/dynamic-application-configuration/go.mod ================================================ module github.com/hashicorp/waypoint-examples/learn/dynamic-application-configuration go 1.19 require github.com/lib/pq v1.10.7 ================================================ FILE: learn/dynamic-application-configuration/go.sum ================================================ github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= ================================================ FILE: learn/dynamic-application-configuration/main.go ================================================ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 package main import ( "database/sql" "fmt" "log" "net/http" "os" "strconv" _ "github.com/lib/pq" ) func main() { http.HandleFunc("/", connect) err := http.ListenAndServe(":80", nil) if err != nil { return } } func connect(w http.ResponseWriter, r *http.Request) { type conn struct { user string password string port int host string dbname string } port, err := strconv.Atoi(os.Getenv("PORT")) if err != nil { log.Fatal(err) } connection := conn{ user: os.Getenv("USERNAME"), password: os.Getenv("PASSWORD"), port: port, host: os.Getenv("HOST"), dbname: os.Getenv("DBNAME"), } psqlInfo := fmt.Sprintf("host=%s port=%d user=%s "+ "password=%s dbname=%s sslmode=disable", connection.host, connection.port, connection.user, connection.password, connection.dbname) db, err := sql.Open("postgres", psqlInfo) if err != nil { panic(err) } defer db.Close() err = db.Ping() if err != nil { log.Fatal(err) } fmt.Print("Hello, database! Connected to " + connection.host) log.Println("Successfully connected to the database! :)") } ================================================ FILE: learn/dynamic-application-configuration/postgres.nomad.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 job "postgres" { region = "global" datacenters = ["dc1"] group "postgres" { network { port "postgres" { static = 5432 to = 5432 } } task "postgres" { driver = "docker" config { image = "postgres" ports = ["postgres"] } env { POSTGRES_USER = "postgres" POSTGRES_PASSWORD = "root" } } // end of task } // end of group } // end of job ================================================ FILE: learn/dynamic-application-configuration/readonly.sql ================================================ -- Copyright (c) HashiCorp, Inc. -- SPDX-License-Identifier: MPL-2.0 CREATE ROLE "{{name}}" WITH LOGIN PASSWORD '{{password}}' VALID UNTIL '{{expiration}}' INHERIT; GRANT ro TO "{{name}}"; ================================================ FILE: learn/dynamic-application-configuration/waypoint-policy.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 path "database/creds/readonly" { capabilities = ["read"] } ================================================ FILE: learn/dynamic-application-configuration/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "learn-dynamic-go" app "dynamic-go" { labels = { "service" = "dynamic-go", } config { env = { "USERNAME" = dynamic("vault", { path = "database/creds/readonly" key = "username" }) "PASSWORD" = dynamic("vault", { path = "database/creds/readonly" key = "password" }) HOST = var.postgres_ip PORT = var.postgres_port DBNAME = var.postgres_dbname } } build { use "pack" {} registry { use "docker" { image = var.image_name tag = var.image_tag auth { username = var.registry_username password = var.registry_password } } } } deploy { use "nomad" { service_port = 80 } } } variable "postgres_ip" { type = string } variable "postgres_port" { type = number } variable "postgres_dbname" { type = string default = "postgres" } variable "image_name" { type = string } variable "image_tag" { type = string } variable "registry_username" { type = string sensitive = true } variable "registry_password" { type = string sensitive = true } ================================================ FILE: learn/input-variables/README.md ================================================ # Waypoint Go Example | Title | Description | | -------- | ------------------------------------------------------------------------------------ | | Pack | Cloud Native Buildpack | | Cloud | Local | | Language | Go | | Docs | [Docker](https://www.waypointproject.io/plugins/docker) | | Tutorial | [HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/get-started-docker) | A barebones Go API, which can easily be deployed by Waypoint. This example includes usage of Waypoint's [input variables](https://waypointproject.io/docs/waypoint-hcl/variables/input). ================================================ FILE: learn/input-variables/go.mod ================================================ module github.com/hashicorp/waypoint-examples/docker/go // +heroku goVersion go1.15 go 1.15 ================================================ FILE: learn/input-variables/go.sum ================================================ github.com/corona10/goimagehash v1.0.2/go.mod h1:/l9umBhvcHQXVtQO1V6Gp1yD20STawkhRnnX0D1bvVI= github.com/fogleman/gg v1.3.0 h1:/7zJX8F6AaYQc57WQCyN9cAIz+4bCJGO9B+dyW29am8= github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/goccy/go-graphviz v0.0.6 h1:sCT69fmH2KKsObVfsozYyKXxrqmIfo3SyHZs72xkgxs= github.com/goccy/go-graphviz v0.0.6/go.mod h1:wXVsXxmyMQU6TN3zGRttjNn3h+iCAS7xQFC6TlNvLhk= github.com/goccy/go-graphviz v0.0.9 h1:s/FMMJ1Joj6La3S5ApO3Jk2cwM4LpXECC2muFx3IPQQ= github.com/goccy/go-graphviz v0.0.9/go.mod h1:wXVsXxmyMQU6TN3zGRttjNn3h+iCAS7xQFC6TlNvLhk= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= github.com/ofabry/go-callvis v0.6.1 h1:JSVl4QdS5+997C38Bu0lMPXOs5NLOoKaY32sgKcgdUI= github.com/ofabry/go-callvis v0.6.1/go.mod h1:0rRJ5J4UM3gOuKEWcoSng8RJmDUGJCJRAd+nY+zT2KE= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 h1:49lOXmGaUpV9Fz3gd7TFZY106KVlPVa5jcYD1gaQf98= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200204104054-c9f3fb736b72/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/image v0.0.0-20200119044424-58c23975cae1 h1:5h3ngYt7+vXCDZCup/HkCQgW5XwmSvR/nA2JmJ0RErg= golang.org/x/image v0.0.0-20200119044424-58c23975cae1/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.0.0-20201208152932-35266b937fa6 h1:nfeHNc1nAqecKCy2FCy4HY+soOOe5sDLJ/gZLbx6GYI= golang.org/x/image v0.0.0-20201208152932-35266b937fa6/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1 h1:Kvvh58BN8Y9/lBi7hTekvtMpm07eUZ0ck5pRHpsMWrY= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 h1:myAQVi0cGEoqQVR5POX+8RR2mrocKqNN1hmeMqhX27k= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c h1:VwygUrnw9jn88c4u8GD3rZQbqrP/tgas88tPUbBxQrk= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200305224536-de023d59a5d1 h1:A6Mu2vcvuNXbBiGKuVHG74fmEPmzsZ5dzG0WhV2GcqI= golang.org/x/tools v0.0.0-20200305224536-de023d59a5d1/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= golang.org/x/tools v0.1.0 h1:po9/4sTYwZU9lPhi1tOrb4hCv3qrhiQ77LZfGa2OjwY= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= ================================================ FILE: learn/input-variables/main.go ================================================ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 package main import ( "fmt" "log" "net/http" ) func main() { fileServer := http.FileServer(http.Dir("./static")) http.Handle("/", fileServer) fmt.Printf("Starting server at: http://localhost:3000\n") if err := http.ListenAndServe(":3000", nil); err != nil { log.Fatal(err) } } ================================================ FILE: learn/input-variables/static/index.html ================================================ Waypoint Go Example
Icon

This static HTML app was deployed with Waypoint using Go.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: learn/input-variables/static/static/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/static/images/pattern-tl.svg), url(/static/images/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } .language-image { width: 60px; height: 60px; } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: learn/input-variables/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "learn/inputvars-go" app "inputvars-go-app" { labels = { "service" = "inputvars-go-app", "env" = "dev" } build { use "pack" {} registry { use "docker" { image = var.image tag = var.tag local = true } } } deploy { use "docker" {} } } variable "image" { default = "waypoint-test/learn-inputvars-go" type = string description = "Image name for the built image in the Docker registry." } variable "tag" { default = "latest" type = string description = "The tab for the built image in the Docker registry." } ================================================ FILE: learn/static-application-configuration/README.md ================================================ # Static Waypoint Configuration Demo Follow along at [HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/static-application-configuration). | Title | Description | | -------- | -------------------------------------------------------------------------------------------------- | | Pack | Cloud Native Buildpack | | Cloud | Local | | Language | Go | | Docs | [Docker](https://www.waypointproject.io/plugins/docker) | | Tutorial | [HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/static-application-configuration) | ================================================ FILE: learn/static-application-configuration/go.mod ================================================ module github.com/hashicorp/waypoint-examples/learn/static-application-configuration // +heroku goVersion go1.15 go 1.15 ================================================ FILE: learn/static-application-configuration/main.go ================================================ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 package main import ( "fmt" "log" "net/http" "os" ) func main() { http.HandleFunc("/", saleViewHandler) fmt.Printf("Starting server at: http://localhost:3000\n") if err := http.ListenAndServe(":3000", nil); err != nil { log.Fatal(err) } } func saleViewHandler(w http.ResponseWriter, r *http.Request) { salePercent := os.Getenv("SALE_PERCENT") saleEndsOn := os.Getenv("SALE_ENDS_ON") fmt.Fprintf(w, `

Today’s Sale

Save %s!
Until %s
`, salePercent, saleEndsOn) } ================================================ FILE: learn/static-application-configuration/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "learn-static-go" app "static-go" { labels = { "service" = "static-go", "env" = "dev" } config { env = { SALE_PERCENT = "50%" } } build { use "pack" {} } deploy { use "docker" {} } } ================================================ FILE: nomad/nodejs/README.md ================================================ # Waypoint Nomad Example |Title|Description| |---|---| |Pack|Cloud Native Buildpack| |Cloud|Any| |Language|NodeJS| |Docs|[Nomad](https://www.waypointproject.io/plugins/nomad)| |Tutorial|[HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/get-started-nomad)| Waypoint can run against a full Nomad cluster or a local development agent. Visit the tutorial for the details. ================================================ FILE: nomad/nodejs/index.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ const express = require('express') const path = require('path') const PORT = process.env.PORT || 5000 express() .use(express.static(path.join(__dirname, 'public'))) .set('views', path.join(__dirname, 'views')) .set('view engine', 'ejs') .get('/', (req, res) => res.render('pages/index')) .listen(PORT, () => console.log(`Listening on ${ PORT }`)) ================================================ FILE: nomad/nodejs/package.json ================================================ { "name": "node-js-getting-started", "version": "0.3.0", "description": "A sample Node.js app using Express 4", "engines": { "node": "12.x" }, "main": "index.js", "scripts": { "start": "node index.js", "test": "node test.js" }, "dependencies": { "ejs": "^2.5.6", "express": "^4.15.2" }, "devDependencies": { "got": "^11.3.0", "tape": "^4.7.0" }, "keywords": [ "node", "express" ], "license": "MIT" } ================================================ FILE: nomad/nodejs/public/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/pattern-tl.svg), url(/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: nomad/nodejs/views/pages/index.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> <% include ../partials/header.ejs %>
Node.js Icon

This Node.js app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: nomad/nodejs/views/partials/header.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> Waypoint Node.js Example ================================================ FILE: nomad/nodejs/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "nomad-nodejs" app "nomad-nodejs-web" { build { use "pack" {} registry { use "docker" { image = "nomad-nodejs-web" tag = "1" local = true } } } deploy { use "nomad" { // these options both default to the values shown, but are left here to // show they are configurable datacenter = "dc1" namespace = "default" } } } ================================================ FILE: nomad/nodejs-jobspec/README.md ================================================ # Waypoint Nomad Example |Title|Description| |---|---| |Pack|Cloud Native Buildpack| |Cloud|Any| |Language|NodeJS| |Docs|[Nomad](https://www.waypointproject.io/plugins/nomad)| |Tutorial|[HashiCorp Learn](https://learn.hashicorp.com/tutorials/waypoint/get-started-nomad)| Waypoint can run against a full Nomad cluster or a local development agent. Visit the tutorial for the details. ================================================ FILE: nomad/nodejs-jobspec/app.nomad.tpl ================================================ job "web" { datacenters = ["dc1"] group "app" { update { max_parallel = 1 canary = 1 auto_revert = true auto_promote = false health_check = "task_states" } task "app" { driver = "docker" config { image = "${artifact.image}:${artifact.tag}" } env { %{ for k,v in entrypoint.env ~} ${k} = "${v}" %{ endfor ~} // For URL service PORT = "3000" } } } } ================================================ FILE: nomad/nodejs-jobspec/index.js ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ const express = require('express') const path = require('path') const PORT = process.env.PORT || 5000 express() .use(express.static(path.join(__dirname, 'public'))) .set('views', path.join(__dirname, 'views')) .set('view engine', 'ejs') .get('/', (req, res) => res.render('pages/index')) .listen(PORT, () => console.log(`Listening on ${ PORT }`)) ================================================ FILE: nomad/nodejs-jobspec/package.json ================================================ { "name": "node-js-getting-started", "version": "0.3.0", "description": "A sample Node.js app using Express 4", "engines": { "node": "12.x" }, "main": "index.js", "scripts": { "start": "node index.js", "test": "node test.js" }, "dependencies": { "ejs": "^2.5.6", "express": "^4.15.2" }, "devDependencies": { "got": "^11.3.0", "tape": "^4.7.0" }, "keywords": [ "node", "express" ], "license": "MIT" } ================================================ FILE: nomad/nodejs-jobspec/public/stylesheets/main.css ================================================ /** * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ :root { --text: #E4E5E7; --background: #000; --brand: 4, 198, 194; --headline: #FFF; } * { margin: 0; padding: 0; } html, body { min-height: 100vh; } body { font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif; font-size: 15px; line-height: 24px; color: var(--text); text-align: center; background-image: url(/pattern-tl.svg), url(/pattern-br.svg); background-position: top left, bottom right; background-repeat: no-repeat; background-color: var(--background); } .container { display: flex; flex-direction: column; min-height: calc(100vh - 80px - 60px); padding: 80px 60px 60px; } section { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 60px 0; } section .language-icon { display: flex; align-items: center; justify-content: center; width: 80px; height: 80px; border-radius: 100%; border: 1px solid rgba(var(--brand), .5); background: rgba(var(--brand), .15); } section h1 { color: var(--headline); font-size: 18px; font-weight: 600; padding: 40px 0 8px; } section p { padding-top: 12px; } section code { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; padding: 4px 6px; margin: 0 2px; border-radius: 3px; background: rgba(255, 255, 255, .15); } section a { color: rgb(var(--brand)); } ================================================ FILE: nomad/nodejs-jobspec/views/pages/index.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> <% include ../partials/header.ejs %>
Node.js Icon

This Node.js app was deployed with Waypoint.

Try making a change to this text locally and run waypoint up again to see it.

Read the documentation for more about Waypoint.

================================================ FILE: nomad/nodejs-jobspec/views/partials/header.ejs ================================================ <%/* Copyright (c) HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0 */%> Waypoint Node.js Example ================================================ FILE: nomad/nodejs-jobspec/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "nomad-jobspec-nodejs" app "nodejs-jobspec-web" { build { use "pack" {} registry { use "docker" { image = "nodejs-jobspec-web" tag = "1" local = true } } } deploy { use "nomad-jobspec" { // Templated to perhaps bring in the artifact from a previous // build/registry, entrypoint env vars, etc. jobspec = templatefile("${path.app}/app.nomad.tpl") } } release { use "nomad-jobspec-canary" { groups = [ "app" ] fail_deployment = false } } } ================================================ FILE: terraform/variables/.gitignore ================================================ # Local .terraform directories terraform/tfc/.terraform/* # .tfstate files *.tfstate *.tfstate.* # Crash log files crash.log crash.*.log # Exclude all .tfvars files, which are likely to contain sensitive data, such as # password, private keys, and other secrets. These should not be part of version # control as they are data points which are potentially sensitive and subject # to change depending on the environment. *.tfvars *.tfvars.json # Ignore override files as they are usually used to override resources locally and so # are not checked in override.tf override.tf.json *_override.tf *_override.tf.json # Include override files you do wish to add to version control using negated pattern # !example_override.tf # Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan # example: *tfplan* # Ignore CLI configuration files .terraformrc terraform.rc ================================================ FILE: terraform/variables/Dockerfile ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 FROM nginx:stable ================================================ FILE: terraform/variables/README.md ================================================ # Terraform Variables Example |Title| Description | |---|--------------------------------------------------------------------------------------| |Pack| Docker | |Cloud| Local | |Language| n/a | |Docs| [Terraform Cloud](https://developer.hashicorp.com/waypoint/plugins/terraform-cloud) | This example demonstrates sourcing output variables from Terraform Cloud for use in a Waypoint config. For example, it's possible to create resources like AWS VPCs, AWS/ECS clusters, and subnets in Terraform, define them as Terraform outputs, and then reference them directly in a Waypoint config. This example is intended to be a minimalist demonstration of referencing Terraform outputs, not a full real-world use-case. It creates static Terraform output variables of various types (string, list, and map), and then references them in local Docker deployment config. ## Terraform Setup ### Org and Workspace Creation First, we'll need a Terraform Cloud workspace. If you don't have one already, you can create one using the Terraform found in `terraform/tfc`. If you already have a Terraform org and workspace, skip ahead to the next section. This module requires three inputs: - A TFC API token. Follow [this guide](https://developer.hashicorp.com/terraform/cloud-docs/users-teams-organizations/api-tokens) to obtain a TFC api token. - A TFC organization name. This is arbitrary, but needs to be globally unique. - An email address to use as your TFC org admin contact address. Run Terraform to create the TFC org and workspace. You'll be prompted for the above inputs ```shell $ cd ./terraform/tfc $ terraform init ... $ terraform apply ... Apply complete! Resources: 2 added, 0 changed, 0 destroyed. ``` ### Generating Terraform Outputs In `terraform/main`, we have the minimal possible Terraform to generate ouputs. This is meant to simulate real Terraform that might be creating and AWS VPC, and outputting things like VPC IDs and subnet arns. You'll need the following inputs: - An org ID and workspace ID. These cannot be referenced as variables, so you'll need to modify `./terraform/main/main.tf`. Use the organization name chosen in the previous step, or set this to your own organization ID if desired. ```hcl terraform { cloud { organization = "waypoint_tfc_vars_example" // <- you must change this workspaces { name = "waypoint_tfc_vars_example" } } } ``` Run the Terraform to produce the outputs: ```shell $ cd ./terraform/main $ terraform init ... $ terraform apply ... Apply complete! Resources: 0 added, 0 changed, 0 destroyed. Outputs: list_of_strings = [ "item_1", "item_2", "item_3", ] map_of_strings = { "key1" = "value1" "key2" = "value2" } simple_string = "justastring" ``` ## Waypoint setup #### Waypoint CLI Install the Waypoint CLI. See [installation instructions](https://developer.hashicorp.com/waypoint/tutorials/get-started-docker/get-started-install). #### Waypoint Server You'll need a Waypoint server. We recommend using [HCP Waypoint](https://cloud.hashicorp.com/products/waypoint) You'll also need your CLI configured with a [context](https://developer.hashicorp.com/waypoint/commands/context-create) pointing to this server. #### Waypoint remote runner Waypoint remote runners are required to use variables with dynamic defaults. HCP Waypoint will walk you through installing a remote runner into your infrastructure. If you don't have a runner already, you can run `waypoint runner agent` in a separate terminal window. This runner will have access to Docker on your laptop, which is where we'll be deploying. #### Waypoint Terraform Configsourcer Config Waypoint needs to know how to talk to Terraform Cloud at runtime to source the outputs. To accomplish this, run: ```shell waypoint config source-set -type=terraform-cloud -config=token= ``` #### Customize the waypoint.hcl Take a look at the waypoint.hcl. In each variable stanza, you'll need to update the Terraform organization to match the one your chose during the Terraform setup Example ```hcl variable "single_string_output" { default = dynamic("terraform-cloud", { organization = "waypoint_tfc_vars_example" // REPLACE WITH YOUR ORG ID workspace = "waypoint_tfc_vars_example" output = "simple_string" }) type = string sensitive = false description = "Just one tfc output variable with a string type" } ``` You'll need to commit those changes, and then push to a repository you control. We recommend forking the waypoint-examples repo and modifying your fork. The changes need to be pushed for the remote runner to recognize them. #### Waypoint Project Create your Waypoint project, pointed to your git repo. You'll need to update the git url to point to your fork ```shell $ waypoint project apply \ -data-source="git" \ -git-ref=main \ -git-url="https://github.com//waypoint-examples" \ # <-- YOUR FORK HERE -git-path=terraform/variables \ waypoint_tfc_vars_example ✓ Project "waypoint_tfc_vars_example" created ``` ## Running the deployment Run `waypoint up` to build and deploy a Docker container. If you're running a runner locally using `waypoint runner agent` (and you have no other runners), add `-local=false` to force remote execution on that runner. ```shell $ waypoint up -local=false ... The deploy was successful! ``` ## Inspecting the variable usage The variables were used to configure the Docker container. Use `docker inspect` to find the deployed container: ```shell $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 589d62b07137 waypoint.local/waypoint_tfc_vars_example:latest "/waypoint-entrypoin…" 2 hours ago Up 2 hours 80/tcp, 0.0.0.0:62584->3000/tcp waypoint_tfc_vars_example-01GMZXBPN9R187QFGRGNEN288W ``` And then inspect to see the TFC configvars. Only the environment and labels contain TFC config. ```shell $ docker inspect 589d62b07137 | jq '.[0].Config | with_entries(select([.key] | inside(["Env", "Labels"])))' { "Env": [ "tfc_output_key1=tfc_output_value1", "tfc_output_key2=tfc_output_value2", ... ], "Labels": { "list_item": "tfc_output_item_2", "simple_string": "tfc_output_string", ... } } ``` Notice that the TFC variables have been injected into the Docker deployment config! ================================================ FILE: terraform/variables/terraform/main/main.tf ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 terraform { cloud { organization = "waypoint_tfc_vars_example" // you must change this workspaces { name = "waypoint_tfc_vars_example" } } } ================================================ FILE: terraform/variables/terraform/main/outputs.tf ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 output "simple_string" { description = "a simple string output" value = "tfc_output_string" } output "map_of_strings" { description = "a map of strings" value = { "tfc_output_key1" = "tfc_output_value1", "tfc_output_key2" = "tfc_output_value2" } } output "list_of_strings" { description = "a map of strings" value = [ "tfc_output_item_1", "tfc_output_item_2", "tfc_output_item_3" ] } ================================================ FILE: terraform/variables/terraform/tfc/.terraform.lock.hcl ================================================ # This file is maintained automatically by "terraform init". # Manual edits may be lost in future updates. provider "registry.terraform.io/hashicorp/tfe" { version = "0.40.0" constraints = "~> 0.40.0" hashes = [ "h1:3rh7nopioN/eS3/iM6rEmkQBtKPrf5zDTpbJm1xM+gg=", "zh:0584e2e0ee0794d1b47bcf9502f370a39363043c4fe87ff00ceba49d4c18db9b", "zh:1b3586feb1b9327121fa935a9c1d7680004ade14de3ed8362c683f5838ec6c0f", "zh:53b64ef590836edef3a6f7396e51652fb56ab735986cc2334847dea85e527b78", "zh:70ec39ad78298fcc3ac7dc24a0a56b5847897382c61bc3bcf6bb3f5c863d40aa", "zh:75f0c277acc90e348fe0c36c8bc6b1143182177d0ff6fa3626aec169151eca60", "zh:8792e8baa9daa5bb22b68a2a00c0403505a7e941785a93bbd2cecd1de56d43fe", "zh:9ece3439983bae1dcb6ea080010bc66d9ffc2d55fd2d9505fc3a88d42ddce51e", "zh:a37c2476cd58a1b00232cf5dbb2760f8c458bc937f449cdd9b24d55a37a8e7b7", "zh:ba8389074d37c66d37296d905b3aaf348db5a6bce372842d75925b957dcb5129", "zh:bc8d88671807793e4cb651d681ff67b5cb7622912dc47a71e38181bc93bfec7b", "zh:d95ec293fa70e946b6cd657912b33155f8be3413e6128ed2bfa5a493f788e439", "zh:ef8c816590ab34557487ff1408ff1a9bc40d1db11af994695255939a94343795", ] } ================================================ FILE: terraform/variables/terraform/tfc/main.tf ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 terraform { required_providers { tfe = { version = "~> 0.40.0" } } } provider "tfe" { token = var.tfc_token } resource "tfe_organization" "tfe_organization" { name = var.tfc_org_name email = var.tfc_email } resource "tfe_workspace" "waypoint_tfc_vars_example" { name = "waypoint_tfc_vars_example" organization = tfe_organization.tfe_organization.name } ================================================ FILE: terraform/variables/terraform/tfc/variables.tf ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 variable "tfc_org_name" { description = "Name of your desired tfc org. Must be unique." type = string } variable "tfc_token" { description = "The token used to authenticate with Terraform Cloud." type = string sensitive = true } variable "tfc_email" { description = "TFC admin email address." type = string } ================================================ FILE: terraform/variables/waypoint.hcl ================================================ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 project = "waypoint_tfc_vars_example" app "waypoint_tfc_vars_example" { build { use "docker" { } } deploy { use "docker" { labels = { // `simple_string_output` matches the terraform output `simple_string` "simple_string" = var.single_string_output // `single_list_output` matches the terraform output `list_of_strings`. // Note that the output is a list type in terraform, and can also be // treated as a list here in the waypoint hcl. "list_item" = var.single_list_output[1] } // This shows referencing one variable after reading in all terraform outputs. // the waypoint variable is `all_outputs`, and the tfc output name is `map_of_strings` // (see ./terraform/main/outputs.tf). // Also note that the expected type for `static_environment` is also a map of strings, // so we can use the whole variable here. With this setting, the container will have // environment variables for each k/v pair in `map_of_strings`. static_environment = var.all_outputs.map_of_strings } } } # Waypoint can read string-type terraform outputs, and make them available as # a string variable. This is the simplest way of reading from terraform. variable "single_string_output" { default = dynamic("terraform-cloud", { organization = "waypoint_tfc_vars_example" // replace this with your org id workspace = "waypoint_tfc_vars_example" output = "simple_string" }) type = string sensitive = false description = "Just one tfc output variable with a string type" } # Waypoint can also read terraform outputs with complex types that can be represented # as json. This can be useful for reading, for example, a complete list of subnets, rather # than needing to redeclare each subnet as its own individual string output in terraform. variable "single_list_output" { default = dynamic("terraform-cloud", { organization = "waypoint_tfc_vars_example" // replace this with your org id workspace = "waypoint_tfc_vars_example" output = "list_of_strings" }) type = list(string) sensitive = false description = "One tfc output, but with a type of list" } # If many variables need to be read from terraform cloud, they can all be made available # as a map, where the keys are the output names. This avoids many near-duplicate # variable stanzas. variable "all_outputs" { default = dynamic("terraform-cloud", { organization = "waypoint_tfc_vars_example" // replace this with your org id workspace = "waypoint_tfc_vars_example" // output omitted - will get all outputs }) type = any sensitive = false description = "all workspace outputs. Will be a map, with keys as the output names" }