Docker Openedx devstack theming - docker

How do I install and enable my custom theme in OpenEdx's docker based DevStack?
I use comprehensive theming
I use docker on Linux

The LMS and CMS read many configuration settings from the container filesystem in the following locations:
/edx/app/edxapp/cms.env.json
/edx/app/edxapp/cms.auth.json
Since you are using docker DevStack, shell into LMS, CMS to find those files.
shell into LMS
make lms-shell
Shell into CMS
make studio-shell
You can create this directory at any location on a file system that is accessible to your Open edX installation. For example, you might place it at the root of the file system in a directory named /my-open-edx-themes.
Set the file permissions on the themes directory, and all of its subdirectories, to enable read+write permissions for the Ubuntu user.
sudo chown -R edxapp:edxapp /my-open-edx-themes
sudo chmod -R u+rw /my-open-edx-themes
For each Open edX component that you want to theme, set the
"ENABLE_COMPREHENSIVE_THEMING" = True
"DEFAULT_SITE_THEME": "Your-theme-name "
For LMS,
/edx/app/edxapp/lms.env.json
For Studio,
/edx/app/edxapp/cms.env.json
For the E-commerce,
/edx/etc/ecommerce.yml
And for each Open edX component that you want to apply a theme to, add the absolute path of the themes directory to the
COMPREHENSIVE_THEME_DIRS
configuration property.
For LMS and Studio,
"COMPREHENSIVE_THEME_DIRS": [
"/my-open-edx-themes/edx-platform"
]
For the E-commerce,
COMPREHENSIVE_THEME_DIRS: ["/my-open-edx-themes/ecommerce"]
Finally, Restart all servers.
For more info, please follow this documentation.
http://edx.readthedocs.io/projects/edx-installing-configuring-and-running/en/latest/configuration/changing_appearance/theming/enable_themes.html
Add comments if you have any additional questions.

Related

How do I make a script to run another program after a file is created in a specific folder?

How do I make a script to run another program after a file is created in a specific folder? Could be Windows or Linux. To be specific, I want to use rclone to move file to remote folder right after it is created. The program itself doesnt have built-in monitoring function
Could be Windows or Linux.
Linux: It's easy with inotifywait.
cd "a specific folder"
inotifywait -me close_write --format %f . | while read file
do rclone move "$file" …
done
Unfortunately this doesn't work with the Ubuntu Linux app from the Windows Store for files on mounted Windows filesystems.

How do I read Linux Environment Variables within Wine?

I have some native Linux apps and some Wine apps that need to store configuration. I want to write the config data to ~/.config/some/path. But I'm not sure how to get to that directory from Wine.
I tried reading the Linux environment variables, but it doesn't work:
user#ubuntu:~$ echo $HOME
/home/user
user#ubuntu:~$ wine cmd
Microsoft Windows 10.0.17134
Z:\home\user\.wine>echo %HOME%
%HOME%
I also tried using ~, but that just creates a directory named ~ in the current working directory.
Any advice? How can I access the ~/.config directory from within a wine app?

Google Cloud bitnami wordpress installation permissions

I have setup an installation of Bitnami Wordpress Multisite in google cloud. I have also setup the SSH, and I am able to connect through SSH, but I want to go to the wordpress installation and edit files / upload plugins / edit permissions. Any idea of how I am able to do that. I followed bitnami's guide but it still does not allow me.
The cloud image of Bitnami WordPress Multisite is already configured with the right permissions to allow you install or upload plugins, edit any file, etc using the WordPress administration panel.
However, if you are using an old version of WordPress you may find some permissions problems. If it is your case, you can try the following workaround:
Open /opt/bitnami/apps/wordpress/htdocs/wp-config.php
Look for define('FS_METHOD', 'ftptext');
Replace it with define('FS_METHOD', 'direct');
Change the permissions of /opt/bitnami/apps/wordpress/htdocs to allow the server user (daemon) to make the modifications. You can do that by executing sudo chown -R daemon /opt/bitnami/apps/wordpress/htdocs
Go to the WordPress admin panel and check you can perform the operation you want.
Hope it helps.
For security reasons, WordPress files are not editable from the
WordPress application itself. We would suggest using an FTP client to
edit the files remotely.
Another option is to change the permissions to be able to edit from
the WordPress application temporarily. Note that this configuration is
not secure so please revert it after editing the files temporarily:
sudo chown daemon:daemon /opt/bitnami/apps/wordpress/htdocs/
Afterwards revert the changes to stay secure..
For /wp-content folder
sudo chown -R bitnami:daemon /opt/bitnami/apps/wordpress/htdocs/wp-content
sudo chmod -R g+w /opt/bitnami/apps/wordpress/htdocs/wp-content
https://docs.bitnami.com/google/apps/wordpress/

