我正在测试WordPress for personnal项目,但是我想在本地安装我的开发WordPress网站,并在我的Personnal生产服务器上安装最终网站。
为了做到这一点,我在我的产品wordpress中搜索一个插件或程序,用于将wordpress开发与新页面、模板和配置同步。
有没有程序或插件可以做到这一点?怎样才能更好的使用wordpress呢?
谢谢:)
发布于 2020-03-29 17:21:47
您可以尝试以下两个主题:
-.By计划将文件拷贝到生产环境(如使用crontab的linux CLI )(每分钟):
* * * * * scp local_file remote_username@remote_ip:remote_file但我不推荐这种方式,为了让你更容易理解。
-.By CICD,这是一个博客链接,如果你不知道这一点,你可以先知道这个概念:
https://thecodingmachine.io/continuous-delivery-on-a-dedicated-server
简而言之,你可以在gitlab或github上将你的项目推送到私有存储库,然后创建开发(=开发服务器),生产(=生产服务器)分支,如果你有git推送,自动化作业将部署到服务器上。
以下是.gitlab-ci.yml文件中链接的主要部分示例:
deploy_staging:
stage: deploy
image: kroniak/ssh-client:3.6
script:
# add the server as a known host
- mkdir ~/.ssh
- echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
# add ssh key stored in SSH_PRIVATE_KEY variable to the agent store
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
# log into Docker registry
- ssh deployer@thecodingmachine.io "docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.thecodingmachine.com"
# stop container, remove image.
- ssh deployer@thecodingmachine.io "docker stop thecodingmachine.io_${CI_COMMIT_REF_SLUG}" || true
- ssh deployer@thecodingmachine.io "docker rm thecodingmachine.io_${CI_COMMIT_REF_SLUG}" || true
- ssh deployer@thecodingmachine.io "docker rmi registry.thecodingmachine.com/tcm-projects/thecodingmachine.io:${CI_COMMIT_REF_SLUG}" || true
# start new container
- ssh deployer@thecodingmachine.io "docker run --name thecodingmachine.io_${CI_COMMIT_REF_SLUG} --network=web -d registry.thecodingmachine.com/tcm-projects/thecodingmachine.io:${CI_COMMIT_REF_SLUG}"
only:
- branches
except:
- master你可能很难读懂这篇文章,但你可以知道有一种方法是你需要的,你可能需要花时间来学习这一部分。
希望它能为你工作。
感谢David Négrier的分享。
https://stackoverflow.com/questions/60911724
复制相似问题