Code Monkey home page Code Monkey logo

press's Introduction

Press

codecov unittests

This is press, a Frappe custom app that runs Frappe Cloud. This app manages infrastructure, subscription, marketplace, SaaS and much more.

press: "I have a brother, without which I cannot live, agent"

The other half of the Frappe Cloud infrastructure is agent. Which is a flask application that runs on every server in a typical cluster and carries out tasks on HTTP requests. Creating a new site, installing an app, updating a site, creating a bench and everything in between is just a request (Agent Job) away.

Note that, this README is in a very early WIP state and only covers a tiny bit of FC. More to come!

Typical FC Cluster

FC Cluster Diagram

Prerequisites

Local Setup

You can find a detailed walkthough for setting up a local FC cluster here.

Some Core DocTypes

  • Server
  • Database Server
  • Proxy Server
  • Site
  • Release Group
  • Deploy Candidate
  • Bench
  • App
  • App Source
  • App Release
  • TLS Certificate

The Front-end

You can read more about the VueJS frontend for Frappe Cloud here.

Contributing

Journey of a thousand PRs begins with a single typo fix!

You can contribute in many ways, some of which are:

  1. Reporting Issues: If you find a bug, typo etc. Feel free to raise an issue and we will take it from there.

  2. Feature PRs: You can start by creating an issue with a feature proposal, we can discuss whether we should go ahead with it or not.

  3. Give us a star!

  4. Documentation

License

GNU Affero General Public License v3.0

press's People

Contributors

18alantom avatar adityahase avatar ankush avatar athul avatar balamurali27 avatar breadgenie avatar deepeshgarg007 avatar dependabot[bot] avatar faisal-zahoor avatar gavindsouza avatar kamaljohnson avatar michellealva avatar mohsinalimat avatar nabinhait avatar nagariahussain avatar netchampfaris avatar nextchamp-saqib avatar nk521 avatar rijulchaturvedi avatar rutwikhdev avatar sagarvora avatar saurabh6790 avatar shadrak98 avatar shadyskies avatar ssiyad avatar tanmoysrt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

press's Issues

2nd Iteration: Migrating to `frappe-ui`

Most of the core components were migrated to frappe-ui in #447, but here is a TODO list for the things yet to be covered:

  • Dropdown
  • on-outside-click
  • Broken search keyboard interaction (2317fa4)
  • New Resource Manager

Site backup flaky test


Traceback (most recent call last):
1054  File "/opt/python/3.10.4/lib/python3.10/unittest/mock.py", line 1369, in patched
1055    return func(*newargs, **newkeywargs)
1056  File "/home/travis/frappe-bench/apps/press/press/tests/test_cleanup.py", line 362, in test_local_backups_with_different_bench_configs_expire_sites
1057    self.assertEqual(backup_1_1.files_availability, "Available")
1058AssertionError: 'Unavailable' != 'Available'
1059- Unavailable
1060? ^^^
1061+ Available
1062? ^

Refer (travis run log): Traceback (most recent call last): https://app.travis-ci.com/github/frappe/press/builds/255007410

As far as I have noticed, it starts failing at around the end of a month and keeps randomly failing till the end of first week.

Support for multiple code hosting platforms

Currently, only projects/apps hosted on GitHub can be fetched on Frappecloud. It would be great to have support for other popular hosting platforms such as Bitbucket and GitLab.

removing rows from child table while iterating over it

def validate_items(self):
for row in self.items:
if row.quantity == 0:
self.remove(row)

def cancel_applied_credits(self):
for row in self.credit_allocations:
doc = frappe.get_doc(
doctype="Balance Transaction",
type="Adjustment",
source=row.source,
team=self.team,
amount=row.amount,
description=(
f"Reverse amount {row.get_formatted('amount')} of {row.transaction}"
f" from invoice {self.name}"
),
).insert()
doc.submit()
self.remove(row)

Error when install-app press

Error when install press in my mac air m1 on local.

  1. Error using dockerfile=3.1.0 in file frappepress/apps/press/requirements.txt, just using the latest version will solve this problem in my mac,

  2. Error for default value "0" in time() type in file
    .../apps/press/press/press/doctype/deploy_candidate/deploy_candidate.json
    ...{ "default": "0", "fieldname": "build_duration", "fieldtype": "Time", "label": "Build Duration", "read_only": 1 },...

  3. Column "enable" does not exist in file
    .../apps/press/press/press/doctype/site_config_key_blacklist/site_config_key_blacklist.py
    if frappe.db.exists("Site Config Key", {"key": self.key, "enabled": True}):

