1

I have some projects on DigitalOcean VPSs. I deploy parts of code very often. Almost after every upload I have to do multiple commands.

For example if I change Django models and add some static files:

I have to connect through ssh and:

activate virtualenv
cd to /home/django/project/
python manage.py makemigrations
python manage.py migrate 
python manage.py collectstatic
sudo systemctl daemon-reload
sudo systemctl restart gunicorn
sudo systemctl restart nginx
sudo supervisorctl
restart celery_worker

Of course I don't need all commands every time.

I would like to make it more comfortable to work with these commands.

Is there some application where I can define those commands and then choose from them and execute?

The closest thing which comes to my mind is to create shell scripts but maybe there is a better option.

I use PyCharm for deploying. I checked docs and I didn't find such feature but maybe there is.

Milano
  • 613

1 Answers1

2

The closest thing which comes to my mind is to create shell scripts but maybe there is a better option.

Is there some application where I can define those commands and then choose from them and execute?

I would create shells scripts yes. But you could also create a local hosted website where you create a page with checkboxes and have them execute on the server.

Regarding shell scripts:

You can create pretty elaborate shell scripts. Have a look at How can I create a select menu in a shell script? for a "menu" style method using "dialog". "tasksel" is a script that is pretty fancy for command line and looks like this:

enter image description here

You could create something like that and make each of these a task you select and then have execute. Or string your commands together if they depend on eachother (I imagine you'd need to start all the python manage.py all the time and not as separate commands).

Rinzwind
  • 299,756