Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump v0.15.0 #202

Merged
merged 54 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
41a4ba2
feat: added install script
dipankardas011 Apr 30, 2024
2822254
feat: added install readme
dipankardas011 Apr 30, 2024
6d39362
fix: missing yello info logging
dipankardas011 Apr 30, 2024
844e4b3
patch: added the upgrade of frappe pkg
dipankardas011 Apr 30, 2024
4d0748c
fix: added root check for macos
dipankardas011 Apr 30, 2024
c6273b7
patch: moved the root check
dipankardas011 Apr 30, 2024
3f5ec35
Merge pull request #171 from rtCamp/automation
Xieyt May 29, 2024
872a552
Add dynamic examples for the cli root commands
Xieyt May 29, 2024
5351882
Update examples.json with all commands examples
Xieyt Jun 3, 2024
6e30036
Update examples show for all subcommands and commands
Xieyt Jun 3, 2024
2df105d
Update examples.json
Xieyt Jun 3, 2024
871c718
fix: correct tag push for docker images
Xieyt Jun 4, 2024
aacc07f
Merge pull request #190 from rtCamp/cicd/fix-docker-image-tag
Xieyt Jun 4, 2024
a15f382
fix: fm list help not showing
Xieyt Jun 14, 2024
aafc01a
fix: add file command for `bench restore`
Xieyt Jun 17, 2024
b5b75c0
add: stop nginx-proxy from overriding acme challenge location
Xieyt Jun 17, 2024
4ac5ecf
Update images tags to specific version
Xieyt Jun 17, 2024
6f4f080
Merge pull request #198 from rtCamp/fix/bench-restore-command
Xieyt Jun 17, 2024
4905d98
Merge pull request #199 from rtCamp/fix/HTT01-challenge
Xieyt Jun 17, 2024
bab8dc9
Merge pull request #189 from rtCamp/enhance/cli-examples
Xieyt Jun 17, 2024
c887dd7
feat: move bench operations to cli from docker entrypoint
Xieyt Jun 11, 2024
674be2b
fix: remove duplicate backup of workers
Xieyt Jun 14, 2024
774ae81
remove secrects attribute
Xieyt Jun 18, 2024
af325d5
rename file
Xieyt Jun 18, 2024
352bf3c
cleanup
Xieyt Jun 19, 2024
37fa386
check docker images before starting services
Xieyt Jun 19, 2024
7af01a0
Update status messages
Xieyt Jun 19, 2024
d4de051
Update frappe docker image tag
Xieyt Jun 19, 2024
0773c7b
Update black and ruff configs
Xieyt Jun 19, 2024
a5d18d3
Remove test command
Xieyt Jun 19, 2024
2b1cea8
add site name in zsh shell prompt
Xieyt Jun 19, 2024
1b1cf3e
Update services osx template with specific services version
Xieyt Jun 20, 2024
bb22067
fix: supervisor double backup
Xieyt Jun 20, 2024
ce829ed
fix: backup manager in migrations
Xieyt Jun 20, 2024
3e95ae9
add v0.15.0 migration
Xieyt Jun 20, 2024
e039e62
fix: bench restart in prod environment
Xieyt Jun 20, 2024
8cefbfe
Update status msgs
Xieyt Jun 21, 2024
66e58b5
fix: sync workers after migrations
Xieyt Jun 21, 2024
ac07e9c
fix: check db start after services migration
Xieyt Jun 21, 2024
1f895a2
remove supervisor conf divide script
Xieyt Jun 21, 2024
5a7212b
remove chown permissions for /workspace
Xieyt Jun 21, 2024
830d601
Merge pull request #200 from rtCamp/bench-cli-operations
Xieyt Jun 21, 2024
57d7bf0
Merge pull request #201 from rtCamp/migrate-v-0-15-0
Xieyt Jun 21, 2024
e84dc72
fix: create default.conf only when not available
Xieyt Jun 24, 2024
b320c8c
Update nginx docker image version
Xieyt Jun 24, 2024
d75bde4
Add migration for updating nginx image
Xieyt Jun 24, 2024
12799b3
fix: don't run entrypoint script when copying from docker image
Xieyt Jun 24, 2024
f061034
remove nginx provided default.conf
Xieyt Jun 24, 2024
c16e7b6
remove nginx conf during migrations
Xieyt Jun 25, 2024
5530a6b
Merge pull request #206 from rtCamp/fix/nginx-persistant-config
Xieyt Jun 25, 2024
87732eb
Update shortflag of --environment
Xieyt Jun 25, 2024
00912d8
Merge pull request #208 from rtCamp/enhance/change-environment-short-…
Xieyt Jun 25, 2024
6607abd
fix: backup of workers in bench
Xieyt Jun 25, 2024
549b8b8
Merge pull request #209 from rtCamp/fix/backup-bench-supervisor-configs
Xieyt Jun 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/bake-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
with:
ref: main
fetch-depth: 0

