diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 41911e0688..36cada6ffe 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -9,17 +9,45 @@ + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + - @@ -297,14 +325,7 @@ - - - - 1606397373274 - 1606405347805 @@ -642,7 +663,14 @@ - diff --git a/.meta/guides.toml b/.meta/guides.toml index 500ffde9cc..b147855f81 100644 --- a/.meta/guides.toml +++ b/.meta/guides.toml @@ -2,12 +2,12 @@ title = "Getting Started" series = true description = """\ -Take Qovery from zero to production in under 10 minutes.\ +Take Qovery from zero to production in less than 10 minutes.\ """ [guides.advanced] title = "Advanced" -series = false +series = true description = """\ Go beyond the basics, become a Qovery pro, and extract the full potential of Qovery.\ """ diff --git a/.meta/links.toml b/.meta/links.toml index 35d8fba01c..662fcc9546 100644 --- a/.meta/links.toml +++ b/.meta/links.toml @@ -231,6 +231,7 @@ musl_builder_docker_image = "https://github.com/qovery/documentation/blob/master new_bug_report = "https://github.com/qovery/documentation/issues/new?labels=type%3A+bug" new_feature_request = "https://github.com/qovery/documentation/issues/new?labels=type%3A+new+feature" new_relic = "https://newrelic.com/" +sentry = "https://sentry.io/" new_relic_log_api = "https://docs.newrelic.com/docs/logs/new-relic-logs/log-api/introduction-log-api" new_security_report = "https://github.com/qovery/documentation/issues/new?labels=domain%3A+security" new_sink = "https://github.com/qovery/documentation/issues/new?labels=type%3A+new+feature" diff --git a/scripts/generate/templates/_partials/_qovery_summary.md.erb b/scripts/generate/templates/_partials/_qovery_summary.md.erb index cde8e6ee2b..09123b8762 100644 --- a/scripts/generate/templates/_partials/_qovery_summary.md.erb +++ b/scripts/generate/templates/_partials/_qovery_summary.md.erb @@ -5,9 +5,10 @@ your applications in the Cloud. > Qovery is the simplest way to deploy your full-stack apps in the Cloud -Qovery is an excellent solution for: -- **Developer**: to stay focused on building the best product. -- **DevOps**: to spend time on tasks that matter, building production and future-proof cloud infrastructure. +Qovery is a product for: +- **Developer**: to deploy their apps while staying focused on building the best product. +- **DevOps**: to build future-proof production cloud infrastructure. +- **Product Manager**: to deliver new features faster. - **CTO**: to accelerate their go-to-market, reduce their cloud cost, keep their team productive as it grows.

diff --git a/website/docs/getting-started/what-is-qovery.md b/website/docs/getting-started/what-is-qovery.md index 853d6bad2e..192fe3f0cc 100644 --- a/website/docs/getting-started/what-is-qovery.md +++ b/website/docs/getting-started/what-is-qovery.md @@ -14,9 +14,10 @@ your applications in the Cloud. > Qovery is the simplest way to deploy your full-stack apps in the Cloud -Qovery is an excellent solution for: -- **Developer**: to stay focused on building the best product. -- **DevOps**: to spend time on tasks that matter, building production and future-proof cloud infrastructure. +Qovery is a product for: +- **Developer**: to deploy their apps while staying focused on building the best product. +- **DevOps**: to build future-proof production cloud infrastructure. +- **Product Manager**: to deliver new features faster. - **CTO**: to accelerate their go-to-market, reduce their cloud cost, keep their team productive as it grows.

