Skip to content

wzor/snapcraft.io

 
 

Repository files navigation

snapcraft.io

This is the new Flask application that will gradually replace the website at https://snapcraft.io, starting with the snap details page.

Local development

The simplest way to run the site locally is to first install Docker (on Linux you may need to add your user to the docker group), and then use the ./run script:

./run

Once the containers are setup, you can visit http://127.0.0.1:8004 in your browser.

Use staging APIs

To use staging APIs locally you can add the following lines to an .env.local file:

SNAPCRAFT_IO_API=https://api.staging.snapcraft.io/api/v1/
DASHBOARD_API=https://dashboard.staging.snapcraft.io/dev/api/
LOGIN_URL=https://login.staging.ubuntu.com

Using Sentry error tracker

For development purposes, visit https://sentry.io/signup/, signup and setup a project. By then you will have a sentry DSN string like:

https://<user>:<secret>@sentry.io/<project_id>

Create or update you .env.local file:

SENTRY_DSN=<DSN_FROM_ABOVE>

The application will be reporting errors to your sentry.io project from now on.

Building CSS

For working on Sass files, you may want to dynamically watch for changes to rebuild the CSS whenever something changes.

To setup the watcher, open a new terminal window and run:

./run watch

Testing

./run test

Status checks and prometheus metrics

Talisker provides a bunch of useful status checks and metrics about the running application. Some of this information is sensitive and so to access it you need to run the site with your IP address mentioned in the TALISKER_NETWORKS variable:

./run --env TALISKER_NETWORKS=172.16.0.0/12

Now visit http://127.0.0.1:8004/_status to see the endpoints provided by Talisker. Useful ones include:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 46.6%
  • HTML 21.2%
  • JavaScript 17.4%
  • CSS 9.4%
  • Shell 5.4%