- name: Set up tag
Expand Down
4 changes: 2 additions & 2 deletions Docker/frappe/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-instal
gosu \
fonts-powerline \
zsh \
file \
&& rm -rf /var/lib/apt/lists/*

RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
Expand Down Expand Up @@ -119,6 +120,7 @@ RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master
RUN unset ZSH

COPY --chown=frappe:frappe ./zshrc /opt/user/.zshrc
COPY --chown=frappe:frappe ./fm.zsh-theme /opt/user/fm.zsh-theme

RUN git clone --depth 1 https://github.com/pyenv/pyenv.git .pyenv \
&& pyenv install $PYTHON_VERSION \
Expand Down Expand Up @@ -161,7 +163,6 @@ COPY --chown=frappe:frappe --chmod=0755 ./bench-wrapper.sh /opt/user/.bin/bench

COPY --chmod=0755 ./prebake.sh /scripts/
COPY --chmod=0755 ./helper-function.sh /scripts/
COPY --chmod=0755 ./divide-supervisor-conf.py /scripts/

RUN ls -lah /workspace && /scripts/prebake.sh && mv /workspace/frappe-bench/apps/* /workspace/

Expand All @@ -181,7 +182,6 @@ RUN mkdir -p /scripts
COPY --chmod=0755 ./entrypoint.sh /
COPY --chmod=0755 ./user-script.sh /scripts/
COPY --chmod=0755 ./launch.sh /scripts/
COPY --chmod=0755 ./divide-supervisor-conf.py /scripts/
COPY --chmod=0755 ./helper-function.sh /scripts/

RUN rm -rf /opt && mkdir -p /workspace /opt
Expand Down
4 changes: 2 additions & 2 deletions Docker/frappe/bench-wrapper.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
restart_command() {
supervisorctl -c /opt/user/supervisord.conf restart frappe-bench-dev:
supervisorctl -c /opt/user/supervisord.conf restart all
}
status_command() {
supervisorctl -c /opt/user/supervisord.conf status frappe-bench-dev:
supervisorctl -c /opt/user/supervisord.conf status all
}

if [[ "$@" =~ ^restart[[:space:]]* ]]; then
Expand Down
41 changes: 0 additions & 41 deletions Docker/frappe/divide-supervisor-conf.py

This file was deleted.

12 changes: 10 additions & 2 deletions Docker/frappe/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,15 @@ update_uid_gid "${USERID}" "${USERGROUP}" "frappe" "frappe"

mkdir -p /opt/user/conf.d

start_time=$(date +%s.%N)
chown -R "$USERID":"$USERGROUP" /opt
end_time=$(date +%s.%N)
execution_time=$(awk "BEGIN {print $end_time - $start_time}")
echo "Time taken for chown /opt : $execution_time seconds"

if [[ ! -d "/workspace/.oh-my-zsh" ]]; then
cp -pr /opt/user/.oh-my-zsh /workspace/
cp -p /opt/user/fm.zsh-theme /workspace/.oh-my-zsh/custom/themes/
fi

if [[ ! -f "/workspace/.zshrc" ]]; then
Expand All @@ -40,9 +45,12 @@ if [[ ! -f "/workspace/.profile" ]]; then
cp -p /opt/user/.profile /workspace/
fi

chown "$USERID":"$USERGROUP" /workspace /workspace/frappe-bench

ls -pA /workspace | xargs -I{} chown -R "$USERID":"$USERGROUP" /workspace/{} &
# start_time=$(date +%s.%N)
# chown -R "$USERID":"$USERGROUP" /workspace
# end_time=$(date +%s.%N)
# execution_time=$(awk "BEGIN {print $end_time - $start_time}")
# echo "Time taken for chown /workspace : $execution_time seconds"

if [ "$#" -gt 0 ]; then
gosu "$USERID":"$USERGROUP" "/scripts/$@" &
Expand Down
57 changes: 57 additions & 0 deletions Docker/frappe/fm.zsh-theme
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Based on gnsh theme

setopt prompt_subst

() {

local PR_USER PR_USER_OP PR_PROMPT PR_HOST

# Check the UID
if [[ $UID -ne 0 ]]; then # normal user
PR_USER='%F{green}%n%f'
PR_USER_OP='%F{green}%#%f'
PR_PROMPT='%f➤ %f'
else # root
PR_USER='%F{red}%n%f'
PR_USER_OP='%F{red}%#%f'
PR_PROMPT='%F{red}➤ %f'
fi

FM_HOST() {
local default_hostname="%${1}"
local common_site_config="/workspace/frappe-bench/sites/common_site_config.json"
if [[ -f "$common_site_config" ]]; then
fm_hostname=$(jq -r .default_site "$common_site_config")
if [[ "$fm_hostname" != "null" ]]; then
echo "$fm_hostname"
else
echo "$default_hostname" # Default to hostname
fi
else
echo "$default_hostname" # Default to hostname
fi
}

# Check if we are on SSH or not
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
PR_HOST='%F{red}$(FM_HOST M)%f' # SSH
else
PR_HOST='%F{green}$(FM_HOST m)%f' # no SSH
fi

local return_code="%(?..%F{red}%? ↵%f)"

local user_host="${PR_USER}%F{cyan}@${PR_HOST}"
local current_dir="%B%F{blue}%~%f%b"
local git_branch='$(git_prompt_info)'

PROMPT="╭─${user_host} ${current_dir} \$(ruby_prompt_info) ${git_branch}
╰─$PR_PROMPT "
RPROMPT="${return_code}"

ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}‹"
ZSH_THEME_GIT_PROMPT_SUFFIX="› %f"
ZSH_THEME_RUBY_PROMPT_PREFIX="%F{red}‹"
ZSH_THEME_RUBY_PROMPT_SUFFIX="›%f"

}
26 changes: 26 additions & 0 deletions Docker/frappe/helper-function.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
#!/usr/bin/bash

# Function: chown directory and files
# Parameters:
# - user
# - group
chown_directory_and_files(){
local user; user="$1"
local group; group="$2"
local dir; dir="$3"

user_not_owned_files=$(find "$dir" ! -user "$user" -type f -exec realpath {} + | sort -u)
group_not_owned_files=$(find "$dir" ! -group "$group" -type f -exec realpath {} + | sort -u)

user_not_owned_dirs=$(find "$dir" ! -user "$user" -type d -exec realpath {} + | sort -u)
group_not_owned_dirs=$(find "$dir" ! -group "$group" -type d -exec realpath {} + | sort -u)

# Concatenate both lists, sort, and remove duplicates
not_owned_files=$(echo -e "$user_not_owned_files\n$group_not_owned_files" | sort -u)
not_owned_dirs=$(echo -e "$user_not_owned_dirs\n$group_not_owned_dirs" | sort -u)

cpu_cores=$(nproc)

echo "$not_owned_files" | xargs -P "$cpu_cores" -I{} bash -c "if [ -f {} ]; then chown ${user}:${group} {};fi"

echo "$not_owned_dirs" | xargs -P "$cpu_cores" -I{} bash -c "if [ -d {} ]; then chown -R ${user}:${group} {};fi"
}

# Function: update_common_site_config
# Description: Updates the common site config file with the provided key-value pair.
# Parameters:
Expand Down
Loading
Loading