diff --git a/website/docs/using-qovery/configuration.md b/website/docs/using-qovery/configuration.md index 8d8eef8609..6342404f42 100644 --- a/website/docs/using-qovery/configuration.md +++ b/website/docs/using-qovery/configuration.md @@ -1,5 +1,5 @@ --- -last_modified_on: "2021-06-20" +last_modified_on: "2021-06-24" title: Configuration description: "Everything you need to know to configure and deploy your applications on Qovery" sidebar_label: hidden @@ -20,7 +20,6 @@ In the following subsections, you'll learn all you need to know to configure and External service Organization Project -Routing Secret Storage diff --git a/website/docs/using-qovery/configuration/application.md b/website/docs/using-qovery/configuration/application.md index f78cafdbd6..0e49d68799 100644 --- a/website/docs/using-qovery/configuration/application.md +++ b/website/docs/using-qovery/configuration/application.md @@ -1,5 +1,5 @@ --- -last_modified_on: "2021-06-19" +last_modified_on: "2021-06-24" title: "Application" description: "Learn how to configure your Application on Qovery" --- @@ -179,8 +179,6 @@ routers: - / ``` -*See what is a [router][docs.using-qovery.configuration.routing] to go further.* - You also need to indicate on which port your application is running. **Option 1** @@ -252,5 +250,4 @@ The `depends_on` property, guarantee that your app will never start before other [docs.using-qovery.configuration.project]: /docs/using-qovery/configuration/project/ -[docs.using-qovery.configuration.routing]: /docs/using-qovery/configuration/routing/ [urls.qovery_roadmap]: https://roadmap.qovery.com/ diff --git a/website/docs/using-qovery/configuration/application.md.erb b/website/docs/using-qovery/configuration/application.md.erb index 228cc1c623..6efe300130 100644 --- a/website/docs/using-qovery/configuration/application.md.erb +++ b/website/docs/using-qovery/configuration/application.md.erb @@ -170,8 +170,6 @@ routers: - / ``` -*See what is a [router][docs.using-qovery.configuration.routing] to go further.* - You also need to indicate on which port your application is running. **Option 1** diff --git a/website/docs/using-qovery/configuration/environment-variable.md b/website/docs/using-qovery/configuration/environment-variable.md index 9425e2551c..729596e529 100644 --- a/website/docs/using-qovery/configuration/environment-variable.md +++ b/website/docs/using-qovery/configuration/environment-variable.md @@ -28,7 +28,7 @@ Environment Variables are not directly connected to [Environment][docs.using-qov -Do you need to keep secure your environment variable? Use [secret][docs.using-qovery.configuration.secret]. +Do you need to keep secure your environment variable? Use [Secret][docs.using-qovery.configuration.secret] instead of *Environment Variable*. diff --git a/website/docs/using-qovery/configuration/environment-variable.md.erb b/website/docs/using-qovery/configuration/environment-variable.md.erb index 1dd073be82..93b777536c 100644 --- a/website/docs/using-qovery/configuration/environment-variable.md.erb +++ b/website/docs/using-qovery/configuration/environment-variable.md.erb @@ -16,7 +16,7 @@ Environment Variables are not directly connected to [Environment][docs.using-qov -Do you need to keep secure your environment variable? Use [secret][docs.using-qovery.configuration.secret]. +Do you need to keep secure your environment variable? Use [Secret][docs.using-qovery.configuration.secret] instead of *Environment Variable*. diff --git a/website/docs/using-qovery/configuration/routing.md b/website/docs/using-qovery/configuration/routing.md deleted file mode 100644 index bbed2cce30..0000000000 --- a/website/docs/using-qovery/configuration/routing.md +++ /dev/null @@ -1,161 +0,0 @@ ---- -last_modified_on: "2021-06-19" -title: Routing -description: "Learn how to configure your custom routes on Qovery" ---- - -import Alert from '@site/src/components/Alert'; - -Qovery allows you to define the routes used in your [environments][docs.environment]. - -A route describes how an incoming HTTP request is going to be processed by Qovery. The routes are defined using .qovery.yml file in your application repository. - - - -## Concepts - -### Router -Qovery has the concept of "[router][docs.routing]" which is where the traffic transit from the World and your application. -Each application that needs to be accessible from outside - needs to be attached to at least one router. - -An application can be attached to 0 to n routers. It's up to you and depends on your use case. - -A router is defined by: -* a name (must be unique through the project) -* 0 to n custom domains -* 1 to n routes - -Here is a configuration example of a router: - -```yaml title=".qovery.yml" {6-15} -application: - name: my-app-1 - project: my-project - publicly_accessible: true - port: 8080 -routers: -- name: main - custom_domains: - - branch: master - domain: my.tld.com - routes: - - application_name: my-app-1 - paths: - - / -``` - -### Route -A "[route][docs.routing]" is a concept to connect a "router" to an application. An application can have 0 to n routes. - -A route is defined by: -* a path -* an application name - -Here is a configuration example of a route: - -```yaml title=".qovery.yml" {11-15} -application: - name: my-app-1 - project: my-project - publicly_accessible: true - port: 8080 -routers: -- name: main - custom_domains: - - branch: master - domain: my.tld.com - routes: - - application_name: my-app-1 - paths: - - / -``` - -### Multiple routes -As explained above, each router can have multiple routes targeting different applications. -**Each application can use the same router by using the same router name within the same project.** - -Here is an example with two applications, which each of them have their own `.qovery.yml` file. - -```yaml title="Application 1 - .qovery.yml" -application: - name: my-app-1 - project: my-project - publicly_accessible: true - port: 8080 -routers: -- name: main - custom_domains: - - branch: master - domain: my.tld.com - routes: - - application_name: my-app-1 - paths: - - / -``` - -```yaml title="Application 2 - .qovery.yml" -application: - name: my-app-2 - project: my-project - publicly_accessible: true - port: 8080 -routers: -- name: main - custom_domains: - - branch: master - domain: my.tld.com - routes: - - application_name: my-app-2 - paths: - - /app2/ -``` - -Behind the scene Qovery will merge the two .qovery.yml into a single one. Which gives a router that will look like this: - -```yaml title="Merged router" {8-13} -... -routers: -- name: main - custom_domains: - - branch: master - domain: my.tld.com - routes: - - application_name: my-app-1 - paths: - - / - - application_name: my-app-2 - paths: - - /app2/ -``` - -Meaning, traffic with a route starting with the URL `https://my.tld.com/app2` is routed on `my-app-2`, and the remaining traffic is routed on `my-app-1`. - - - -Qovery takes care of duplicated routes and deny the latest created one to avoid unintended overrides. - - - -### Custom domains -A custom domain can be attached (optional) to a "router" and an [environment][docs.environment]. Then, multiple application can benefit from the same domain. - - - -Every router on Qovery automatically gets a free `qovery.io` address which does not change per branch. - - - -## Example - -[Check out our guide][guides.custom-routes] to see an example - - -[docs.environment]: /docs/using-qovery/configuration/environment/ -[docs.routing]: /docs/using-qovery/configuration/routing/ -[guides.custom-routes]: /guides/advanced/custom-routes/ diff --git a/website/docs/using-qovery/configuration/routing.md.erb b/website/docs/using-qovery/configuration/routing.md.erb deleted file mode 100644 index 9220ecc42f..0000000000 --- a/website/docs/using-qovery/configuration/routing.md.erb +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Routing -description: "Learn how to configure your custom routes on Qovery" ---- -<%= qovery_routing_intro() %> - -## Concepts - -<%= qovery_routing_concepts() %> - -## Example - -[Check out our guide][guides.custom-routes] to see an example diff --git a/website/guides/advanced/amazon-web-services.md b/website/guides/advanced/amazon-web-services.md new file mode 100644 index 0000000000..3574c74498 --- /dev/null +++ b/website/guides/advanced/amazon-web-services.md @@ -0,0 +1,20 @@ +--- +last_modified_on: "2021-06-24" +$schema: "/.meta/.schemas/guides.json" +title: Deploy your apps on your AWS account +description: How to deploy your apps on your Amazon Web Services (AWS) account with Qovery +author_github: https://github.com/evoxmusic +tags: ["type: guide"] +--- +import Steps from '@site/src/components/Steps'; +import Assumptions from '@site/src/components/Assumptions'; +import Alert from '@site/src/components/Alert'; + + + +This guide is coming soon + + + + + diff --git a/website/guides/advanced/amazon-web-services.md.erb b/website/guides/advanced/amazon-web-services.md.erb new file mode 100644 index 0000000000..22c9d6363e --- /dev/null +++ b/website/guides/advanced/amazon-web-services.md.erb @@ -0,0 +1,18 @@ +--- +$schema: "/.meta/.schemas/guides.json" +title: Deploy your apps on your AWS account +description: How to deploy your apps on your Amazon Web Services (AWS) account with Qovery +author_github: https://github.com/evoxmusic +tags: ["type: guide"] +--- +import Steps from '@site/src/components/Steps'; +import Assumptions from '@site/src/components/Assumptions'; +import Alert from '@site/src/components/Alert'; + + + +This guide is coming soon + + + +<%= subpages() %> diff --git a/website/guides/advanced/custom-routes.md b/website/guides/advanced/custom-routes.md deleted file mode 100644 index 83eab9de29..0000000000 --- a/website/guides/advanced/custom-routes.md +++ /dev/null @@ -1,264 +0,0 @@ ---- -last_modified_on: "2021-06-19" -$schema: "/.meta/.schemas/guides.json" -title: Custom routes -description: How to set up custom routes in your project -author_github: https://github.com/evoxmusic -tags: ["type: guide"] ---- -import SVG from 'react-inlinesvg'; -import Steps from '@site/src/components/Steps'; -import Assumptions from '@site/src/components/Assumptions'; -import Alert from '@site/src/components/Alert'; - -Qovery allows you to define the routes used in your [environments][docs.environment]. - -A route describes how an incoming HTTP request is going to be processed by Qovery. The routes are defined using .qovery.yml file in your application repository. - - - -No network knowledge is required to create your custom routes - - - - - -* You have installed the [Qovery CLI][guides.deploy-your-first-application] -* You need to deploy more than one application (e.g backend and frontend) - - - - - -## FAQ -Before digging deeper into this guide, I would explain why you should not or why you should use it. - -### Why you should use it -* You need to expose your application publicly through HTTPS -* You need to have one endpoint (foo.com) targeting multiple backend applications - -### Why you should not use it -* You only have one application within your [environment][docs.environment] -* You are not sure why you should use it ([ask us][urls.qovery_chat]) - -## Concepts - -### Router -Qovery has the concept of "[router][docs.routing]" which is where the traffic transit from the World and your application. -Each application that needs to be accessible from outside - needs to be attached to at least one router. - -An application can be attached to 0 to n routers. It's up to you and depends on your use case. - -A router is defined by: -* a name (must be unique through the project) -* 0 to n custom domains -* 1 to n routes - -Here is a configuration example of a router: - -```yaml title=".qovery.yml" {6-15} -application: - name: my-app-1 - project: my-project - publicly_accessible: true - port: 8080 -routers: -- name: main - custom_domains: - - branch: master - domain: my.tld.com - routes: - - application_name: my-app-1 - paths: - - / -``` - -### Route -A "[route][docs.routing]" is a concept to connect a "router" to an application. An application can have 0 to n routes. - -A route is defined by: -* a path -* an application name - -Here is a configuration example of a route: - -```yaml title=".qovery.yml" {11-15} -application: - name: my-app-1 - project: my-project - publicly_accessible: true - port: 8080 -routers: -- name: main - custom_domains: - - branch: master - domain: my.tld.com - routes: - - application_name: my-app-1 - paths: - - / -``` - -### Multiple routes -As explained above, each router can have multiple routes targeting different applications. -**Each application can use the same router by using the same router name within the same project.** - -Here is an example with two applications, which each of them have their own `.qovery.yml` file. - -```yaml title="Application 1 - .qovery.yml" -application: - name: my-app-1 - project: my-project - publicly_accessible: true - port: 8080 -routers: -- name: main - custom_domains: - - branch: master - domain: my.tld.com - routes: - - application_name: my-app-1 - paths: - - / -``` - -```yaml title="Application 2 - .qovery.yml" -application: - name: my-app-2 - project: my-project - publicly_accessible: true - port: 8080 -routers: -- name: main - custom_domains: - - branch: master - domain: my.tld.com - routes: - - application_name: my-app-2 - paths: - - /app2/ -``` - -Behind the scene Qovery will merge the two .qovery.yml into a single one. Which gives a router that will look like this: - -```yaml title="Merged router" {8-13} -... -routers: -- name: main - custom_domains: - - branch: master - domain: my.tld.com - routes: - - application_name: my-app-1 - paths: - - / - - application_name: my-app-2 - paths: - - /app2/ -``` - -Meaning, traffic with a route starting with the URL `https://my.tld.com/app2` is routed on `my-app-2`, and the remaining traffic is routed on `my-app-1`. - - - -Qovery takes care of duplicated routes and deny the latest created one to avoid unintended overrides. - - - -### Custom domains -A custom domain can be attached (optional) to a "router" and an [environment][docs.environment]. Then, multiple application can benefit from the same domain. - - - -Every router on Qovery automatically gets a free `qovery.io` address which does not change per branch. - - - -# Example -Here is a concrete example to show how custom routes could be your best friend in a real-world application. - -## The e-commerce website -Let's imagine that we have to build an e-commerce website which gives the possibility to order shoes. This website must be able to take orders and provide an invoice for each order. Our system has one web interface, one order service, and one billing service that is for each of them an independent application. - -What do we want? -* The **web interface** must be available through **shopping.com** and **www.shopping.com** -* The **order** service must be available through **api.shopping.com/order** -* The **billing** service must be available through **api.shopping.com/billing** as well -* The traffic coming on `api.shopping.com` and not covered by the two rules above must be routed on **order** - -This is what the custom routing definition looks like for each of them - -### Web interface -Here is what the `.qovery.yml` looks like for the web interface: - -```yaml title=".qovery.yml web interface" {7-16} -application: - name: web-interface - project: my-ecommerce-project - publicly_accessible: true -routers: -- name: frontend - custom_domains: - - branch: master - domain: shopping.com - - branch: master - domain: www.shopping.com - routes: - - application_name: web-interface - paths: - - / -``` - -### Order service -Here is what the `.qovery.yml` looks like for the order service: - -```yaml title=".qovery.yml order service" {7-16} -application: - name: order-service - project: my-ecommerce-project - publicly_accessible: true -routers: -- name: backend - custom_domains: - - branch: master - domain: api.shopping.com - routes: - - application_name: order-service - paths: - - / - - /order/ -``` - -### Billing service -Here is what the `.qovery.yml` looks like for the billing service: - -```yaml title=".qovery.yml billing service" {7-15} -application: - name: billing-service - project: my-ecommerce-project - publicly_accessible: true -routers: -- name: backend - custom_domains: - - branch: master - domain: api.shopping.com - routes: - - application_name: billing-service - paths: - - /billing/ -``` - -At the end, `api.shopping.com`, `shopping.com` and `www.shopping.com` work as expected. -Happy custom routing. - - -[docs.environment]: /docs/using-qovery/configuration/environment/ -[docs.routing]: /docs/using-qovery/configuration/routing/ -[guides.deploy-your-first-application]: /guides/getting-started/deploy-your-first-application/ -[urls.qovery_chat]: https://discord.qovery.com diff --git a/website/guides/advanced/custom-routes.md.erb b/website/guides/advanced/custom-routes.md.erb deleted file mode 100644 index a57cf5b9d5..0000000000 --- a/website/guides/advanced/custom-routes.md.erb +++ /dev/null @@ -1,118 +0,0 @@ ---- -$schema: "/.meta/.schemas/guides.json" -title: Custom routes -description: How to set up custom routes in your project -author_github: https://github.com/evoxmusic -tags: ["type: guide"] ---- -import SVG from 'react-inlinesvg'; -import Steps from '@site/src/components/Steps'; -import Assumptions from '@site/src/components/Assumptions'; -import Alert from '@site/src/components/Alert'; - -<%= qovery_routing_intro() %> - - - -No network knowledge is required to create your custom routes - - - - - -* You have installed the [Qovery CLI][guides.deploy-your-first-application] -* You need to deploy more than one application (e.g backend and frontend) - - - -## FAQ -Before digging deeper into this guide, I would explain why you should not or why you should use it. - -### Why you should use it -* You need to expose your application publicly through HTTPS -* You need to have one endpoint (foo.com) targeting multiple backend applications - -### Why you should not use it -* You only have one application within your [environment][docs.environment] -* You are not sure why you should use it ([ask us][urls.qovery_chat]) - -## Concepts - -<%= qovery_routing_concepts() %> - -# Example -Here is a concrete example to show how custom routes could be your best friend in a real-world application. - -## The e-commerce website -Let's imagine that we have to build an e-commerce website which gives the possibility to order shoes. This website must be able to take orders and provide an invoice for each order. Our system has one web interface, one order service, and one billing service that is for each of them an independent application. - -What do we want? -* The **web interface** must be available through **shopping.com** and **www.shopping.com** -* The **order** service must be available through **api.shopping.com/order** -* The **billing** service must be available through **api.shopping.com/billing** as well -* The traffic coming on `api.shopping.com` and not covered by the two rules above must be routed on **order** - -This is what the custom routing definition looks like for each of them - -### Web interface -Here is what the `.qovery.yml` looks like for the web interface: - -```yaml title=".qovery.yml web interface" {7-16} -application: - name: web-interface - project: my-ecommerce-project - publicly_accessible: true -routers: -- name: frontend - custom_domains: - - branch: master - domain: shopping.com - - branch: master - domain: www.shopping.com - routes: - - application_name: web-interface - paths: - - / -``` - -### Order service -Here is what the `.qovery.yml` looks like for the order service: - -```yaml title=".qovery.yml order service" {7-16} -application: - name: order-service - project: my-ecommerce-project - publicly_accessible: true -routers: -- name: backend - custom_domains: - - branch: master - domain: api.shopping.com - routes: - - application_name: order-service - paths: - - / - - /order/ -``` - -### Billing service -Here is what the `.qovery.yml` looks like for the billing service: - -```yaml title=".qovery.yml billing service" {7-15} -application: - name: billing-service - project: my-ecommerce-project - publicly_accessible: true -routers: -- name: backend - custom_domains: - - branch: master - domain: api.shopping.com - routes: - - application_name: billing-service - paths: - - /billing/ -``` - -At the end, `api.shopping.com`, `shopping.com` and `www.shopping.com` work as expected. -Happy custom routing. diff --git a/website/guides/advanced/digital-ocean.md b/website/guides/advanced/digital-ocean.md new file mode 100644 index 0000000000..1a4600fcc7 --- /dev/null +++ b/website/guides/advanced/digital-ocean.md @@ -0,0 +1,20 @@ +--- +last_modified_on: "2021-06-24" +$schema: "/.meta/.schemas/guides.json" +title: Deploy your apps on your Digital Ocean account +description: How to deploy your apps on your Digital Ocean account with Qovery +author_github: https://github.com/evoxmusic +tags: ["type: guide"] +--- +import Steps from '@site/src/components/Steps'; +import Assumptions from '@site/src/components/Assumptions'; +import Alert from '@site/src/components/Alert'; + + + +This guide is coming soon + + + + + diff --git a/website/guides/advanced/digital-ocean.md.erb b/website/guides/advanced/digital-ocean.md.erb new file mode 100644 index 0000000000..9eb78f2652 --- /dev/null +++ b/website/guides/advanced/digital-ocean.md.erb @@ -0,0 +1,18 @@ +--- +$schema: "/.meta/.schemas/guides.json" +title: Deploy your apps on your Digital Ocean account +description: How to deploy your apps on your Digital Ocean account with Qovery +author_github: https://github.com/evoxmusic +tags: ["type: guide"] +--- +import Steps from '@site/src/components/Steps'; +import Assumptions from '@site/src/components/Assumptions'; +import Alert from '@site/src/components/Alert'; + + + +This guide is coming soon + + + +<%= subpages() %> diff --git a/website/guides/advanced/microservices.md b/website/guides/advanced/microservices.md new file mode 100644 index 0000000000..468d204abb --- /dev/null +++ b/website/guides/advanced/microservices.md @@ -0,0 +1,19 @@ +--- +last_modified_on: "2021-06-24" +$schema: "/.meta/.schemas/guides.json" +title: Microservices +description: How to deploy microservices with Qovery +author_github: https://github.com/evoxmusic +tags: ["type: guide"] +--- + +import Alert from '@site/src/components/Alert'; + + + +This guide is coming soon + + + + + diff --git a/website/guides/advanced/microservices.md.erb b/website/guides/advanced/microservices.md.erb new file mode 100644 index 0000000000..ad2e557b47 --- /dev/null +++ b/website/guides/advanced/microservices.md.erb @@ -0,0 +1,15 @@ +--- +$schema: "/.meta/.schemas/guides.json" +title: Microservices +description: How to deploy microservices with Qovery +author_github: https://github.com/evoxmusic +tags: ["type: guide"] +--- + + + +This guide is coming soon + + + +<%= subpages() %> diff --git a/website/guides/advanced/microservices.md.erb.todo b/website/guides/advanced/microservices.md.erb.todo deleted file mode 100644 index 7aa3f34a71..0000000000 --- a/website/guides/advanced/microservices.md.erb.todo +++ /dev/null @@ -1,10 +0,0 @@ ---- -$schema: "/.meta/.schemas/guides.json" -title: Microservices -description: How to work with multiple applications in one project -author_github: https://github.com/pjeziorowski -tags: ["type: guide"] ---- - - -<%= subpages() %> diff --git a/website/guides/advanced/monorepository.md b/website/guides/advanced/monorepository.md new file mode 100644 index 0000000000..15adefd278 --- /dev/null +++ b/website/guides/advanced/monorepository.md @@ -0,0 +1,19 @@ +--- +last_modified_on: "2021-06-24" +$schema: "/.meta/.schemas/guides.json" +title: Mono repository +description: How to deploy mono repository app with Qovery +author_github: https://github.com/evoxmusic +tags: ["type: guide"] +--- + +import Alert from '@site/src/components/Alert'; + + + +This guide is coming soon + + + + + diff --git a/website/guides/advanced/monorepository.md.erb b/website/guides/advanced/monorepository.md.erb new file mode 100644 index 0000000000..26d01d3e9e --- /dev/null +++ b/website/guides/advanced/monorepository.md.erb @@ -0,0 +1,15 @@ +--- +$schema: "/.meta/.schemas/guides.json" +title: Mono repository +description: How to deploy mono repository app with Qovery +author_github: https://github.com/evoxmusic +tags: ["type: guide"] +--- + + + +This guide is coming soon + + + +<%= subpages() %> diff --git a/website/guides/advanced/using-multiple-cloud-providers.md.erb.todo b/website/guides/advanced/staging-environment.md similarity index 55% rename from website/guides/advanced/using-multiple-cloud-providers.md.erb.todo rename to website/guides/advanced/staging-environment.md index 949e2ecd0a..fc8a178bd2 100644 --- a/website/guides/advanced/using-multiple-cloud-providers.md.erb.todo +++ b/website/guides/advanced/staging-environment.md @@ -1,7 +1,8 @@ --- +last_modified_on: "2021-06-24" $schema: "/.meta/.schemas/guides.json" -title: Using multiple Cloud providers -description: How to make use of multiple Cloud providers on Qovery +title: Staging environment +description: How to create a staging environment with Qovery author_github: https://github.com/evoxmusic tags: ["type: guide"] --- @@ -9,12 +10,11 @@ import Steps from '@site/src/components/Steps'; import Assumptions from '@site/src/components/Assumptions'; import Alert from '@site/src/components/Alert'; -TODO + - +This guide is coming soon + + -* You have installed the [Qovery CLI][guides.deploy-your-first-application] - -TODO diff --git a/website/guides/advanced/staging-environment.md.erb b/website/guides/advanced/staging-environment.md.erb new file mode 100644 index 0000000000..3511017c88 --- /dev/null +++ b/website/guides/advanced/staging-environment.md.erb @@ -0,0 +1,18 @@ +--- +$schema: "/.meta/.schemas/guides.json" +title: Staging environment +description: How to create a staging environment with Qovery +author_github: https://github.com/evoxmusic +tags: ["type: guide"] +--- +import Steps from '@site/src/components/Steps'; +import Assumptions from '@site/src/components/Assumptions'; +import Alert from '@site/src/components/Alert'; + + + +This guide is coming soon + + + +<%= subpages() %> diff --git a/website/guides/advanced/using-multiple-environments.md b/website/guides/advanced/using-multiple-environments.md deleted file mode 100644 index 8442b8beb6..0000000000 --- a/website/guides/advanced/using-multiple-environments.md +++ /dev/null @@ -1,175 +0,0 @@ ---- -last_modified_on: "2021-06-01" -$schema: "/.meta/.schemas/guides.json" -title: Multiple environments -description: How to make use of Environments on Qovery -author_github: https://github.com/pjeziorowski -tags: ["type: guide"] ---- -import Steps from '@site/src/components/Steps'; -import Assumptions from '@site/src/components/Assumptions'; -import Alert from '@site/src/components/Alert'; - -Before you release new features, you always want to test them in a working, remote environment that closely resembles your production to make sure everything works as expected (not only on your machine). -Working in teams makes this task a bit more complicated - if you have just one testing environment, sometimes you have to wait until your colleagues finish testing their features before you can test yours. - -In this guide, you will learn how to make a full use of Qovery `Environments` to speed up your development cycle and make your life as a developer more pleasurable and simple. - - - -* You have installed the [Qovery CLI][guides.deploy-your-first-application] -* You have already deployed an application with Qovery - - - - - -## Your application - -Let's suppose you're working in a team. You and your colleagues are adding new features to one of your applications. -For simplicity of the guide, let's suppose that this is your application: - -```javascript title="app.js" -const http = require('http'); - -const hostname = '0.0.0.0'; -const port = 3333; - -const server = http.createServer((req, res) => { - res.statusCode = 200; - res.setHeader('Content-Type', 'text/plain'); - res.end(`Hello from ${process.env.QOVERY_BRANCH_NAME} environment!`); -}); - -server.listen(port, hostname, () => { - console.log(`Server running at http://${hostname}:${port}/`); -}); -``` - -It's a simple Node.js server that returns text in HTTP body response. - -## Adding new features - -Your colleague had a task - adding jokes about Chuck Norris to server responses. -He is a great programmer - he created a new branch and developed a new feature: - -```javascript title="app.js - Your colleague's feature" {15-29} -const http = require('http'); -const https = require('https'); - -const hostname = '0.0.0.0'; -const port = 3333; - -const server = http.createServer((req, res) => { - myColleaguesFeature(res) -}); - -server.listen(port, hostname, () => { - console.log(`Server running at http://${hostname}:${port}/`); -}); - -const myColleaguesFeature = (r) => { - https.get('https://api.chucknorris.io/jokes/random', (resp) => { - let data = '' - - resp.on('data', (chunk) => { - data += chunk - }) - - resp.on('end', () => { - r.end(`Hello from ${process.env.QOVERY_BRANCH_NAME} environment!\n\nEnjoy a high quality joke: ${JSON.parse(data).value}`) - }) - }).on('error', (err) => { - r.statusCode = 500 - r.end(`Something has gone wrong in ${process.env.QOVERY_BRANCH_NAME} environment!`) - }) -} -``` - -He tested his code locally: -```bash -$ curl http://localhost:3333 -Hello from undefined environment! - -Enjoy a high quality joke: Chuck Norris can unscramble an egg⏎ -``` - -It works! A great joke appears in the response. Great! But your colleague is a smart guy - he wanted to make sure that his feature also -works well in the deployed, testing environment. He wants to avoid saying `IT WORKS - on my machine` later on (if for some reason his feature didn't work in production). - -## Testing in deployed environments - -Typically, software teams have a few environments. A common pattern is having something close to `production`, `staging` and `testing` environment. - -So, your colleague has deployed his app to the `testing` environment. - -### The problem - -Unluckily, at the same time, you have finished your own important feature (adding the current Bitcoin price to the response!), and you also want to test it in a remote environment. - -```javascript title="app.js - Your own feature" {15-30} -const http = require('http'); -const https = require('https'); - -const hostname = '0.0.0.0'; -const port = 3333; - -const server = http.createServer((req, res) => { - myFeature(res) -}); - -server.listen(port, hostname, () => { - console.log(`Server running at http://${hostname}:${port}/`); -}); - -const myFeature = (r) => { - https.get('https://api.coindesk.com/v1/bpi/currentprice/btc.json', (resp) => { - let data = '' - - resp.on('data', (chunk) => { - data += chunk - }) - - resp.on('end', () => { - r.end(`Hello from ${process.env.QOVERY_BRANCH_NAME} environment!\n\nCurrent Bitcoin price: $${JSON.parse(data).bpi.USD.rate}`.split(".")[0]) - }) - }).on('error', (err) => { - r.statusCode = 500 - r.end(`Something has gone wrong in ${process.env.QOVERY_BRANCH_NAME} environment!`) - }) -} -``` - -You have your own separate Git branch, so your changes are not a part of your friend's version of the application. - -You can't test your changes at the same time with your colleague in one environment! -During the time your friend tests his code, your feature can not be finished and delivered to the production. - -### Qovery Environments to the rescue - -To solve this issue and enable software developers to work independently, Qovery introduces the concept of `Environments`. -On Qovery, after you create a new branch for your new feature, you automatically get a completely separated copy of your production environment (including all applications, databases, storage, and brokers). - - - -Please note that data is not automatically copied, you have to populate the newly created databases yourself. -The data you will popuplate will be kept when you restart the associated environment. You will loose it only when you delete the env. - - - - -