it's solve by custom or manual edited code, but in this case i think is good for update to the master branch. Thank you.

[Critical] Stripe Payment Failed (with traceback)

image

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 67, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 54, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 38, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 76, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1503, in call
    return fn(*args, **newargs)
  File "apps/press/press/api/billing.py", line 202, in create_payment_intent_for_buying_credits
    intent = stripe.PaymentIntent.create(
  File "env/lib/python3.8/site-packages/stripe/api_resources/abstract/createable_api_resource.py", line 22, in create
    response, api_key = requestor.request("post", url, params, headers)
  File "env/lib/python3.8/site-packages/stripe/api_requestor.py", line 122, in request
    resp = self.interpret_response(rbody, rcode, rheaders)
  File "env/lib/python3.8/site-packages/stripe/api_requestor.py", line 373, in interpret_response
    self.handle_error_response(rbody, rcode, resp.data, rheaders)
  File "env/lib/python3.8/site-packages/stripe/api_requestor.py", line 152, in handle_error_response
    raise err
stripe.error.InvalidRequestError: Request req_RBcy4LHk9dAHtm: Invalid integer: 4707.0

Update all sites from dashboard

Button to update all sites in a bench (optional) once the bench is updated. Currently, sites have to be updated manually one by one.

Show commit info for bench apps

Currently, commit info is displayed for site apps.

Screenshot 2022-04-21 at 10 59 57

We should do the same for bench apps too so that it would be easy to identify the current commit/state in the bench.

Screenshot 2022-04-21 at 11 00 07

Server UI

  • Ability to add a new server - with size
  • Ability to view benches in a server
  • Ability to resize server

Merge SAAS and FC dashboards

Add a sidebar with:

  • Sites
  • Benches
  • Servers
  • My Apps (Developer)
  • Profile & Team
  • Billing

Chore Tasks:

  • Users should not be allowed to uninstall the limits/billing app from SaaS sites
  • (multi-saas) The Add App window should show some tag and confirmation dialog while installing another SaaS app

Site dashboard state is not updated once loaded.

It seems, a site dashboard keeps it's initial state once it's loaded. It doesn't correspond with the state displayed in "site list view".

Steps to reproduce

  1. Restore an existing site.
  2. Go back to frappe home page (without refreshing page)

List View
image

Dashboard
image

Subscription module

  • Plan
    • Plan Name
    • Stripe Plan Id
    • Applicable To: Site / Account (Flag)
    • Multiplier based on currencies
    • Expiry (720 hrs) default
  • Stripe API's
    • create customer
    • create subscription
    • update usage to subscription (daily basis)
  • Subscription (setup record on a monthly basis)
    • Site Name
    • Plan
    • Start Date
    • End Date
    • Amount
  • Transaction
    • User account
    • Amount
    • Stripe Subscription Id
    • Stripe Transaction Id
    • Site Table
      • Site Name
      • Total Usage
      • Cost
      • Stripe Plan Id
  • Bench Site
    • Plan (set usage limits)

Invoicing in Frappe Cloud and Frappe.io

  • Create invoices in Frappe Cloud
  • Create items in Frappe.io for each app
  • Have add-ons as separate items (only on renewals)
  • Include standard hosting with every plan
  • Add GST on top of the base plan for Indian customers
  • Sync invoices from FC to Frappe.io

Sort benches/sites by name?

In FC, there are 15+ benches and some benches have 10+ sites. Most of the time, I have to use browser's search to find a relevant bench/site.

Screenshot 2021-06-02 at 11 49 03

If the benches/sites are sorted by name, it will be much easier to navigate.

decent default vimrc

In an ideal world, no one would edit deployed code, but alas we don't live in ideal world ๐Ÿฅฒ

I'd suggest adding the following as default .vimrc so it's tolerable while reading/editing. Bad defaults lead to issues like: https://frappe.io/app/issue/ISS-21-22-14109

set nocompatible
syntax on

set shortmess+=I
set number
set laststatus=2
set backspace=indent,eol,start

" set hidden  " probably not required since we do small edits in single file

set ignorecase
set smartcase

set incsearch

nmap Q <Nop>

" clearly highlight current indentation
set list
set listchars=tab:\|\ ,


" frappe coding style
set noexpandtab
set shiftwidth=4
set ts=4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.