ββββββββββββββββββ ββββββ ββββ ββββββββββββ βββββββ βββ βββββββ βββββββ
βββββββββββββββββββ βββββββββββββ ββββββββββββ βββββββββββ βββββββββββββββββ
βββ βββββββββββ ββββββββββββββ βββ βββ βββββββββββ βββ ββββββ ββββ
βββ βββββββββββ ββββββββββββββββββ βββ βββββββββββ βββ ββββββ βββ
βββββββββββββββββββββββββββ ββββββ ββββββ βββ ββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββ ββββββ βββββ βββ βββββββ ββββββββ βββββββ βββββββ
This repo is to set up the CSlant blog with Docker.
We can use this runner to update the blog for development and production.
In this docker repository, we have built the following images:
First, copy the .env.example
file to .env
and update the values.
envsubst < .env.example > .env
If you don't have envsubst
command, you can use the following command:
cp .env.example .env
In the .env
file, update the values to match your environment.
# .env file
# ...
# Path to your code folder
SOURCE_CODE_PATH=/Users/tanhongit/CSlant/blog/source
GIT_SSH_URL="git@github.com:cslant"
GIT_TOKEN="ghp_1234567890"
## DOMAIN SETTING
CSLANT_DOMAIN=cslant.com.local
BLOG_DOMAIN=blog.cslant.com.local
BLOG_API_DOMAIN=api.blog.cslant.com.local
BLOG_ADMIN_DOMAIN=admin.blog.cslant.com.local
BLOG_ADMIN_DIR=hello
FE_COMMAND=dev
Important
-
If the
SOURCE_CODE_PATH
is wrong, the runner will not be able to find the source code. So, please make sure theSOURCE_CODE_PATH
is correct.- So please get the full path of the
SOURCE_CODE_PATH
with the following command:
pwd
- So please get the full path of the
-
Ensure the
GIT_SSH_URL
andGIT_TOKEN
are correct. If the values are wrong, the runner will not be able to sync the repositories.- Please get
GIT_TOKEN
from here.
- Please get
To run as amd64. You need to set the default platform to linux/amd64
:
export DOCKER_DEFAULT_PLATFORM=linux/amd64
Then, you can just run the following command to start the runner.
bash runner.sh all
The above command will run all the commands in the runner and start nginx
, php
, node
, fe
, postgres
and elasticsearch
services.
If you want to start all the services, you can use the following command:
bash runner.sh all
bash runner.sh start_all
Add the following lines to the /etc/hosts
file:
127.0.0.1 blog.cslant.com.local admin.blog.cslant.com.local api.blog.cslant.com.local
If you're using another domain, please update the domain in the .env
file and update the domain in the /etc/hosts
file as well.
The runner has the following commands:
Command | Description |
---|---|
help , h |
Shows the help message |
git_sync , gs |
Syncs the blog repositories |
network , n |
Creates the Docker network |
build , b |
Builds the blog with Docker |
build_all , ba |
Builds all blog services with Docker |
start , s |
Starts the blog services in Docker |
start_all , sa |
Starts all blog services in Docker |
install , i |
Install all blog dependencies |
update , u |
Update all blog dependencies |
resource , r |
Download blog resources |
es_import , ei |
Import data to Elasticsearch |
all , a |
Runs all the commands |
To run a specific command, use the following command:
bash runner.sh <command>
For example, to run the help
command to show the help message, use the following command:
bash runner.sh help
Backup this blog database to a SQL file:
pg_dump -U username -h hostname database_name >> /path/to/backup.sql
Example in this Docker:
pg_dump -U root -h localhost cslant_blog >> /docker-entrypoint-initdb.d/cslant_blog.sql
psql -U root -h localhost cslant_blog < /docker-entrypoint-initdb.d/cslant_blog.sql
This project is licensed under the MIT License - see the LICENSE file for details.