docker-compose on windows directory sync - django

Running the django tutorial for docker compose, but the command to init the django project is not working as expected.
$ docker-compose run web django-admin.py startproject composeexample .
[31mERROR[0m: Interactive mode is not yet supported on Windows.
Please pass the -d flag when using `docker-compose run`.
In windows "interactive" mode is not supported so I modified the command to run in "detached" mode.
$ docker-compose run -d web django-admin.py startproject composeexample .
Creating network "djangotest_default" with the default driver
...
Successfully built 0fb90648c1d8
[33mWARNING[0m: Image for service web was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
djangotest_web_run_1
This seems to create the boxes.. but my current directory shows no new files (from the django-admin command).
$ ls
docker-compose.yml Dockerfile requirements.txt
How do I get the container output to sync with the current working directory as expected?

The fix was to uninstall Windows 10 and install a *nix system. The files then appear as per the tutorial.
~/docker/django-test $ ll
total 60
drwxr-xr-x 4096 Sep 24 00:47 ./
drwxr-xr-x 4096 Sep 24 00:40 ../
drwxr-xr-x 4096 Sep 24 00:47 composeexample/
-rw-r--r-- 209 Sep 24 00:41 docker-compose.yml
-rw-r--r-- 146 Sep 24 00:41 Dockerfile
-rwxr-xr-x 812 Sep 24 00:47 manage.py*
-rw-r--r-- 16 Sep 24 00:41 requirements.txt

Related

EC2 instance - unable to read write files though they exists

Please help with this strange problem that i am facing with aws EC2 instance. I have launched a EC2 instance & installed git to clone my repo. all good untill this, but i am unable to read/write those files though they exists in the same path. observed the same behaviour in Amazon Linux instance as well.
ubuntu#ip-172-31-54-19:~/win2win$
ubuntu#ip-172-31-54-19:~/win2win$ cd $HOME
ubuntu#ip-172-31-54-19:~$
ubuntu#ip-172-31-54-19:~$
ubuntu#ip-172-31-54-19:~$ cd win2win/
ubuntu#ip-172-31-54-19:~/win2win$
ubuntu#ip-172-31-54-19:~/win2win$ cat myscript.sh
cat: myscript.sh: No such file or directory
ubuntu#ip-172-31-54-19:~/win2win$
ubuntu#ip-172-31-54-19:~/win2win$ ls -lrt
total 28
drwxrwxr-x 2 ubuntu ubuntu 4096 Apr 5 09:21 templates
-rw-rw-r-- 1 ubuntu ubuntu 792 Apr 5 09:21 sampleIDs
-rw-rw-r-- 1 ubuntu ubuntu 2614 Apr 5 09:30 myscript.sh
ubuntu#ip-172-31-54-19:~/win2win$
ubuntu#ip-172-31-54-19:~/win2win$ pwd
/home/ubuntu/win2win
ubuntu#ip-172-31-54-19:~/win2win$
Can anyone help.
thanks in advance.

"attempt to write a readonly database" - Give permissions to db.sqlite3

I am trying to deploy my Django project on a Bitnami server, but when I try to login through admin with my superuser i get the following error:
attempt to write a readonly database
Exception Location: /opt/bitnami/python/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py, line 413, in execute
I have the following permissions to my project files:
drwxrwxr-x 6 bitnami www-data 4096 Mar 12 08:01 .
drwxr-xr-x 3 bitnami root 4096 Mar 11 10:00 ..
drwxr-xr-x 2 bitnami bitnami 4096 Mar 11 11:48 conf
-rw-rw-r-- 1 bitnami www-data 147456 Mar 12 08:01 db.sqlite3
-rw-r--r-- 1 bitnami bitnami 287 Mar 11 13:29 .env
drwxr-xr-x 5 bitnami bitnami 4096 Mar 11 10:26 app
-rwxr-xr-x 1 bitnami bitnami 667 Mar 11 10:00 manage.py
drwxr-xr-x 3 bitnami bitnami 4096 Mar 11 13:52 django_project
drwxr-xr-x 5 bitnami bitnami 4096 Mar 11 10:26 users
and this to the project directory
drwxrwxr-x 6 bitnami www-data 4096 Mar 12 08:01 django_project
I tried to run the following to give permission but without luck:
sudo chown :www-data /opt/bitnami/projects/django_project/db.sqlite3
sudo chmod 664 /opt/bitnami/projects/django_project/db.sqlite3
sudo chown :www-data /opt/bitnami/projects/django_project/
sudo chmod 775 /opt/bitnami/projects/django_project/
Can you help me? :)
Bitnami developer here. You are setting the group to www-data. The Bitnami Apache user is "daemon".

Redmine plugin not found

I'm doing a installation on a Ubuntu machine (16.04 server) and I need to install the plugins for the Redmine platform (the lastest version). I installed Redmine using the official documentation: Install Redmine step by step on Ubuntu
The installation was successful but now I have to install some plugins but every time I try to install I get: plugin was not found.
Since I made everything as said in the documentation I have this folder structure:
var/www/html/redmine
-rw-r--r-- 1 root root 459 Mar 13 2016 404.html
-rw-r--r-- 1 root root 648 Mar 13 2016 500.html
-rwxr-xr-x 1 root root 473 Mar 13 2016 dispatch.fcgi
-rw-r--r-- 1 root root 7886 Mar 13 2016 favicon.ico
-rw-r--r-- 1 root root 43 Jul 13 12:07 Gemfile
-rw-r--r-- 1 root root 143 Jul 13 12:07 Gemfile.lock
drwxr-xr-x 51 root root 4096 Jul 12 16:11 help
drwxr-xr-x 4 root root 4096 Jul 12 16:12 images
drwxr-xr-x 4 root root 4096 Jul 12 16:12 javascripts
drwxr-xr-x 2 root root 4096 Jul 12 16:12 plugin_assets
drwxrwxrwx 4 root root 4096 Jul 19 17:30 plugins
lrwxrwxrwx 1 root root 25 Jul 19 18:37 public -> /usr/share/redmine/public
drwxr-xr-x 9 root root 4096 Jul 13 10:02 redmine_agile
drwxr-xr-x 3 root root 4096 Jul 12 16:12 stylesheets
drwxr-xr-x 5 root root 4096 Jul 12 18:05 themes
To install the plugins I follow this tutorial: Install plugin. I use this command: bundle install --without development test --no-deployment on /var/www/html and everything is ok. But then I need to use bundle exec rake redmine:plugins NAME=redmine_checklists RAILS_ENV=production (in the same location as the previous command) and I get plugin was not found
Things I already tried:
Use Redmine last version
update bundler
execute rake on Redmine root
update all gems
set the right permissions on the plugins folders
and nothing seems to work.
bundle exec rake redmine:plugins:migrate RAILS_ENV=production NAME="YOUR_PLUGIN_NAME" in the root_app folder

How to know what commands are executed on a directory in Centos?

I have three directories(farmio,farmio-table,farmio-table-throttle) in apps directory of AWS-Centos server under username ec2-user, every time I do a ls -la I see two folders(farmio-table,farmio-table-throttle) accessed frequently and the pid file stored inside the folder are wiped out for which my java programs doesn't execute properly.
[ec2-user#ip-10-94-221-19 apps]$ ls -la
total 49036
drwxrwxr-x 5 ec2-user root 4096 Nov 7 09:39 .
drwxrwxr-x 3 ec2-user root 4096 May 29 12:20 ..
-rw-rw-r-- 1 ec2-user ec2-user 29 Nov 6 06:26 date.txt
drwxrwxr-x 4 ec2-user ec2-user 4096 Nov 6 06:42 farmio
drwxrwxrwx 7 ec2-user ec2-user 4096 Nov 7 2015 farmio-table
-rw-r----- 1 ec2-user ec2-user 25090806 Nov 7 09:43 farmio-table-bin.zip
drwxrwxrwx 7 ec2-user ec2-user 4096 Nov 7 2015 farmio-table-throttle
-rw-r----- 1 ec2-user ec2-user 25092514 Nov 7 09:39 farmio-table-throttle-bin.zip
Every time I try to check the folders are changed or replaced after five minutes.
Is there any way I could know which user and which command is executed in this directory so that its files are replaced/modified in Centos.
Use command history to check all the previously run commands.
$ history

Uploading code of django to github repository in ubuntu

I have this little problem regarding to upload my existing django project to github repository.
This is my working directory and here my django code stays.
mjrulesamrat#mjrulesamrat-Lenovo-G570:~/django_mj/django_test$ ls -l
total 56
drwxrwxr-x 4 mjrulesamrat mjrulesamrat 4096 Aug 27 05:31 article
-rw-r--r-- 1 mjrulesamrat mjrulesamrat 34816 Aug 26 21:42 db.sqlite3
drwxrwxr-x 2 mjrulesamrat mjrulesamrat 4096 Aug 27 06:35 django_test
-rwxr-xr-x 1 mjrulesamrat mjrulesamrat 254 Aug 25 18:09 manage.py
-rw-rw-r-- 1 mjrulesamrat mjrulesamrat 0 Aug 27 06:46 README.md
drwxrwxr-x 4 mjrulesamrat mjrulesamrat 4096 Aug 27 05:35 static
drwxrwxr-x 2 mjrulesamrat mjrulesamrat 4096 Aug 27 05:33 templates
Now when i try to add or commit it says following msg.
mjrulesamrat#mjrulesamrat-Lenovo-G570:~/django_mj/django_test$ git add .
mjrulesamrat#mjrulesamrat-Lenovo-G570:~/django_mj/django_test$ git status
On branch master
nothing to commit, working directory clean
mjrulesamrat#mjrulesamrat-Lenovo-G570:~/django_mj/django_test$ git commit -m "app_commit_no_4"
On branch master
nothing to commit, working directory clean
mjrulesamrat#mjrulesamrat-Lenovo-G570:~/django_mj/django_test$
Please help me upload code to my repository.
to upload my code to github repository, I usually create my project on github first.
clone my project to my PC with git clone https://github.com/myusername/myproject.git
copy - paste to my code to cloned project.
run git add .
run git commit -am 'this is msg'
run git push origin master
First of all I have made changes on the remote repository.
That's why it was giving me error.
So, first i have to pull the changes from the remote repository and then i have to push the changes.
These are the commands that I followed.
I learned from my sir later.
git pull remote_repo
git add .
git status
git commit -m "message"
git push -u origin master
This works good till date.