Allowing Permissions for Rails on Bitnami Google Compute Engine

I am attempting to test the sample app provided by Bitnami in the Ruby Stack, I have placed the files in the htdocs folder:
and access the url http://(IP)/sample. The result is that the url is active but I do not have permission to access anything present as:
How can I alter the permissions for this sample app so I can access?
Bitnami developer here. If you want to deploy your application using Passenger, you can follow the next guide.
https://wiki.bitnami.com/Infrastructure_Stacks/BitNami_Ruby_Stack?highlight=ruby+stack#How_can_I_deploy_my_Rails_application.3f
Apart from that, if you want to deploy a new page using Apache, you have to give read privileges to Apache. You can run the following commands:
$ sudo chown -R bitnami:daemon /opt/bitnami/apache2/htdocs
$ sudo chmod -R g+r /opt/bitnami/apache2/htdocs
I hope this helps.

Change JENKINS_HOME on Red Hat Linux?

I used this procedure to install Jenkins:
https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+RedHat+distributions
After it was up and running I discovered the /var/lib/jenkins partition on my server is very small. I want to move it, but I do not want to change the user that it runs under. I am new to Linux and I'm stumped. How do I move it for example to my Home/Public folder? The "Jenkins" user doesn't seem to have a Home folder. Its running as a daemon on startup, so I have no idea where to configure those settings.
Can I create a Home folder for the Jenkins user? How?
I read this article:
https://wiki.jenkins-ci.org/display/JENKINS/Administering+Jenkins
but do not understand HOW to "set the new Jenkins home". I have used the export command, and restarted the service, but the old path still shows up in the Manage Jenkins screens.
I've read the 2-3 similar questions on stackoverflow also, but there's always a big missing piece for me. Where to find that file where I change the path permanently?
Here's an easy way to solve your problem. First, move the Jenkins directory from /var/lib/jenkins to /home/jenkins. Then create a symlink at /var/lib/jenkins pointing to /home/jenkins. And of course, stop the Jenkins service before doing that.
sudo service jenkins stop
sudo mv /var/lib/jenkins /home
sudo ln -s /home/jenkins /var/lib/jenkins
sudo service jenkins start
I managed to change the home location for Jenkins by modifying content of /etc/sysconfig/jenkins file as follows:
JENKINS_HOME="/home/jenkins"
Okay, I reread your question a little bit more closely, lets see if we can figure this out. I am going to list some info that you may or may not know.
The jenkins installation and jenkins home are not the same thing. One is where the war file and other parts that jenkins needs to run live. jenkins_home is where your data is stored. By default, jenkins_home lives in ~/.jenkins. When you start jenkins, it looks for an environment variable to tell it where to find those files.
Jenkins runs as a seperate user, which, by default, is jenkins. This way it doesn't get in the way of you. The jenkins user will not have access to YOUR home directory, so that would be a poor solution. Ideally, it would have its own home directory, /home/jenkins. Your home directory could then be /home/jenkins/.jenkins. You say that folder doesn't exist- if you don't have access to it to create it yourself, that is perfectly fine, you can specify ANY folder. However, the jenkins user must have ownership of that folder to read and write to it.
It looks like Jenkins on redhat will be running with tomcat by default. The documentation for how to set environment variables for tomcat is https://wiki.jenkins-ci.org/display/JENKINS/Tomcat
This all gets set up with a script.https://wiki.jenkins-ci.org/display/JENKINS/JenkinsLinuxStartupScript seems to be the one that is used for this purpose. Even if you don't know anything about shell scripting, this isn't too hard... lines with a # are comments. The first line
JENKINS_USER=jenkins
sets the name of the user account jenkins will be using. Look down a littlle further, and you'll see the line
export JENKINS_BASEDIR=/home/jenkins
export CATALINA_OPTS="-DJENKINS_HOME=$JENKINS_BASEDIR/jenkins-home -Xmx512m -Djava.awt.headless=true"
This lets you set a directory to where jenkins should live, and then sets the jenkins_home directory to that /jenkins-home.
For your application, you may want to do something like this
export CATALINA_OPTS="-DJENKINS_HOME=/var/jenkinsmount/home -Xmx512m -Djava.awt.headless=true"
That would then store all of your build data (which is the part that grows!) at /var/jenkinsmount/home ... while leaving the rest of your files in their current location.
I haven't used it on redhat, but hopefully I explained enough for you to actually understand what is going on so that you can get it going!
Other INFO:
https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+as+a+Unix+daemon
I have faced the same issue and question.
Connecting some dots I could fix my Jenkins after I moved Jenkins to a new location due to the same issue -space in disk under /var/lib/jenkins.
Here is the procedures that I had to follow to get it working taking in consideration that I am pointing Jenkins to a non-default port. (I have applied this process into 2 servers)
First, move the Jenkins directory from /var/lib/jenkins to /opt/jenkins
sudo service jenkins stop
sudo mv /var/lib/jenkins /opt/
Now you can change your workspace and build directory to any other location on your machine.
Jenkins provides 3 predefined variables that can be used to specify the new location:
JENKINS_HOME — Jenkins home directory
ITEM_ROOTDIR — Root directory of a job for which the workspace is allocated
ITEM_FULLNAME — ‘/’-separated job name, like “foo/bar”
sudo su jenkins (access as Jenkins user)
JENKINS_HOME=/opt/jenkins
ITEM_ROOTDIR=/opt/jenkins
ITEM_FULLNAME=/opt/jenkins
exit (exit Jenkins user)
Now, edit the jenkins config
/opt/jenkins$ sudo nano /etc/default/jenkins
Modify the following line
#jenkins home location
#JENKINS_HOME=/var/lib/$NAME (here is the default)
JENKINS_HOME=/opt/jenkins (that is our new location)
change the home directory of a user
sudo usermod -d /opt/jenkins/ jenkins
sudo service jenkins start
If anyone is having issues with space and you have to relocate your jenkins, just wanted to reiterate that::
sudo service jenkins stop
sudo mv /var/lib/jenkins /home
sudo ln -s /home/jenkins /var/lib/jenkins
sudo service jenkins start
works great, so thanks to the person who posted that answer a few years ago!
Richard Chen's location is where I found the jenkins file on my CentOS 6.6 system.
sudo service jenkins stop
mv /var/lib/jenkins /home/mylocation/
(made sure the new location had correct ownership and group-- Jenkins)
modified the content of the file /etc/sysconfig/jenkins as follows:
JENKINS_HOME="/home/mylocation"
sudo service jenkins start
If all these don't work, then the only solution that works is to edit the following file
/lib/systemd/system/jenkins.service
then need to execute reloading of configs by running
systemctl daemon-reload
after this restarting the service would reflect the change.
Some commands work for me as below:
Step 1: Stop jenkin service and moving folder
systemctl stop jenkins
mv /var/lib/jenkins /whatever/folder
sudo chown jenkins -R /whatever/folder
Step 2: Modify jenkins home location in /etc/default/jenkins
JENKINS_HOME=/whatever/folder/$NAME
Step 3: Restart jenkins service
systemctl start jenkins
[A] Find your current jenkins home folder, if you are not aware where it is ?
Jenkins -> Manage Jenkins -> Configure System -> Check label 'Home directory'
[B] To move current Jenkins home folder to a new directory. Follow below steps :-
Stop Jenkins service - by killing the process
Follow one of below approach to set new home folder for JENKINS.
a) By default Jenkins home directory is set to ~/.jenkins
b) "JENKINS_HOME" environment variable setup in operating system.
c) "JENKINS_HOME" entry in JNDI environment.
d) "JENKINS_HOME" system property to the servlet container.
Tomcat context descriptor of the servlet, you can set below field in apache-tomcat-8.5.28/conf/context.xml :
<Context ...>
<Environment name="JENKINS_HOME" value="/path/to/jenkins_home/" type="java.lang.String"/>
</Context>
e) If jenkins.war file is deployed in a tomcat server , then even appending below content in bin/catalina.sh will setup JENKINS_HOME.
CATALINA_OPTS="-DJENKINS_HOME=/path_to/jenkins_home/"
Manually copy Jenkins home folder content from old to new home
folder. (use cp command) . Instead of moving, copy step is advised to keep one backup. Later you can delete old workspace.
Now start Jenkins, then It will pick the new home directory
from the path mentioned in JENKINS_HOME variable.
Note: - Just by setting above variable "JENKINS_HOME" to a different path will not copy
the files from current Jenkins home path to new one automatically. This copy step - you have to do it yourself, Manually.

Resources