- Deploying multiple Environments -

- -As you see, you also get separate URLs to your versions of applications, so you can test your apps freely and independently. -Now, you can test your features in parallel. No more time wasted! - - -[guides.deploy-your-first-application]: /guides/getting-started/deploy-your-first-application/ diff --git a/website/guides/advanced/using-multiple-environments.md.erb b/website/guides/advanced/using-multiple-environments.md.erb deleted file mode 100644 index 94d5420c9a..0000000000 --- a/website/guides/advanced/using-multiple-environments.md.erb +++ /dev/null @@ -1,164 +0,0 @@ ---- -$schema: "/.meta/.schemas/guides.json" -title: Multiple environments -description: How to make use of Environments on Qovery -author_github: https://github.com/pjeziorowski -tags: ["type: guide"] ---- -import Steps from '@site/src/components/Steps'; -import Assumptions from '@site/src/components/Assumptions'; -import Alert from '@site/src/components/Alert'; - -Before you release new features, you always want to test them in a working, remote environment that closely resembles your production to make sure everything works as expected (not only on your machine). -Working in teams makes this task a bit more complicated - if you have just one testing environment, sometimes you have to wait until your colleagues finish testing their features before you can test yours. - -In this guide, you will learn how to make a full use of Qovery `Environments` to speed up your development cycle and make your life as a developer more pleasurable and simple. - - - -* You have installed the [Qovery CLI][guides.deploy-your-first-application] -* You have already deployed an application with Qovery - - - -## Your application - -Let's suppose you're working in a team. You and your colleagues are adding new features to one of your applications. -For simplicity of the guide, let's suppose that this is your application: - -```javascript title="app.js" -const http = require('http'); - -const hostname = '0.0.0.0'; -const port = 3333; - -const server = http.createServer((req, res) => { - res.statusCode = 200; - res.setHeader('Content-Type', 'text/plain'); - res.end(`Hello from ${process.env.QOVERY_BRANCH_NAME} environment!`); -}); - -server.listen(port, hostname, () => { - console.log(`Server running at http://${hostname}:${port}/`); -}); -``` - -It's a simple Node.js server that returns text in HTTP body response. - -## Adding new features - -Your colleague had a task - adding jokes about Chuck Norris to server responses. -He is a great programmer - he created a new branch and developed a new feature: - -```javascript title="app.js - Your colleague's feature" {15-29} -const http = require('http'); -const https = require('https'); - -const hostname = '0.0.0.0'; -const port = 3333; - -const server = http.createServer((req, res) => { - myColleaguesFeature(res) -}); - -server.listen(port, hostname, () => { - console.log(`Server running at http://${hostname}:${port}/`); -}); - -const myColleaguesFeature = (r) => { - https.get('https://api.chucknorris.io/jokes/random', (resp) => { - let data = '' - - resp.on('data', (chunk) => { - data += chunk - }) - - resp.on('end', () => { - r.end(`Hello from ${process.env.QOVERY_BRANCH_NAME} environment!\n\nEnjoy a high quality joke: ${JSON.parse(data).value}`) - }) - }).on('error', (err) => { - r.statusCode = 500 - r.end(`Something has gone wrong in ${process.env.QOVERY_BRANCH_NAME} environment!`) - }) -} -``` - -He tested his code locally: -```bash -$ curl http://localhost:3333 -Hello from undefined environment! - -Enjoy a high quality joke: Chuck Norris can unscramble an egg⏎ -``` - -It works! A great joke appears in the response. Great! But your colleague is a smart guy - he wanted to make sure that his feature also -works well in the deployed, testing environment. He wants to avoid saying `IT WORKS - on my machine` later on (if for some reason his feature didn't work in production). - -## Testing in deployed environments - -Typically, software teams have a few environments. A common pattern is having something close to `production`, `staging` and `testing` environment. - -So, your colleague has deployed his app to the `testing` environment. - -### The problem - -Unluckily, at the same time, you have finished your own important feature (adding the current Bitcoin price to the response!), and you also want to test it in a remote environment. - -```javascript title="app.js - Your own feature" {15-30} -const http = require('http'); -const https = require('https'); - -const hostname = '0.0.0.0'; -const port = 3333; - -const server = http.createServer((req, res) => { - myFeature(res) -}); - -server.listen(port, hostname, () => { - console.log(`Server running at http://${hostname}:${port}/`); -}); - -const myFeature = (r) => { - https.get('https://api.coindesk.com/v1/bpi/currentprice/btc.json', (resp) => { - let data = '' - - resp.on('data', (chunk) => { - data += chunk - }) - - resp.on('end', () => { - r.end(`Hello from ${process.env.QOVERY_BRANCH_NAME} environment!\n\nCurrent Bitcoin price: $${JSON.parse(data).bpi.USD.rate}`.split(".")[0]) - }) - }).on('error', (err) => { - r.statusCode = 500 - r.end(`Something has gone wrong in ${process.env.QOVERY_BRANCH_NAME} environment!`) - }) -} -``` - -You have your own separate Git branch, so your changes are not a part of your friend's version of the application. - -You can't test your changes at the same time with your colleague in one environment! -During the time your friend tests his code, your feature can not be finished and delivered to the production. - -### Qovery Environments to the rescue - -To solve this issue and enable software developers to work independently, Qovery introduces the concept of `Environments`. -On Qovery, after you create a new branch for your new feature, you automatically get a completely separated copy of your production environment (including all applications, databases, storage, and brokers). - - - -Please note that data is not automatically copied, you have to populate the newly created databases yourself. -The data you will popuplate will be kept when you restart the associated environment. You will loose it only when you delete the env. - - - - -

