-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #185 from rtCamp/develop
Bump v0.14.0
- Loading branch information
Showing
26 changed files
with
864 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: E2E migration testing | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
branches: | ||
- main | ||
- develop | ||
workflow_dispatch: | ||
|
||
jobs: | ||
e2e-migration-from-0_9_0-to-latest: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
python-ver: ["3.11", "3.12"] | ||
os: [ubuntu-latest] | ||
# os: [self-hosted-arm64, ubuntu-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-ver }} | ||
|
||
- name: header | ||
run: | | ||
echo -e "\e[1;33m┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\e[0m | ||
\e[1;33m┃\e[0m \e[1;36m Migration from v0.9.0 to latest \e[0m \e[1;33m┃\e[0m | ||
\e[1;33m┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\e[0m" | ||
- name: install frappe from v0.9.0 | ||
run: | | ||
cd /tmp | ||
python -m pip install -U git+https://github.com/rtCamp/[email protected] | ||
- name: frappe version | ||
run: fm --version | ||
|
||
- name: e2e run | ||
timeout-minutes: 20 | ||
working-directory: test | ||
run: | | ||
./migration_test.sh oldToNew | ||
- name: cleanup | ||
if: always() | ||
run: | | ||
python -m pip uninstall -y frappe-manager | ||
sudo rm -rf ~/frappe | ||
e2e-migration-from-before_latest-to-latest: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
python-ver: ["3.11", "3.12"] | ||
os: [ubuntu-latest] | ||
# os: [self-hosted-arm64, ubuntu-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-ver }} | ||
|
||
- name: install jq | ||
run: | | ||
sudo apt upgrade -y | ||
sudo apt install -y jq curl | ||
- name: header | ||
run: | | ||
echo -e "\e[1;33m┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\e[0m | ||
\e[1;33m┃\e[0m \e[1;36m Migration from latest~1 to latest \e[0m \e[1;33m┃\e[0m | ||
\e[1;33m┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\e[0m" | ||
- name: install frappe previous the latest release | ||
run: | | ||
python -m pip install -U git+https://github.com/rtCamp/Frappe-Manager.git@$(curl --silent https://api.github.com/repos/rtCamp/Frappe-Manager/tags | jq -r '.[1].name') | ||
- name: frappe version | ||
run: fm --version | ||
|
||
- name: e2e run | ||
timeout-minutes: 30 | ||
working-directory: test | ||
run: | | ||
./migration_test.sh semiNewToNew | ||
- name: cleanup | ||
if: always() | ||
run: | | ||
python -m pip uninstall -y frappe-manager | ||
sudo rm -rf ~/frappe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: E2E site testing | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
branches: | ||
- main | ||
- develop | ||
workflow_dispatch: | ||
|
||
jobs: | ||
e2e-current: | ||
name: e2e current latest branch | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
python-ver: ["3.11", "3.12"] | ||
os: [ubuntu-latest] | ||
# os: [self-hosted-arm64, ubuntu-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-ver }} | ||
|
||
- name: header | ||
run: | | ||
echo -e "\e[1;33m┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\e[0m | ||
\e[1;33m┃\e[0m \e[1;36m E2E Test \e[0m \e[1;33m┃\e[0m | ||
\e[1;33m┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\e[0m" | ||
- name: install frappe from current commit | ||
run: | | ||
cd .. | ||
python -m pip install --upgrade ./Frappe-Manager | ||
- name: frappe version | ||
run: fm --version | ||
|
||
- name: e2e run | ||
timeout-minutes: 20 | ||
working-directory: test | ||
run: | | ||
./e2e_test.sh | ||
- name: cleanup | ||
if: always() | ||
run: | | ||
python -m pip uninstall -y frappe-manager | ||
sudo rm -rf ~/frappe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
from frappe_manager.migration_manager.migration_executor import MigrationExecutor | ||
from frappe_manager.site_manager.site import Bench | ||
from frappe_manager.site_manager.workers_manager.SiteWorker import BenchWorkers | ||
from frappe_manager.ssl_manager import SUPPORTED_SSL_TYPES | ||
from frappe_manager.ssl_manager import LETSENCRYPT_PREFERRED_CHALLENGE, SUPPORTED_SSL_TYPES | ||
from frappe_manager.ssl_manager.certificate import SSLCertificate | ||
from frappe_manager.ssl_manager.letsencrypt_certificate import LetsencryptSSLCertificate | ||
from frappe_manager.utils.callbacks import ( | ||
|
@@ -105,35 +105,38 @@ def app_callback( | |
|
||
fm_config_manager: FMConfigManager = FMConfigManager.import_from_toml() | ||
|
||
|
||
# docker pull | ||
if first_time_install: | ||
if not fm_config_manager.root_path.exists(): | ||
richprint.print('🔍 It seems like the first installation. Pulling images... 🖼️') | ||
richprint.print("It seems like the first installation. Pulling docker images...️", "🔍") | ||
|
||
completed_status = pull_docker_images() | ||
if not completed_status: | ||
shutil.rmtree(CLI_DIR) | ||
richprint.exit("Aborting. [bold][blue]fm[/blue][/bold] will not be able to work without images. 🖼️") | ||
|
||
current_version = Version(get_current_fm_version()) | ||
fm_config_manager.version = current_version | ||
fm_config_manager.export_to_toml() | ||
|
||
migrations = MigrationExecutor(fm_config_manager) | ||
migration_status = migrations.execute() | ||
|
||
if not migration_status: | ||
richprint.exit(f"Rollbacked to previous version of fm {migrations.prev_version}.") | ||
|
||
services_manager: ServicesManager = ServicesManager(verbose=verbose) | ||
services_manager.set_typer_context(ctx) | ||
|
||
services_manager.init() | ||
|
||
try: | ||
services_manager.entrypoint_checks() | ||
services_manager.entrypoint_checks(start=True) | ||
except ServicesNotCreated as e: | ||
services_manager.remove_itself() | ||
richprint.exit(f"Not able to create services. {e}") | ||
|
||
if not services_manager.compose_project.running: | ||
services_manager.are_ports_free() | ||
services_manager.compose_project.start_service() | ||
|
||
ctx.obj["services"] = services_manager | ||
ctx.obj["verbose"] = verbose | ||
ctx.obj['fm_config_manager'] = fm_config_manager | ||
|
@@ -156,6 +159,14 @@ def create( | |
environment: Annotated[ | ||
FMBenchEnvType, typer.Option("--environment", "--env", help="Select bench environment type.") | ||
] = FMBenchEnvType.dev, | ||
letsencrypt_preferred_challenge: Annotated[ | ||
Optional[LETSENCRYPT_PREFERRED_CHALLENGE], | ||
typer.Option(help="Select preferred letsencrypt challenge.", show_default=False), | ||
] = None, | ||
letsencrypt_email: Annotated[ | ||
Optional[str], | ||
typer.Option(help="Specify email for letsencrypt", show_default=False), | ||
] = None, | ||
developer_mode: Annotated[ | ||
EnableDisableOptionsEnum, typer.Option(help="Toggle frappe developer mode.") | ||
] = EnableDisableOptionsEnum.disable, | ||
|
@@ -205,18 +216,36 @@ def create( | |
bench_config_path = bench_path / CLI_BENCH_CONFIG_FILE_NAME | ||
|
||
if ssl == SUPPORTED_SSL_TYPES.le: | ||
if fm_config_manager.le_email == '[email protected]': | ||
email = richprint.prompt_ask(prompt='Please enter [bold][green]email[/bold][/green] for Let\'s Encrypt') | ||
if not letsencrypt_preferred_challenge: | ||
if fm_config_manager.letsencrypt.exists: | ||
if letsencrypt_preferred_challenge is None: | ||
letsencrypt_preferred_challenge = LETSENCRYPT_PREFERRED_CHALLENGE.dns01 | ||
|
||
if not letsencrypt_preferred_challenge: | ||
letsencrypt_preferred_challenge = LETSENCRYPT_PREFERRED_CHALLENGE.http01 | ||
|
||
if fm_config_manager.letsencrypt.email == '[email protected]' or fm_config_manager.letsencrypt.email is None: | ||
if not letsencrypt_email: | ||
richprint.stop() | ||
raise typer.BadParameter("No email provided, required by certbot.", param_hint='--letsencrypt-email') | ||
else: | ||
email = letsencrypt_email | ||
|
||
validate_email(email, check_deliverability=False) | ||
fm_config_manager.le_email = email | ||
fm_config_manager.export_to_toml() | ||
richprint.print("Let's Encrypt email saved to configuration. It will be used automatically from now on.") | ||
else: | ||
richprint.print("Using Let's Encrypt email from configuration.") | ||
email = fm_config_manager.le_email | ||
fm_config_manager.export_to_toml() | ||
|
||
ssl_certificate = LetsencryptSSLCertificate(domain=benchname, ssl_type=ssl, email=email) | ||
richprint.print( | ||
"Defaulting to Let's Encrypt email from [blue]fm_config.toml[/blue] since [blue]'--letsencrypt-email'[/blue] is not given." | ||
) | ||
email = fm_config_manager.letsencrypt.email | ||
|
||
ssl_certificate = LetsencryptSSLCertificate( | ||
domain=benchname, | ||
ssl_type=ssl, | ||
email=email, | ||
preferred_challenge=letsencrypt_preferred_challenge, | ||
api_key=fm_config_manager.letsencrypt.api_key, | ||
api_token=fm_config_manager.letsencrypt.api_token, | ||
) | ||
|
||
elif ssl == SUPPORTED_SSL_TYPES.none: | ||
ssl_certificate = SSLCertificate(domain=benchname, ssl_type=ssl) | ||
|
@@ -483,9 +512,17 @@ def update( | |
Optional[EnableDisableOptionsEnum], | ||
typer.Option("--admin-tools", help="Toggle admin-tools.", show_default=False), | ||
] = None, | ||
letsencrypt_preferred_challenge: Annotated[ | ||
Optional[LETSENCRYPT_PREFERRED_CHALLENGE], | ||
typer.Option(help="Select preferred letsencrypt challenge.", show_default=False), | ||
] = None, | ||
letsencrypt_email: Annotated[ | ||
Optional[str], | ||
typer.Option(help="Specify email for letsencrypt", show_default=False), | ||
] = None, | ||
environment: Annotated[ | ||
Optional[FMBenchEnvType], | ||
typer.Option("--environment", help="Switch bench environment.", show_default=False), | ||
typer.Option("--environment", "--env", help="Switch bench environment.", show_default=False), | ||
] = None, | ||
developer_mode: Annotated[ | ||
Optional[EnableDisableOptionsEnum], | ||
|
@@ -530,20 +567,38 @@ def update( | |
new_ssl_certificate = SSLCertificate(domain=benchname, ssl_type=SUPPORTED_SSL_TYPES.none) | ||
|
||
if ssl == SUPPORTED_SSL_TYPES.le: | ||
if fm_config_manager.le_email == '[email protected]': | ||
email = richprint.prompt_ask(prompt='Please enter [bold][green]email[/bold][/green] for Let\'s Encrypt') | ||
if not letsencrypt_preferred_challenge: | ||
if fm_config_manager.letsencrypt.exists: | ||
if letsencrypt_preferred_challenge is None: | ||
letsencrypt_preferred_challenge = LETSENCRYPT_PREFERRED_CHALLENGE.dns01 | ||
|
||
if not letsencrypt_preferred_challenge: | ||
letsencrypt_preferred_challenge = LETSENCRYPT_PREFERRED_CHALLENGE.http01 | ||
|
||
if fm_config_manager.letsencrypt.email == '[email protected]' or fm_config_manager.letsencrypt.email is None: | ||
if not letsencrypt_email: | ||
richprint.stop() | ||
raise typer.BadParameter( | ||
"No email provided, required by certbot.", param_hint='--letsencrypt-email' | ||
) | ||
else: | ||
email = letsencrypt_email | ||
|
||
validate_email(email, check_deliverability=False) | ||
fm_config_manager.le_email = email | ||
fm_config_manager.export_to_toml() | ||
else: | ||
richprint.print( | ||
"Let's Encrypt email saved to configuration. It will be used automatically from now on." | ||
"Defaulting to Let's Encrypt email from [blue]fm_config.toml[/blue] since [blue]'--letsencrypt-email'[/blue] is not given." | ||
) | ||
else: | ||
richprint.print("Using Let's Encrypt email from configuration.") | ||
email = fm_config_manager.le_email | ||
fm_config_manager.export_to_toml() | ||
|
||
new_ssl_certificate = LetsencryptSSLCertificate(domain=benchname, ssl_type=ssl, email=email) | ||
email = fm_config_manager.letsencrypt.email | ||
|
||
new_ssl_certificate = LetsencryptSSLCertificate( | ||
domain=benchname, | ||
ssl_type=ssl, | ||
email=email, | ||
preferred_challenge=letsencrypt_preferred_challenge, | ||
api_key=fm_config_manager.letsencrypt.api_key, | ||
api_token=fm_config_manager.letsencrypt.api_token, | ||
) | ||
|
||
richprint.print("Updating Certificate.") | ||
bench.update_certificate(new_ssl_certificate) | ||
|
Oops, something went wrong.