diff --git a/Dockerfile.amd64 b/Dockerfile.amd64 index a20bd71..fada08a 100644 --- a/Dockerfile.amd64 +++ b/Dockerfile.amd64 @@ -154,6 +154,7 @@ HEALTHCHECK --interval=30s --timeout=5s CMD curl --fail http://127.0.0.1:6079/ap ENTRYPOINT ["/startup.sh"] # Install Docker +RUN groupadd -g 281 docker RUN mkdir -p /etc/apt/keyrings RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg RUN echo \ diff --git a/README.md b/README.md index 11184ad..1b92671 100644 --- a/README.md +++ b/README.md @@ -167,9 +167,6 @@ See the LICENSE file for details. ## New Failing to generate a key using the below path will cause the key to delete after a routine update to the cluster. After the upgrade, use the command above to generate a new key for it to be persistent -Generate percistent SSH key using otherwise it will delete on upgrade: -#ssh-keygen -t ed25519 -f /workspace/.$USER/.ssh/id_ed25519 -C "user@cloud9" - ENV Vars USER PASSWORD @@ -182,7 +179,4 @@ SHOW_MENU_ICONS SHOW_TOOLTIPS SHOW_GENERIC_NAMES -/workspace/.ubuntu/docker_creds -user -pass - +set docker group id to the host group id \ No newline at end of file diff --git a/rootfs/cloud9/bashrc.default b/rootfs/cloud9/bashrc.default index 9855912..4cbbb13 100644 --- a/rootfs/cloud9/bashrc.default +++ b/rootfs/cloud9/bashrc.default @@ -15,7 +15,7 @@ HISTCONTROL=ignoreboth # append to the history file, don't overwrite it shopt -s histappend export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" -export HISTFILE=/workspace/.bash_history +#export HISTFILE=$HOME/.bash_history # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) diff --git a/rootfs/root/This directory is not persistent b/rootfs/root/This directory is not persistent new file mode 100644 index 0000000..d1cf17a --- /dev/null +++ b/rootfs/root/This directory is not persistent @@ -0,0 +1 @@ +Do not save anything to this directory as it will routinely get cleared. Use your users home directory. \ No newline at end of file diff --git a/rootfs/startup.sh b/rootfs/startup.sh index f71aaaa..4671526 100755 --- a/rootfs/startup.sh +++ b/rootfs/startup.sh @@ -1,5 +1,4 @@ #!/bin/bash - if [ -n "$VNC_PASSWORD" ]; then echo -n "$VNC_PASSWORD" > /.password1 x11vnc -storepasswd $(cat /.password1) /.password2 @@ -32,7 +31,8 @@ USER=${USER:-root} HOME=/root if [ "$USER" != "root" ]; then echo "* enable custom user: $USER" - useradd --create-home --shell /bin/bash --user-group --groups adm,sudo $USER + useradd --create-home --shell /bin/bash --user-group --groups adm,sudo,docker -d /workspace/.home/$USER $USER + if [ -z "$PASSWORD" ]; then echo " set default password to \"ubuntu\"" PASSWORD=ubuntu @@ -41,7 +41,7 @@ if [ "$USER" != "root" ]; then PASSWORD=$(cat /proc/sys/kernel/random/uuid | sed 's/[-]//g' | head -c 20) fi - HOME=/home/$USER + HOME=/workspace/.home/$USER echo "$USER:$PASSWORD" | chpasswd cp -r /root/{.config,.gtkrc-2.0,.asoundrc} ${HOME} chown -R $USER:$USER ${HOME} @@ -78,33 +78,33 @@ PASSWORD= HTTP_PASSWORD= # BashRC -cp /cloud9/bashrc.default /home/$USER/.bashrc -chown -R $USER:$USER /home/$USER/.bashrc +cp /cloud9/bashrc.default $HOME/.bashrc +chown -R $USER:$USER $HOME/.bashrc # Gitconfig -touch /workspace/.ubuntu/gitconfig -ln -sf /workspace/.ubuntu/gitconfig /home/$USER/.gitconfig +#touch /workspace/.ubuntu/gitconfig +#ln -sf /workspace/.ubuntu/gitconfig /home/$USER/.gitconfig # cloud9 -cp /cloud9/bashrc.default /home/$USER/.bashrc -mkdir -p /workspace/.$USER/.standalone -mkdir -p /workspace/.$USER/.c9 -USER_SETTINGS="/workspace/.$USER/user.settings" -if [ ! -f $USER_SETTINGS ]; then touch $USER_SETTINGS; fi -ln -sf $USER_SETTINGS /home/$USER/.c9/user.settings +#mkdir -p /workspace/.$USER/.standalone +#mkdir -p /workspace/.$USER/.c9 +#USER_SETTINGS="/workspace/.$USER/user.settings" +#if [ ! -f $USER_SETTINGS ]; then touch $USER_SETTINGS; fi +#ln -sf $USER_SETTINGS /home/$USER/.c9/user.settings # Symlink SSH keys -mkdir -p /workspace/.$USER/.ssh -chmod 700 /workspace/.$USER/.ssh -ln -sf /workspace/.$USER/.ssh /home/$USER/.ssh +#mkdir -p /workspace/.$USER/.ssh +#chmod 700 /workspace/.$USER/.ssh +#ln -sf /workspace/.$USER/.ssh /home/$USER/.ssh if [ -n "$DOMAIN" ]; then DOMAIN="cloud9.example.com" fi -chown -R $USER:$USER /home/$USER /cloud9 /workspace +chown -R $USER:$USER $HOME /cloud9 /workspace # Add required packages for ubuntu user (Run as user) +rm -rf $HOME/.c9 mkdir -p /workspace/.c9 chown $USER:$USER /workspace/.c9 sudo -H -u $USER bash -c 'bash /cloud9/user-install.sh' 2>&1> /workspace/.c9/install.log & @@ -184,11 +184,13 @@ until [[ $SUCCESS == "TRUE" ]]; do sleep 1 done & -DOCKER_CREDS=/workspace/.ubuntu/docker_creds -if test -f "$DOCKER_CREDS"; then - echo "DOCKER_CREDS exists." - #su $USER -c "DOCKER_USER=$(cat $DOCKER_CREDS | head -n1); DOCKER_PASS=$(cat $DOCKER_CREDS | tail -n1); echo \$DOCKER_PASS | docker login --username \$DOCKER_USER --password-stdin)" - DOCKER_USER=$(cat $DOCKER_CREDS | head -n1); DOCKER_PASS=$(cat $DOCKER_CREDS | tail -n1); echo $DOCKER_PASS | docker login --username $DOCKER_USER --password-stdin -fi +#DOCKER_CREDS=/workspace/.ubuntu/docker_creds +#if test -f "$DOCKER_CREDS"; then +# echo "DOCKER_CREDS exists." +# #su $USER -c "DOCKER_USER=$(cat $DOCKER_CREDS | head -n1); DOCKER_PASS=$(cat $DOCKER_CREDS | tail -n1); echo \$DOCKER_PASS | docker login --username \$DOCKER_USER --password-stdin)" +# DOCKER_USER=$(cat $DOCKER_CREDS | head -n1); DOCKER_PASS=$(cat $DOCKER_CREDS | tail -n1); echo $DOCKER_PASS | docker login --username $DOCKER_USER --password-stdin +#fi + +chown root:root /home exec /bin/tini -- supervisord -n -c /etc/supervisor/supervisord.conf