- Deploying multiple Environments -

- -As you see, you also get separate URLs to your versions of applications, so you can test your apps freely and independently. -Now, you can test your features in parallel. No more time wasted! - diff --git a/website/guides/getting-started/adding-a-database.md b/website/guides/getting-started/create-a-database.md similarity index 87% rename from website/guides/getting-started/adding-a-database.md rename to website/guides/getting-started/create-a-database.md index ecff528763..1ff5b17fa4 100644 --- a/website/guides/getting-started/adding-a-database.md +++ b/website/guides/getting-started/create-a-database.md @@ -1,8 +1,8 @@ --- -last_modified_on: "2021-06-21" +last_modified_on: "2021-06-24" $schema: "/.meta/.schemas/guides.json" -title: Adding a database -description: How to add a database to your application +title: Create a database +description: How to create a database to your application series_position: 2 author_github: https://github.com/evoxmusic tags: ["type: guide"] @@ -25,7 +25,7 @@ few seconds in this guide. To make changes please edit the template located at: - website/guides/getting-started/adding-a-database.md.erb + website/guides/getting-started/create-a-database.md.erb --> ## Tutorial @@ -38,7 +38,7 @@ PostgreSQL database and connect it to our NodeJS app.
  • -### Add your PostgreSQL database +### Create a PostgreSQL database

    @@ -51,18 +51,6 @@ PostgreSQL database and connect it to our NodeJS app.

  • -### Add an environment variable - - - -Creating an environment variable is not yet possible. It is coming soon. - - - -
  • - -
  • - ### Connect your application Now, we need to connect our application to our database. The credentials (URI, Username, Password ...) are available diff --git a/website/guides/getting-started/adding-a-database.md.erb b/website/guides/getting-started/create-a-database.md.erb similarity index 89% rename from website/guides/getting-started/adding-a-database.md.erb rename to website/guides/getting-started/create-a-database.md.erb index 3cedc23669..876f51016f 100644 --- a/website/guides/getting-started/adding-a-database.md.erb +++ b/website/guides/getting-started/create-a-database.md.erb @@ -1,7 +1,7 @@ --- $schema: "/.meta/.schemas/guides.json" -title: Adding a database -description: How to add a database to your application +title: Create a database +description: How to create a database to your application series_position: 2 author_github: https://github.com/evoxmusic tags: ["type: guide"] @@ -29,7 +29,7 @@ PostgreSQL database and connect it to our NodeJS app.
  • -### Add your PostgreSQL database +### Create a PostgreSQL database

    @@ -42,18 +42,6 @@ PostgreSQL database and connect it to our NodeJS app.

  • -### Add an environment variable - - - -Creating an environment variable is not yet possible. It is coming soon. - - - -
  • - -
  • - ### Connect your application Now, we need to connect our application to our database. The credentials (URI, Username, Password ...) are available diff --git a/website/guides/getting-started/debugging.md b/website/guides/getting-started/debugging.md index 07162d44f3..81621a4700 100644 --- a/website/guides/getting-started/debugging.md +++ b/website/guides/getting-started/debugging.md @@ -1,8 +1,8 @@ --- -last_modified_on: "2021-01-09" +last_modified_on: "2021-06-24" $schema: "/.meta/.schemas/guides.json" title: Debugging -description: How to debug your application with Qovery +description: How to debug your application series_position: 5 author_github: https://github.com/evoxmusic tags: ["type: guide"] @@ -11,15 +11,17 @@ import Steps from '@site/src/components/Steps'; import Assumptions from '@site/src/components/Assumptions'; import Alert from '@site/src/components/Alert'; -Your application is running, but something goes wrong? In this guide, you'll learn how to debug your application and solve your problem to make it running smoothly. +Your application is running, but something goes wrong? In this guide, you'll learn how to debug your application and solve your problem to +make it running smoothly. -* You have installed the [Qovery CLI][guides.deploy-your-first-application] * You have already deployed an application with Qovery +Your application is running, but for some reason, it is not working as expected. Here are a few tips to find out what's going on. + -## Debugging an application build -You have deployed your application with Qovery, and the status of your application is `build error`. Meaning, your application has failed to build correctly. -There are two commands for getting a closer look at what's going on. - -### Qovery status -The command `qovery status` give the status of our application. In the case of a build error, the reason is displayed into the console as well - -```bash -$ qovery status -``` - -```bash title="Build error output" {10-23} -BRANCH NAME | STATUS | ENDPOINTS | APPLICATIONS | DATABASES -master | build error | https://main-yenr7erjbs87dk4m-gtw.qovery.io | simple-example-node-with-postgresql | my-postgresql-3498225 - -APPLICATION NAME | STATUS | DATABASES -simple-example-node-with-postgresql | build error | my-postgresql-3498225 - -DATABASE NAME | STATUS | TYPE | VERSION | ENDPOINT | PORT | USERNAME | PASSWORD | APPLICATIONS -my-postgresql-3498225 | running | POSTGRESQL | 11.5 | | | | | simple-example-node-with-postgresql - -Something goes wrong: - ----------- Start of error message ---------- -Sending build context to Docker daemon 244.7kB -Step 1/8 : FROM node:13-alpine ----> bcfeabd22749 -Step 2/8 : RUN mkdir -p /usr/src/app ----> Using cache ----> 104f4613b141 -Step 3/8 : RUN toto ----> Running in 52fa3e66f0c4 -/bin/sh: toto: not found -The command '/bin/sh -c toto' returned a non-zero code: 127 ------------ End of error message ----------- - -HINT: Ensure your Dockerfile is correct. Run and test your container locally with 'qovery run' -``` - -Here we can see that the build error comes from our Dockerfile. We also have a hint affirming this problem. - -### Qovery run - - - -You must have the [docker][urls.docker] runtime installed and running - - - -The command `qovery run` is a wrapper around the commands `docker build` and `docker run`. It's the best way to test your container locally. Our motto is, if your application is running locally with `qovery run` then it will work on Qovery. -In the case of a bad Dockerfile, by running `qovery run` we directly see the error - -```bash -$ qovery run -``` - -```bash title="Build error output" -2020/04/22 10:12:37 reload master environment: DONE -Step 1/8 : FROM node:13-alpine - ---> e1495e4ac50d -Step 2/8 : RUN mkdir -p /usr/src/app - ---> Using cache - ---> 3afe9d6678e0 -Step 3/8 : RUN toto - ---> Running in fadf25b6fc5e -/bin/sh: toto: not found -``` - -## Debugging a running application -Your application is running, but for some reason, it is not working as expected. Here are a few tips to find out what's going on. - -### Qovery status -First, check that all your applications and services are up and running correctly with `qovery status` - -```bash -$ qovery status -``` - -```bash title="Check application status" -BRANCH NAME | STATUS | ENDPOINTS | APPLICATIONS | DATABASES -master | running | https://main-yenr7erjbs87dk4m-gtw.qovery.io | simple-example-node-with-postgresql | my-postgresql-3498225 - -APPLICATION NAME | STATUS | DATABASES -simple-example-node-with-postgresql | running | my-postgresql-3498225 - -DATABASE NAME | STATUS | TYPE | VERSION | ENDPOINT | PORT | USERNAME | PASSWORD | APPLICATIONS -my-postgresql-3498225 | running | POSTGRESQL | 11.5 | | | | | simple-example-node-with-postgresql -``` - -Everything is fine here, meaning the problem is on our side as developer. - -### Qovery log -Your application is running, and logs are debug/info/warning/error messages can be thrown upon the standard output. To show them it's as easy as typing one command - -```bash -$ qovery log -``` - -```bash title="Log output" -GET / 200 7.707 ms - 170 -GET / 200 5.572 ms - 170 -GET / 200 5.296 ms - 170 -GET /stylesheets/style.css 200 2.812 ms - 117 -GET /favicon.ico 404 8.127 ms - 913 -GET /stylesheets/style.css 304 0.861 ms - - -GET / 304 5.100 ms - - -GET /stylesheets/style.css 304 0.361 ms - - -GET / 200 5.055 ms - 170 -``` - - - -See all log options with `qovery log -h` - - - -**Pro tip**: you can even follow the output with the `-f` option - -```bash -$ qovery log -f -``` - -If you want to display logs of all applications in a given environment, use `qovery log --environment` instead: - -```bash -$ qovery log --environment -log-printer-gitlab | 2020-11-24T12:00:24.826Z -log-printer-gitlab-v2 | 2020-11-24T12:00:25.027Z -log-printer-gitlab | 2020-11-24T12:00:25.827Z -log-printer-gitlab-v2 | 2020-11-24T12:00:26.027Z -log-printer-gitlab | 2020-11-24T12:00:26.828Z -log-printer-gitlab-v2 | 2020-11-24T12:00:27.028Z -log-printer-gitlab | 2020-11-24T12:00:27.830Z -log-printer-gitlab-v2 | 2020-11-24T12:00:28.029Z -log-printer-gitlab | 2020-11-24T12:00:28.831Z -log-printer-gitlab-v2 | 2020-11-24T12:00:29.030Z -log-printer-gitlab | 2020-11-24T12:00:29.832Z -log-printer-gitlab-v2 | 2020-11-24T12:00:30.031Z -log-printer-gitlab | 2020-11-24T12:00:30.833Z -log-printer-gitlab-v2 | 2020-11-24T12:00:31.031Z -log-printer-gitlab | 2020-11-24T12:00:31.834Z -log-printer-gitlab-v2 | 2020-11-24T12:00:32.032Z -``` - -### Rollback -You need more time to fix a bug? No worries, you can rollback at any time by using `qovery deploy ` - -```bash -$ qovery deploy list -``` - -```bash title="Last deployed commits" -BRANCH | COMMIT DATE | COMMIT ID | COMMIT AUTHOR | DEPLOYED -master | 2020-04-22 10:34:11 +0200 +0200 | c4f5ab0396ab025a115f96c50c71e63ccf0aceae | Romaric Philogene | ✓ -master | 2020-04-22 09:55:25 +0200 +0200 | bafbc5501f016b6c906f373022ed3a40f4ecdf4b | Romaric Philogene | -master | 2020-04-22 09:39:42 +0200 +0200 | 5fe83fed61b7c6933c015d73e2588d20ba9856d1 | Romaric Philogene | -master | 2020-04-21 21:10:03 +0200 +0200 | f4b9bd4c8cc043e6a65e6a84db825d5897cbc30d | Romaric Philogene | -master | 2020-04-21 20:59:24 +0200 +0200 | 8cf3e8aec44b2468e59eca59defe164eea10c63f | Romaric Philogene | -master | 2020-04-20 22:20:04 +0200 +0200 | 5f9fd42f979f89bc20349cb89978bda139c3eca1 | Romaric Philogene | -master | 2020-04-10 20:12:22 +0200 +0200 | efbbeecaacdb5acc5f3175bd83fa39536f0ed395 | Romaric Philogene | -master | 2020-04-10 15:44:05 +0200 +0200 | ccfa5fad64dbb85d279c07f256101fd234e6624a | Romaric Philogene | -master | 2020-04-10 15:26:57 +0200 +0200 | 27df877c83ca979f026f6eb4fbba73692293da87 | Romaric Philogene | -master | 2020-04-08 20:03:29 +0200 +0200 | fa8aa4f12e80ae64b3ef8d217df1ecaccc576708 | Romaric Philogene | -``` - -To rollback on the commit `8cf3e8aec44b2468e59eca59defe164eea10c63f` it's as easy as executing the command - -```bash -$ qovery deploy 8cf3e8aec44b2468e59eca59defe164eea10c63f -``` - -```bash title="Rollback output" -deployment in progress... -Hint: type "qovery status --watch" to track the progression of this deployment -``` +## Check the status of your app -Then, we can watch the progress of the rollback with +TODO -```bash -$ qovery status --watch -``` +## Logs -```bash title="Deployment progression" - 100% |████████████████████████████████████████| [0s:0s] +TODO -Your environment is ready! +## Rollback --- status output -- +TODO -BRANCH NAME | STATUS | ENDPOINTS | APPLICATIONS | DATABASES -master | running | https://main-yenr7erjbs87dk4m-gtw.qovery.io | simple-example-node-with-postgresql | my-postgresql-3498225 - -APPLICATION NAME | STATUS | DATABASES -simple-example-node-with-postgresql | running | my-postgresql-3498225 - -DATABASE NAME | STATUS | TYPE | VERSION | ENDPOINT | PORT | USERNAME | PASSWORD | APPLICATIONS -my-postgresql-3498225 | running | POSTGRESQL | 11.5 | | | | | simple-example-node-with-postgresql -``` - -Well done! You have rollback to a previous working version. - -## Monitoring and alerting +## Monitoring -Qovery will provide [very soon][urls.qovery_roadmap] monitoring and alerting. In the meantime, we highly recommend using tools like [Datadog][urls.datadog]. +TODO -## Third-party integration -Qovery integrates third-party services like Datadog, NewRelic, and others. You can use any third service that you want if they support containers (which is the case of most of them). +## Alerting +We highly recommend using tools like [Datadog][urls.datadog], [Sentry][urls.sentry] or [NewRelic][urls.new_relic] to manage your alerting. +Qovery will provide easy integrations in a coming release. Check out our [roadmap][urls.qovery_roadmap] Do you need any help? [Reach us on Discord][urls.qovery_chat] -[guides.deploy-your-first-application]: /guides/getting-started/deploy-your-first-application/ [urls.datadog]: https://www.datadoghq.com -[urls.docker]: https://www.docker.com/ +[urls.new_relic]: https://newrelic.com/ [urls.qovery_chat]: https://discord.qovery.com [urls.qovery_roadmap]: https://roadmap.qovery.com/ +[urls.sentry]: https://sentry.io/ diff --git a/website/guides/getting-started/debugging.md.erb b/website/guides/getting-started/debugging.md.erb index 76203aea52..eea4fe9f33 100644 --- a/website/guides/getting-started/debugging.md.erb +++ b/website/guides/getting-started/debugging.md.erb @@ -1,7 +1,7 @@ --- $schema: "/.meta/.schemas/guides.json" title: Debugging -description: How to debug your application with Qovery +description: How to debug your application series_position: 5 author_github: https://github.com/evoxmusic tags: ["type: guide"] @@ -10,222 +10,36 @@ import Steps from '@site/src/components/Steps'; import Assumptions from '@site/src/components/Assumptions'; import Alert from '@site/src/components/Alert'; -Your application is running, but something goes wrong? In this guide, you'll learn how to debug your application and solve your problem to make it running smoothly. +Your application is running, but something goes wrong? In this guide, you'll learn how to debug your application and solve your problem to +make it running smoothly. -* You have installed the [Qovery CLI][guides.deploy-your-first-application] * You have already deployed an application with Qovery -## Debugging an application build -You have deployed your application with Qovery, and the status of your application is `build error`. Meaning, your application has failed to build correctly. -There are two commands for getting a closer look at what's going on. - -### Qovery status -The command `qovery status` give the status of our application. In the case of a build error, the reason is displayed into the console as well - -```bash -$ qovery status -``` - -```bash title="Build error output" {10-23} -BRANCH NAME | STATUS | ENDPOINTS | APPLICATIONS | DATABASES -master | build error | https://main-yenr7erjbs87dk4m-gtw.qovery.io | simple-example-node-with-postgresql | my-postgresql-3498225 - -APPLICATION NAME | STATUS | DATABASES -simple-example-node-with-postgresql | build error | my-postgresql-3498225 - -DATABASE NAME | STATUS | TYPE | VERSION | ENDPOINT | PORT | USERNAME | PASSWORD | APPLICATIONS -my-postgresql-3498225 | running | POSTGRESQL | 11.5 | | | | | simple-example-node-with-postgresql - -Something goes wrong: - ----------- Start of error message ---------- -Sending build context to Docker daemon 244.7kB -Step 1/8 : FROM node:13-alpine ----> bcfeabd22749 -Step 2/8 : RUN mkdir -p /usr/src/app ----> Using cache ----> 104f4613b141 -Step 3/8 : RUN toto ----> Running in 52fa3e66f0c4 -/bin/sh: toto: not found -The command '/bin/sh -c toto' returned a non-zero code: 127 ------------ End of error message ----------- - -HINT: Ensure your Dockerfile is correct. Run and test your container locally with 'qovery run' -``` - -Here we can see that the build error comes from our Dockerfile. We also have a hint affirming this problem. - -### Qovery run - - - -You must have the [docker][urls.docker] runtime installed and running - - - -The command `qovery run` is a wrapper around the commands `docker build` and `docker run`. It's the best way to test your container locally. Our motto is, if your application is running locally with `qovery run` then it will work on Qovery. -In the case of a bad Dockerfile, by running `qovery run` we directly see the error - -```bash -$ qovery run -``` - -```bash title="Build error output" -2020/04/22 10:12:37 reload master environment: DONE -Step 1/8 : FROM node:13-alpine - ---> e1495e4ac50d -Step 2/8 : RUN mkdir -p /usr/src/app - ---> Using cache - ---> 3afe9d6678e0 -Step 3/8 : RUN toto - ---> Running in fadf25b6fc5e -/bin/sh: toto: not found -``` - -## Debugging a running application Your application is running, but for some reason, it is not working as expected. Here are a few tips to find out what's going on. -### Qovery status -First, check that all your applications and services are up and running correctly with `qovery status` - -```bash -$ qovery status -``` - -```bash title="Check application status" -BRANCH NAME | STATUS | ENDPOINTS | APPLICATIONS | DATABASES -master | running | https://main-yenr7erjbs87dk4m-gtw.qovery.io | simple-example-node-with-postgresql | my-postgresql-3498225 - -APPLICATION NAME | STATUS | DATABASES -simple-example-node-with-postgresql | running | my-postgresql-3498225 - -DATABASE NAME | STATUS | TYPE | VERSION | ENDPOINT | PORT | USERNAME | PASSWORD | APPLICATIONS -my-postgresql-3498225 | running | POSTGRESQL | 11.5 | | | | | simple-example-node-with-postgresql -``` - -Everything is fine here, meaning the problem is on our side as developer. - -### Qovery log -Your application is running, and logs are debug/info/warning/error messages can be thrown upon the standard output. To show them it's as easy as typing one command - -```bash -$ qovery log -``` - -```bash title="Log output" -GET / 200 7.707 ms - 170 -GET / 200 5.572 ms - 170 -GET / 200 5.296 ms - 170 -GET /stylesheets/style.css 200 2.812 ms - 117 -GET /favicon.ico 404 8.127 ms - 913 -GET /stylesheets/style.css 304 0.861 ms - - -GET / 304 5.100 ms - - -GET /stylesheets/style.css 304 0.361 ms - - -GET / 200 5.055 ms - 170 -``` - - - -See all log options with `qovery log -h` - - - -**Pro tip**: you can even follow the output with the `-f` option - -```bash -$ qovery log -f -``` - -If you want to display logs of all applications in a given environment, use `qovery log --environment` instead: - -```bash -$ qovery log --environment -log-printer-gitlab | 2020-11-24T12:00:24.826Z -log-printer-gitlab-v2 | 2020-11-24T12:00:25.027Z -log-printer-gitlab | 2020-11-24T12:00:25.827Z -log-printer-gitlab-v2 | 2020-11-24T12:00:26.027Z -log-printer-gitlab | 2020-11-24T12:00:26.828Z -log-printer-gitlab-v2 | 2020-11-24T12:00:27.028Z -log-printer-gitlab | 2020-11-24T12:00:27.830Z -log-printer-gitlab-v2 | 2020-11-24T12:00:28.029Z -log-printer-gitlab | 2020-11-24T12:00:28.831Z -log-printer-gitlab-v2 | 2020-11-24T12:00:29.030Z -log-printer-gitlab | 2020-11-24T12:00:29.832Z -log-printer-gitlab-v2 | 2020-11-24T12:00:30.031Z -log-printer-gitlab | 2020-11-24T12:00:30.833Z -log-printer-gitlab-v2 | 2020-11-24T12:00:31.031Z -log-printer-gitlab | 2020-11-24T12:00:31.834Z -log-printer-gitlab-v2 | 2020-11-24T12:00:32.032Z -``` - -### Rollback -You need more time to fix a bug? No worries, you can rollback at any time by using `qovery deploy ` - -```bash -$ qovery deploy list -``` - -```bash title="Last deployed commits" -BRANCH | COMMIT DATE | COMMIT ID | COMMIT AUTHOR | DEPLOYED -master | 2020-04-22 10:34:11 +0200 +0200 | c4f5ab0396ab025a115f96c50c71e63ccf0aceae | Romaric Philogene | ✓ -master | 2020-04-22 09:55:25 +0200 +0200 | bafbc5501f016b6c906f373022ed3a40f4ecdf4b | Romaric Philogene | -master | 2020-04-22 09:39:42 +0200 +0200 | 5fe83fed61b7c6933c015d73e2588d20ba9856d1 | Romaric Philogene | -master | 2020-04-21 21:10:03 +0200 +0200 | f4b9bd4c8cc043e6a65e6a84db825d5897cbc30d | Romaric Philogene | -master | 2020-04-21 20:59:24 +0200 +0200 | 8cf3e8aec44b2468e59eca59defe164eea10c63f | Romaric Philogene | -master | 2020-04-20 22:20:04 +0200 +0200 | 5f9fd42f979f89bc20349cb89978bda139c3eca1 | Romaric Philogene | -master | 2020-04-10 20:12:22 +0200 +0200 | efbbeecaacdb5acc5f3175bd83fa39536f0ed395 | Romaric Philogene | -master | 2020-04-10 15:44:05 +0200 +0200 | ccfa5fad64dbb85d279c07f256101fd234e6624a | Romaric Philogene | -master | 2020-04-10 15:26:57 +0200 +0200 | 27df877c83ca979f026f6eb4fbba73692293da87 | Romaric Philogene | -master | 2020-04-08 20:03:29 +0200 +0200 | fa8aa4f12e80ae64b3ef8d217df1ecaccc576708 | Romaric Philogene | -``` +## Check the status of your app -To rollback on the commit `8cf3e8aec44b2468e59eca59defe164eea10c63f` it's as easy as executing the command +TODO -```bash -$ qovery deploy 8cf3e8aec44b2468e59eca59defe164eea10c63f -``` +## Logs -```bash title="Rollback output" -deployment in progress... -Hint: type "qovery status --watch" to track the progression of this deployment -``` - -Then, we can watch the progress of the rollback with +TODO -```bash -$ qovery status --watch -``` +## Rollback -```bash title="Deployment progression" - 100% |████████████████████████████████████████| [0s:0s] +TODO -Your environment is ready! - --- status output -- +## Monitoring -BRANCH NAME | STATUS | ENDPOINTS | APPLICATIONS | DATABASES -master | running | https://main-yenr7erjbs87dk4m-gtw.qovery.io | simple-example-node-with-postgresql | my-postgresql-3498225 - -APPLICATION NAME | STATUS | DATABASES -simple-example-node-with-postgresql | running | my-postgresql-3498225 - -DATABASE NAME | STATUS | TYPE | VERSION | ENDPOINT | PORT | USERNAME | PASSWORD | APPLICATIONS -my-postgresql-3498225 | running | POSTGRESQL | 11.5 | | | | | simple-example-node-with-postgresql -``` - -Well done! You have rollback to a previous working version. - -## Monitoring and alerting - -Qovery will provide [very soon][urls.qovery_roadmap] monitoring and alerting. In the meantime, we highly recommend using tools like [Datadog][urls.datadog]. +TODO -## Third-party integration -Qovery integrates third-party services like Datadog, NewRelic, and others. You can use any third service that you want if they support containers (which is the case of most of them). +## Alerting +We highly recommend using tools like [Datadog][urls.datadog], [Sentry][urls.sentry] or [NewRelic][urls.new_relic] to manage your alerting. +Qovery will provide easy integrations in a coming release. Check out our [roadmap][urls.qovery_roadmap] Do you need any help? [Reach us on Discord][urls.qovery_chat] diff --git a/website/guides/getting-started/managing-environment-variables.md b/website/guides/getting-started/managing-environment-variables.md index f6fb005fff..3bf8d89275 100644 --- a/website/guides/getting-started/managing-environment-variables.md +++ b/website/guides/getting-started/managing-environment-variables.md @@ -1,20 +1,26 @@ --- -last_modified_on: "2021-01-09" +last_modified_on: "2021-06-24" $schema: "/.meta/.schemas/guides.json" title: Environment variables description: How to manage environment variables in your projects and applications series_position: 4 -author_github: https://github.com/pjeziorowski +author_github: https://github.com/evoxmusic tags: ["type: guide"] --- + +import Alert from '@site/src/components/Alert'; + import Steps from '@site/src/components/Steps'; -A well-designed application can run in multiple environments. Its configuration is not hard-coded in the source code, but instead extracted and allowed to be adjustable appropriately for different situations. -Although apps run the same code, they may use different, environment-specific configuration. +Sometimes you need to pass data to your application. E.g: API key, credentials, debug parameters. For this reason, Qovery allows you to +securely pass your data by using *Environment Variables*. -For example, your application may use a different instance of database on your machine than in a production environment (thus, database credentials and addresses should be configurable). + -For this reason, Qovery allows you to store your configurations and credentials securely using `Environment Variables`. +Do you need to keep secure your environment variable? Use [Secret][docs.using-qovery.configuration.secret] instead of **Environment +Variable**. + + -## Set variables - -Let's first create a new Node.js application that uses environment variables. - - - +## Tutorial -1. In an empty directory, create `.qovery.yml` - Qovery configuration file with the following content: +Here is an example on how to pass an environment variable to a NodeJS app. - ```yml title=".qovery.yml" - application: - name: node-app - project: environment-variables-demo - publicly_accessible: true - routers: - - name: main - routes: - - application_name: node-app - paths: - - /* - ``` + -2. Create `app.js` file - a simple Node.js HTTP server application: +Steps are similar for Secrets. - ```javascript title="app.js" {6,11} - const http = require('http'); + - const hostname = '0.0.0.0'; - const port = 3333; - - const MY_MESSAGE = process.env.MY_MESSAGE - - const server = http.createServer((req, res) => { - res.statusCode = 200; - res.setHeader('Content-Type', 'text/plain'); - res.end(MY_MESSAGE); - }); - - server.listen(port, hostname, () => { - console.log(`Server running at http://${hostname}:${port}/`); - }); - ``` - - As you see, in the first highlighted line the app uses process.env.`MY_MESSAGE` environment variable to set a value of a property in the application. - Then, in the second highlighted line, the application sends the value of previously set property back to the user that hits the server. - -3. And the last step to finish our application - create a `Dockerfile` with the following content: - - ```dockerfile title="Dockerfile" - FROM node - COPY app.js . - EXPOSE 3333 - CMD [ "node", "app.js" ] - ``` - - - -Now, initialize a Git repository in this directory and publish it to your Github. After it's done, your app should be deployed quickly: - -```bash title="Check app status" -qovery status -``` - -```plain title="OUTPUT" -BRANCH NAME | STATUS | ENDPOINTS | APPLICATIONS | DATABASES -master | running | https://main-im6qagd2nmnrfqax-gtw.qovery.io | node-app | none - -APPLICATION NAME | STATUS | ENDPOINT | DATABASES -node-app | running | | none -``` - -When you hit the application endpoint (using `curl` or your browser), you'll see an empty response: - -```bash title="Invoke application endpoint" -$ curl https://main-im6qagd2nmnrfqax-gtw.qovery.io -``` - -```bash title="OUTPUT" -``` - -Why is that? That's because... we did not set `MY_MESSAGE` environment variable that we use in our application. - -Let's fix it quickly. Run: - -```bash title="Add MY_MESSQGE variable" -qovery application env add MY_MESSAGE "Hello World from Qovery!" -``` - -Now, our variable is set. To check it: - -```bash title="List env variables" -qovery application env list -``` - -```title="OUTPUT" - SCOPE | KEY | VALUE - BUILT_IN | QOVERY_JSON_B64 | - BUILT_IN | QOVERY_BRANCH_NAME | master - BUILT_IN | QOVERY_IS_PRODUCTION | true - BUILT_IN | QOVERY_APPLICATION_NODE_APP_HOSTNAME | - APPLICATION | MY_MESSAGE | Hello World from Qovery! -``` - -After adding a new variable, we have to restart our application to make it able to read the new configuration: - -```bash title="Redeploy an application" -qovery redeploy -``` - -Your application should be back up shortly after redeployment. You can track the status using `qovery status` command. After it's running again, test the app's endpoint: - -```bash title="Invoke application endpoint" -$ curl https://main-im6qagd2nmnrfqax-gtw.qovery.io -``` - -```bash title="OUTPUT" -Hello World from Qovery! -``` - -Great! The env variable was read by the application correctly and returned to the user. - -## Configure database - -Now, we would like to use a database in our application. How to get its connection data, like connection URI, password, and username? - -Let's first add a database to our app: - -```yml title=".qovery.yml" {6-9} -application: - name: node-app - project: environment-variables-demo - publicly_accessible: true -databases: -- type: mongodb - version: "3.6" - name: my-mongo -routers: -- name: main - routes: - - application_name: node-app - paths: - - /* -``` +Let's first create a new Node.js application that uses environment variables. -Add the highlighted part to your Qovery config, commit and push. Voila! In a few minutes, our MongoDB instance is available to the application. To track this process, run `qovery status`. - -After the database is deployed, we need to know a few details about it to use it in the application. - -To get the details, run `qovery application env list` one more time: - -```title="OUTPUT" -SCOPE | KEY | VALUE -BUILT_IN | QOVERY_JSON_B64 | -BUILT_IN | QOVERY_BRANCH_NAME | master -BUILT_IN | QOVERY_IS_PRODUCTION | true -BUILT_IN | QOVERY_APPLICATION_NODE_APP_HOSTNAME | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_DATABASE | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_PASSWORD | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_USERNAME | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_PORT | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_FQDN | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_HOST | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_CONNECTION_URI_WITHOUT_CREDENTIALS | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_CONNECTION_URI | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_VERSION | 3.6 -BUILT_IN | QOVERY_DATABASE_MY_MONGO_TYPE | MONGODB -BUILT_IN | QOVERY_DATABASE_MY_MONGO_NAME | my-mongo -APPLICATION | MY_MESSAGE | Hello World from Qovery! -``` + -Adding a new database resulted in new environment variables available for the application! To display hidden values, add `-c` flag to the command -> `qovery application env list -c`. +
      -Now, we could just read `QOVERY_DATABASE_MY_MONGO_CONNECTION_URI` env variable in our app to get the connection URI to MongoDB. This approach would work and is completely fine, but what if we have chosen a different name for database URI? -If we need a value of one of `BUILT_IN` variables (like Qovery database credentials), but we want to use our own env variable names like, for example, `MONGO_URI`, then we can create an alias. +
    1. -Let's see it in action: +### Create an environment variable -```bash title="Create variable alias" -qovery application env add MONGO_URI '$QOVERY_DATABASE_MY_MONGO_CONNECTION_URI' -``` +Let's say that we pass an environment variable `ENABLE_DEBUG` that turns on the debug info from the app. -After running the command from above, we should see a new env variable added with the value of `QOVERY_DATABASE_MY_MONGO_CONNECTION_URI`: +Click on the `environment variables` tab inside your app view. -```bash title="List variables" -qovery application env list -``` +

      + List environment variables +

      -```bash title="OUTPUT" -SCOPE | KEY | VALUE -BUILT_IN | QOVERY_JSON_B64 | -BUILT_IN | QOVERY_BRANCH_NAME | master -BUILT_IN | QOVERY_IS_PRODUCTION | true -BUILT_IN | QOVERY_APPLICATION_NODE_APP_HOSTNAME | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_DATABASE | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_PASSWORD | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_USERNAME | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_PORT | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_FQDN | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_HOST | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_CONNECTION_URI_WITHOUT_CREDENTIALS | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_CONNECTION_URI | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_VERSION | 3.6 -BUILT_IN | QOVERY_DATABASE_MY_MONGO_TYPE | MONGODB -BUILT_IN | QOVERY_DATABASE_MY_MONGO_NAME | my-mongo -APPLICATION | MONGO_URI | -APPLICATION | MY_MESSAGE | Hello World from Qovery! -``` +Click on "create", and then add the `ENABLE_DEBUG` variable with a boolean value. -Above, you can see that the env was added. Run the same command with `-c` flag to see that its value is in fact the same as `QOVERY_DATABASE_MY_MONGO_CONNECTION_URI`. +

      + Create environment variable +

      -Now, we can use `MONGO_URI` environment variable to connect our application to MongoDB! +
    2. -## Update variable +
    3. -What if we would like to change the message our app returns to the user? To change the value of `MY_MESSAGE` env variable, simply run: +### Use the environment variable in the app -```bash title="Update variable" -qovery application env add MY_MESSAGE "Completely new message!" -``` +Create `app.js` file - a simple Node.js HTTP server application: -Adding env variable with the same name shadows previously set value. +```javascript title="app.js" {6-10} +const http = require('http'); -## Delete variable +const hostname = '0.0.0.0'; +const port = 3333; -If for some reason you would like to delete variable completely, you can run: +const enableDebug = process.env.ENABLE_DEBUG -```bash title="Delete variable" -qovery application env delete MY_MESSAGE -``` +if (enableDebug) { + console.log("debug mode enabled"); +} -That's all; it's gone. +const server = http.createServer((req, res) => { + res.statusCode = 200; + res.setHeader('Content-Type', 'text/plain'); + res.end("hello world"); +}); -## Scopes of variables - -So far, we have used just one branch (environment) and only one env variable scope (`application` scope). - -To see what it means, run: - -```bash title="Create a new branch" -git checkout -b another_branch -git push --set-upstream origin another_branch +server.listen(port, hostname, () => { + console.log(`Server running at http://${hostname}:${port}/`); +}); ``` -Now, as we use a different Git branch, we are in a different environment. - -Run `qovery application env list`. What do you see? Env variables we set previously are gone. That's because they were bound to the `application` scope. +As you can see, to get access to your environment variable you just need to use process.env.`ENABLE_DEBUG`. Environment variables are +injected at the build and run time. -On Qovery, we have a few levels of environment variables. `BUILT_IN` variables are automatically created and injected by Qovery. -`APPLICATION` variables are bound to *single application in one environment* (Git branch). `ENVIRONMENT` scope variables are bound to the environment, -so they're accessible by all applications in a given environment. The last scope - `PROJECT` scope - makes a given variable accessible everywhere (all apps, all environments). +
    4. -To select the scope of variables that you are adding/removing/listing, use the CLI as follows: +
    -```bash title="Env variables scopes" -qovery application env list -qovery project env list -qovery environment env list -``` - -The general pattern of this command is `qovery SCOPE env COMMAND`. +
    +This guide was an introduction on how to use the Environment Variables. To know more +about [Environment Variables][docs.using-qovery.configuration.environment-variable] and [Secrets][docs.using-qovery.configuration.secret], +go to our [detailed documentation][docs.using-qovery.configuration]. +[docs.using-qovery.configuration.environment-variable]: /docs/using-qovery/configuration/environment-variable/ +[docs.using-qovery.configuration.secret]: /docs/using-qovery/configuration/secret/ +[docs.using-qovery.configuration]: /docs/using-qovery/configuration/ diff --git a/website/guides/getting-started/managing-environment-variables.md.erb b/website/guides/getting-started/managing-environment-variables.md.erb index 4e21e65dad..186cf293e6 100644 --- a/website/guides/getting-started/managing-environment-variables.md.erb +++ b/website/guides/getting-started/managing-environment-variables.md.erb @@ -3,275 +3,95 @@ $schema: "/.meta/.schemas/guides.json" title: Environment variables description: How to manage environment variables in your projects and applications series_position: 4 -author_github: https://github.com/pjeziorowski +author_github: https://github.com/evoxmusic tags: ["type: guide"] --- import Steps from '@site/src/components/Steps'; -A well-designed application can run in multiple environments. Its configuration is not hard-coded in the source code, but instead extracted and allowed to be adjustable appropriately for different situations. -Although apps run the same code, they may use different, environment-specific configuration. +Sometimes you need to pass data to your application. E.g: API key, credentials, debug parameters. For this reason, Qovery allows you to +securely pass your data by using *Environment Variables*. -For example, your application may use a different instance of database on your machine than in a production environment (thus, database credentials and addresses should be configurable). + -For this reason, Qovery allows you to store your configurations and credentials securely using `Environment Variables`. +Do you need to keep secure your environment variable? Use [Secret][docs.using-qovery.configuration.secret] instead of **Environment +Variable**. -## Set variables + -Let's first create a new Node.js application that uses environment variables. - - - - -1. In an empty directory, create `.qovery.yml` - Qovery configuration file with the following content: - - ```yml title=".qovery.yml" - application: - name: node-app - project: environment-variables-demo - publicly_accessible: true - routers: - - name: main - routes: - - application_name: node-app - paths: - - /* - ``` - -2. Create `app.js` file - a simple Node.js HTTP server application: - - ```javascript title="app.js" {6,11} - const http = require('http'); - - const hostname = '0.0.0.0'; - const port = 3333; - - const MY_MESSAGE = process.env.MY_MESSAGE - - const server = http.createServer((req, res) => { - res.statusCode = 200; - res.setHeader('Content-Type', 'text/plain'); - res.end(MY_MESSAGE); - }); - - server.listen(port, hostname, () => { - console.log(`Server running at http://${hostname}:${port}/`); - }); - ``` - - As you see, in the first highlighted line the app uses process.env.`MY_MESSAGE` environment variable to set a value of a property in the application. - Then, in the second highlighted line, the application sends the value of previously set property back to the user that hits the server. - -3. And the last step to finish our application - create a `Dockerfile` with the following content: - - ```dockerfile title="Dockerfile" - FROM node - COPY app.js . - EXPOSE 3333 - CMD [ "node", "app.js" ] - ``` - - - -Now, initialize a Git repository in this directory and publish it to your Github. After it's done, your app should be deployed quickly: - -```bash title="Check app status" -qovery status -``` - -```plain title="OUTPUT" -BRANCH NAME | STATUS | ENDPOINTS | APPLICATIONS | DATABASES -master | running | https://main-im6qagd2nmnrfqax-gtw.qovery.io | node-app | none - -APPLICATION NAME | STATUS | ENDPOINT | DATABASES -node-app | running | | none -``` - -When you hit the application endpoint (using `curl` or your browser), you'll see an empty response: - -```bash title="Invoke application endpoint" -$ curl https://main-im6qagd2nmnrfqax-gtw.qovery.io -``` - -```bash title="OUTPUT" -``` +## Tutorial -Why is that? That's because... we did not set `MY_MESSAGE` environment variable that we use in our application. +Here is an example on how to pass an environment variable to a NodeJS app. -Let's fix it quickly. Run: + -```bash title="Add MY_MESSQGE variable" -qovery application env add MY_MESSAGE "Hello World from Qovery!" -``` - -Now, our variable is set. To check it: - -```bash title="List env variables" -qovery application env list -``` - -```title="OUTPUT" - SCOPE | KEY | VALUE - BUILT_IN | QOVERY_JSON_B64 | - BUILT_IN | QOVERY_BRANCH_NAME | master - BUILT_IN | QOVERY_IS_PRODUCTION | true - BUILT_IN | QOVERY_APPLICATION_NODE_APP_HOSTNAME | - APPLICATION | MY_MESSAGE | Hello World from Qovery! -``` - -After adding a new variable, we have to restart our application to make it able to read the new configuration: - -```bash title="Redeploy an application" -qovery redeploy -``` - -Your application should be back up shortly after redeployment. You can track the status using `qovery status` command. After it's running again, test the app's endpoint: - -```bash title="Invoke application endpoint" -$ curl https://main-im6qagd2nmnrfqax-gtw.qovery.io -``` - -```bash title="OUTPUT" -Hello World from Qovery! -``` +Steps are similar for Secrets. -Great! The env variable was read by the application correctly and returned to the user. - -## Configure database - -Now, we would like to use a database in our application. How to get its connection data, like connection URI, password, and username? - -Let's first add a database to our app: - -```yml title=".qovery.yml" {6-9} -application: - name: node-app - project: environment-variables-demo - publicly_accessible: true -databases: -- type: mongodb - version: "3.6" - name: my-mongo -routers: -- name: main - routes: - - application_name: node-app - paths: - - /* -``` - -Add the highlighted part to your Qovery config, commit and push. Voila! In a few minutes, our MongoDB instance is available to the application. To track this process, run `qovery status`. - -After the database is deployed, we need to know a few details about it to use it in the application. - -To get the details, run `qovery application env list` one more time: - -```title="OUTPUT" -SCOPE | KEY | VALUE -BUILT_IN | QOVERY_JSON_B64 | -BUILT_IN | QOVERY_BRANCH_NAME | master -BUILT_IN | QOVERY_IS_PRODUCTION | true -BUILT_IN | QOVERY_APPLICATION_NODE_APP_HOSTNAME | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_DATABASE | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_PASSWORD | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_USERNAME | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_PORT | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_FQDN | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_HOST | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_CONNECTION_URI_WITHOUT_CREDENTIALS | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_CONNECTION_URI | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_VERSION | 3.6 -BUILT_IN | QOVERY_DATABASE_MY_MONGO_TYPE | MONGODB -BUILT_IN | QOVERY_DATABASE_MY_MONGO_NAME | my-mongo -APPLICATION | MY_MESSAGE | Hello World from Qovery! -``` - -Adding a new database resulted in new environment variables available for the application! To display hidden values, add `-c` flag to the command -> `qovery application env list -c`. + -Now, we could just read `QOVERY_DATABASE_MY_MONGO_CONNECTION_URI` env variable in our app to get the connection URI to MongoDB. This approach would work and is completely fine, but what if we have chosen a different name for database URI? -If we need a value of one of `BUILT_IN` variables (like Qovery database credentials), but we want to use our own env variable names like, for example, `MONGO_URI`, then we can create an alias. +Let's first create a new Node.js application that uses environment variables. -Let's see it in action: + -```bash title="Create variable alias" -qovery application env add MONGO_URI '$QOVERY_DATABASE_MY_MONGO_CONNECTION_URI' -``` +
      -After running the command from above, we should see a new env variable added with the value of `QOVERY_DATABASE_MY_MONGO_CONNECTION_URI`: +
    1. -```bash title="List variables" -qovery application env list -``` +### Create an environment variable -```bash title="OUTPUT" -SCOPE | KEY | VALUE -BUILT_IN | QOVERY_JSON_B64 | -BUILT_IN | QOVERY_BRANCH_NAME | master -BUILT_IN | QOVERY_IS_PRODUCTION | true -BUILT_IN | QOVERY_APPLICATION_NODE_APP_HOSTNAME | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_DATABASE | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_PASSWORD | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_USERNAME | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_PORT | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_FQDN | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_HOST | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_CONNECTION_URI_WITHOUT_CREDENTIALS | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_CONNECTION_URI | -BUILT_IN | QOVERY_DATABASE_MY_MONGO_VERSION | 3.6 -BUILT_IN | QOVERY_DATABASE_MY_MONGO_TYPE | MONGODB -BUILT_IN | QOVERY_DATABASE_MY_MONGO_NAME | my-mongo -APPLICATION | MONGO_URI | -APPLICATION | MY_MESSAGE | Hello World from Qovery! -``` +Let's say that we pass an environment variable `ENABLE_DEBUG` that turns on the debug info from the app. -Above, you can see that the env was added. Run the same command with `-c` flag to see that its value is in fact the same as `QOVERY_DATABASE_MY_MONGO_CONNECTION_URI`. +Click on the `environment variables` tab inside your app view. -Now, we can use `MONGO_URI` environment variable to connect our application to MongoDB! +

      + List environment variables +

      -## Update variable +Click on "create", and then add the `ENABLE_DEBUG` variable with a boolean value. -What if we would like to change the message our app returns to the user? To change the value of `MY_MESSAGE` env variable, simply run: +

      + Create environment variable +

      -```bash title="Update variable" -qovery application env add MY_MESSAGE "Completely new message!" -``` +
    2. -Adding env variable with the same name shadows previously set value. +
    3. -## Delete variable +### Use the environment variable in the app -If for some reason you would like to delete variable completely, you can run: +Create `app.js` file - a simple Node.js HTTP server application: -```bash title="Delete variable" -qovery application env delete MY_MESSAGE -``` +```javascript title="app.js" {6-10} +const http = require('http'); -That's all; it's gone. +const hostname = '0.0.0.0'; +const port = 3333; -## Scopes of variables +const enableDebug = process.env.ENABLE_DEBUG -So far, we have used just one branch (environment) and only one env variable scope (`application` scope). +if (enableDebug) { + console.log("debug mode enabled"); +} -To see what it means, run: +const server = http.createServer((req, res) => { + res.statusCode = 200; + res.setHeader('Content-Type', 'text/plain'); + res.end("hello world"); +}); -```bash title="Create a new branch" -git checkout -b another_branch -git push --set-upstream origin another_branch +server.listen(port, hostname, () => { + console.log(`Server running at http://${hostname}:${port}/`); +}); ``` -Now, as we use a different Git branch, we are in a different environment. +As you can see, to get access to your environment variable you just need to use process.env.`ENABLE_DEBUG`. Environment variables are +injected at the build and run time. -Run `qovery application env list`. What do you see? Env variables we set previously are gone. That's because they were bound to the `application` scope. +
    4. -On Qovery, we have a few levels of environment variables. `BUILT_IN` variables are automatically created and injected by Qovery. -`APPLICATION` variables are bound to *single application in one environment* (Git branch). `ENVIRONMENT` scope variables are bound to the environment, -so they're accessible by all applications in a given environment. The last scope - `PROJECT` scope - makes a given variable accessible everywhere (all apps, all environments). +
    -To select the scope of variables that you are adding/removing/listing, use the CLI as follows: - -```bash title="Env variables scopes" -qovery application env list -qovery project env list -qovery environment env list -``` +
    -The general pattern of this command is `qovery SCOPE env COMMAND`. +This guide was an introduction on how to use the Environment Variables. To know more +about [Environment Variables][docs.using-qovery.configuration.environment-variable] and [Secrets][docs.using-qovery.configuration.secret], +go to our [detailed documentation][docs.using-qovery.configuration]. diff --git a/website/guides/tutorial/how-to-deploy-your-application-on-aws-in-30-minutes.md b/website/guides/tutorial/how-to-deploy-your-application-on-aws-in-30-minutes.md index 2e32c2b6c6..9cb77ac222 100644 --- a/website/guides/tutorial/how-to-deploy-your-application-on-aws-in-30-minutes.md +++ b/website/guides/tutorial/how-to-deploy-your-application-on-aws-in-30-minutes.md @@ -1,5 +1,5 @@ --- -last_modified_on: "2021-06-19" +last_modified_on: "2021-06-24" $schema: "/.meta/.schemas/guides.json" title: Zero to Hero - How to deploy your app on AWS in 30 minutes description: Step-by-step guide on how to deploy your app on AWS in 30 minutes. No AWS knowledge required. @@ -152,7 +152,7 @@ Your app is deployed and ready to be used by your users. And all of that from yo If you need to add another app to your project, you just need to repeat the latest steps 😎. ## What's next -Now you can see how you can [add a database][guides.getting-started.adding-a-database] to your app or [set up your domain][guides.getting-started.setting-custom-domain]. +Now you can see how you can [add a database][guides.getting-started.create-a-database] to your app or [set up your domain][guides.getting-started.setting-custom-domain]. Add a database Set up your domain @@ -163,7 +163,7 @@ Now you can see how you can [add a database][guides.getting-started.adding-a-dat [docs.using-qovery.configuration.environment]: /docs/using-qovery/configuration/environment/ [docs.using-qovery.configuration.organization]: /docs/using-qovery/configuration/organization/ [docs.using-qovery.configuration.project]: /docs/using-qovery/configuration/project/ -[guides.getting-started.adding-a-database]: /guides/getting-started/adding-a-database/ +[guides.getting-started.create-a-database]: /guides/getting-started/create-a-database/ [guides.getting-started.setting-custom-domain]: /guides/getting-started/setting-custom-domain/ [urls.qovery]: https://www.qovery.com [urls.qovery_chat]: https://discord.qovery.com diff --git a/website/guides/tutorial/how-to-deploy-your-application-on-aws-in-30-minutes.md.erb b/website/guides/tutorial/how-to-deploy-your-application-on-aws-in-30-minutes.md.erb index 124f9b8a96..7123ea2dd8 100644 --- a/website/guides/tutorial/how-to-deploy-your-application-on-aws-in-30-minutes.md.erb +++ b/website/guides/tutorial/how-to-deploy-your-application-on-aws-in-30-minutes.md.erb @@ -143,7 +143,7 @@ Your app is deployed and ready to be used by your users. And all of that from yo If you need to add another app to your project, you just need to repeat the latest steps 😎. ## What's next -Now you can see how you can [add a database][guides.getting-started.adding-a-database] to your app or [set up your domain][guides.getting-started.setting-custom-domain]. +Now you can see how you can [add a database][guides.getting-started.create-a-database] to your app or [set up your domain][guides.getting-started.setting-custom-domain]. Add a database Set up your domain diff --git a/website/metadata.js b/website/metadata.js index 31d093912a..2fdc7104f9 100644 --- a/website/metadata.js +++ b/website/metadata.js @@ -92,16 +92,16 @@ module.exports = { "getting-started": { "children": { }, - "description": "Take Qovery from zero to production in under 10 minutes.", + "description": "Take Qovery from zero to production in less than 10 minutes.", "guides": [ { "author_github": "https://github.com/evoxmusic", "description": null, - "id": "/getting-started/adding-a-database", + "id": "/getting-started/create-a-database", "last_modified_on": null, - "path": "website/guides/getting-started/adding-a-database.md", + "path": "website/guides/getting-started/create-a-database.md", "series_position": null, - "title": "Adding a database" + "title": "Create a database" }, { "author_github": "https://github.com/evoxmusic", @@ -122,7 +122,7 @@ module.exports = { "title": "Debugging" }, { - "author_github": "https://github.com/pjeziorowski", + "author_github": "https://github.com/evoxmusic", "description": null, "id": "/getting-started/managing-environment-variables", "last_modified_on": null, @@ -152,24 +152,51 @@ module.exports = { { "author_github": "https://github.com/evoxmusic", "description": null, - "id": "/advanced/custom-routes", + "id": "/advanced/amazon-web-services", "last_modified_on": null, - "path": "website/guides/advanced/custom-routes.md", + "path": "website/guides/advanced/amazon-web-services.md", "series_position": null, - "title": "Custom routes" + "title": "Deploy your apps on your AWS account" }, { - "author_github": "https://github.com/pjeziorowski", + "author_github": "https://github.com/evoxmusic", + "description": null, + "id": "/advanced/digital-ocean", + "last_modified_on": null, + "path": "website/guides/advanced/digital-ocean.md", + "series_position": null, + "title": "Deploy your apps on your Digital Ocean account" + }, + { + "author_github": "https://github.com/evoxmusic", + "description": null, + "id": "/advanced/microservices", + "last_modified_on": null, + "path": "website/guides/advanced/microservices.md", + "series_position": null, + "title": "Microservices" + }, + { + "author_github": "https://github.com/evoxmusic", + "description": null, + "id": "/advanced/monorepository", + "last_modified_on": null, + "path": "website/guides/advanced/monorepository.md", + "series_position": null, + "title": "Mono repository" + }, + { + "author_github": "https://github.com/evoxmusic", "description": null, - "id": "/advanced/using-multiple-environments", + "id": "/advanced/staging-environment", "last_modified_on": null, - "path": "website/guides/advanced/using-multiple-environments.md", + "path": "website/guides/advanced/staging-environment.md", "series_position": null, - "title": "Multiple environments" + "title": "Staging environment" } ], "name": "advanced", - "series": false, + "series": true, "title": "Advanced" }, "tutorial": { diff --git a/website/plugins/guides/guideUtils.ts b/website/plugins/guides/guideUtils.ts index 4c3d33fcc4..566b4eaf27 100644 --- a/website/plugins/guides/guideUtils.ts +++ b/website/plugins/guides/guideUtils.ts @@ -59,7 +59,7 @@ export async function generateGuides( break; case 'getting-started': - description = 'Take Qovery from zero to production in under 10 minutes.'; + description = 'Take Qovery from zero to production in less than 10 minutes.'; break; case 'integrate': diff --git a/website/sidebars.js b/website/sidebars.js index 6e26cbdd43..39f7644831 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -63,7 +63,6 @@ module.exports = { "using-qovery/configuration/secret", "using-qovery/configuration/domain", "using-qovery/configuration/storage", - "using-qovery/configuration/routing", "using-qovery/configuration/deployment-rule", { type: 'category', diff --git a/website/sidebars.js.erb b/website/sidebars.js.erb index 1acaf27bcc..3730fb1a0d 100644 --- a/website/sidebars.js.erb +++ b/website/sidebars.js.erb @@ -63,7 +63,6 @@ module.exports = { <%= metadata.links.fetch_id("docs.using-qovery.configuration.secret").to_json %>, <%= metadata.links.fetch_id("docs.using-qovery.configuration.domain").to_json %>, <%= metadata.links.fetch_id("docs.using-qovery.configuration.storage").to_json %>, - <%= metadata.links.fetch_id("docs.using-qovery.configuration.routing").to_json %>, <%= metadata.links.fetch_id("docs.using-qovery.configuration.deployment-rule").to_json %>, { type: 'category', diff --git a/website/static/img/create_environment_variable.png b/website/static/img/create_environment_variable.png new file mode 100644 index 0000000000..677cb393c3 Binary files /dev/null and b/website/static/img/create_environment_variable.png differ diff --git a/website/static/img/environment_variables.png b/website/static/img/environment_variables.png new file mode 100644 index 0000000000..66ac63fe9d Binary files /dev/null and b/website/static/img/environment_variables.png differ