A simple FAQ system.
docker-compose
: version 3
sudo dnf -y install dnf-plugins-core
sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
sudo dnf install docker-ce docker-ce-cli containerd.io
- Start once:
sudo systemctl start docker
- Start on every boot:
sudo systemctl enable docker
- Download
start.yml
and.env.exmaple
, and put them in the same directory - Edit
.env.exmaple
and rename it to.env
docker-compose -f start.yml up -d
- Go to localhost and it should be running
Update to the newest version requires rebuilding the images:
- Stop the service:
docker-compose -f start.yml down
- Rebuild the images:
docker-compose -f start.yml build --no-cache
- Start the service:
docker-compose -f start.yml up -d
Variable | Default value | Description | Containers using the variable |
---|---|---|---|
DB_TYPE |
Supported values are mariadb (mysql ), postgres (postgresql ), should be specified even in development |
web |
|
DEBUG |
0 |
Production: 0 / Development: 1 |
web |
SECRET_KEY |
yaaaaaaaaaaaaa! |
Change this to a hard-to-guess random string | web |
DJANGO_ALLOWED_HOSTS |
localhost 127.0.0.1 [::1] |
the IPs/domain names that this Django site can be served | web |
DJANGO_SUPER_USER |
yaaaaaaaaaaaaa! |
Default admin page username | web |
DJANGO_SUPER_PASSWORD |
yaaaaaaaaaaaaa! |
Default admin page password | web |
DJANGO_SUPER_EMAIL |
yaaaaa@yaaa.yaa |
Email of the admin user | web |
HOST |
db |
Domain name or IP of the database, use 127.0.0.1 instead of localhost in development |
web |
PORT |
Port of the database(postgres : 5432 , mariadb : 3306 ) |
web |
|
TIME_ZONE |
Asia/Taipei |
timezone for the website, valid options are listed here | web |
MYSQL_ROOT_PASSWORD |
yaaaaaaaaaaaaa! |
Mariadb root password |
web & db |
MYSQL_DATABASE |
faqs |
Mysql default database | web & db |
POSTGRES_USER |
yaaaaaaaaaaaaa! |
Postgres super account username | web & db |
POSTGRES_PASSWORD |
yaaaaaaaaaaaaa! |
Postgres super account password | web & db |
POSTGRES_DB |
faqs |
Postgres default database | web & db |
THREADS |
auto |
valid values are auto or numbers, threads available for nginx |
nginx |
FORCE_NEW_CERT |
false |
set to true to force regenerate SSL certificate |
nginx |
FORCE_NEW_DHPARAM |
false |
set to true to force regenerate Diffie-Hellman parameters |
nginx |
C |
2-digit country code, arguments for generating SSL certificate(optional) | nginx |
|
ST |
state, arguments for generating SSL certificate(optional) | nginx |
|
L |
location(city), arguments for generating SSL certificate(optional) | nginx |
|
O |
organization, arguments for generating SSL certificate(optional) | nginx |
|
OU |
organization unit(division), arguments for generating SSL certificate(optional) | nginx |
|
CN |
common name(FQDN/IP), e.g. www.example.com / 0.0.0.0 , arguments for generating SSL certificate |
nginx |
|
SAN |
subject alternative name(DNS:FQDN/IP:IP), e.g. DNS:www.exmple.com / IP:0.0.0.0 , arguments for generating SSL certificate |
nginx |
- Clone this repository
- Create your
.env.dev
source .env.dev && export $(cut -d = -f 1 .env.dev)
- In
start_[database].yml
, underdb:
, edit:db: ... # postgres env_file: - .env.dev ports: - 5432:5432 ... db: ... # mariadb env_file: - .env.dev ports: - 3306:3306 ...
docker-compose -f start_[database].yml up -d db
- Populate the tables if the database is newly created:
python3 manage.py makemigrations && python3 manage.py migrate
, create a superuser:python3 manage.py createsuperuser
python3 manage.py runserver
- If you need static files and media files to be served, add
+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
afterurlpatterns
infaq/urls.py
, and changeSTATIC_ROOT
&MEDIA_ROOT
infaq/settings.py
to somewhere you have permission.
- Fork this repository
- Clone your repository
- Change the upstream urls:
- In
start_[database].yml
: 2 urls in the value field ofcontext
- In
dockerfile
: 1 url afterRUN git clone
- In
nginx.dockerfile
: 1 url afterRUN curl
- In
- Commit and push your changes
- Remember to push your changes to the upstream repository and update it before starting the services.
postgres
docker image can't specify host volumes- Use
mariadb
instead
- Use
mariadb
can't start with InnoDB: auto-extending data file ./ibdata1 is of a different size 0 pages- Add
--innodb-flush-method=fsync
to thecommand
value underdb
instart_mariadb.yml
- Add