-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands.txt
86 lines (58 loc) · 3.64 KB
/
commands.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
docker build --tag python-django .
( The command is telling Docker to build an image using the Dockerfile in the current directory,
and the resulting image will be named python-django with the latest tag since a tag name was not explicitly provided. The --tag option is
often used to provide a meaningful name and version information to the image being built. )
docker run --publish 8000:8000 python-django
( The command is telling Docker to run a container based on the python-django image and map port
8000 on the host to port 8000 on the container. This is commonly used for web applications or
services where you want to expose a specific port on the host machine to interact with the
application running inside the Docker container. )
docker run --rm -p 6379:6379 redis:7
( The command is telling Docker to run a Redis container based on the Redis image with version 7.
It maps port 6379 on the host to port 6379 on the Redis container, allowing external processes to
interact with Redis on the specified port. )
python manage.py runserver (To run django server)
celery -A crowdsourcing worker --pool=solo -l info (Development Env)
celery -A crowdsourcing worker --loglevel=info --concurrency=4 -Ofair (Production Env)
docker-compose run --rm <app_name>
( Used with Docker Compose to run a one-off command in a service defined in docker-compose.yml
file and removing the temporary container after execution )
docker-compose up
( Used to start the services defined in Docker Compose configuration. It reads the
docker-compose.yml file in the current directory (or a specified file) and creates and
starts the containers for the services defined. )
pg_ctl -D /var/lib/postgresql/data -l logfile start
( Starts postgres db server )
docker exec -it crowdsourcing_container bash
( Access docker bash terminal)
docker exec -it crowdsourcing_container sh
( Access docker shell terminal)
docker ps
( Lists the currently running containers on the system )
docker inspect <container_id>
( Used to obtain detailed information about a Docker container, image, network, or volume )
psql -U <username>
( To access postgresql terminal in order to write SLQ statements. Default name and password is postgres)
CREATE USER <username> WITH PASSWORD '<password>';
ALTER USER <username> WITH SUPERUSER;
rabbitmqctl add_user RabbitUser YOURPASSORDHERE
rabbitmqctl add_vhost rabbit
rabbitmqctl set_user_tags RabbitUser administrator
rabbitmqctl set_permissions -p rabbit RabbitUser ".*" ".*" ".*"
rabbitmqctl delete_user guest
( For adding a new user to RabbitMQ, adding vhost, and setting set_permissions for the new user )
docker-compose run --rm <service-name-defined-in-django-compose.yaml> sh -c "django-admin startproject <project-name> ."
<------------------------Configuring NGINX Docker Image------------------------>
The next step is to add an NGINX reverse proxy to the project.
The first time we run it, it will handle the following initialisation steps:
Generate DH Parameters which will be stored in a volume (see What’s the purpose of DH Parameters? to learn what this is for)
Handle the acme challenge of HTTP for initialising our certificate
These are only required the first time we deploy our project to a new server.
After the first run, it will then handle the following:
Redirect HTTP requests to HTTPS
Handle Django static files
Forward requests to uWSGI
docker compose -f docker-compose.yml logs
( Access aws shell for the ec2 instance)
( ssh ec2-user(default user created on ec2)@<Public IPv4 DNS> )