Code Monkey home page Code Monkey logo

docker-wordpress's Introduction

Good Wordpress for Docker (and dokku-alt).

This is a docker / dokku-alt implementation for deploying your Wordpress applications easily. I have edited the deploy scripts to make sure this works in a real-life applications.

The container is designed to work with dokku-alt, however you should be able to use it independently too. I will provide help for dokku-alt.

1. Deploying the app

You will need dokku-alt installed on your server: dokku.example.com. Clone this repository locally or use dokku clone app-name repository-url.

git clone https://github.com/romaninsh/docker-wordpress.git
cd docker-wordpress
git remote add deploy [email protected]:wordpress
git push deploy master

If everything goes well, you should receive URL. Opening that URL will complain about database connection. Let's set up our database next.

2. Setting up database.

Dokku allows you to set up and configure database easily.

dokku mariadb:create wordpress
dokku mariadb:link wordpress wordpress

Refresh your URL and it should redirect you to standard wordpress install steps.

3. Setting up wp-content volume

Wordpress is a CMS and people tend to upload files through wp-admin. In a standard docker install those files will dissapear when you re-deploy your site, because a new container is created every time. To make those files persistent, you'll need to set up a volume.

dokku volume:create wordpress /data
dokku volume:link wordpress wordpress

Because the volume we created was empty, volume-init.sh will automatically move wp-content folder from the default installation to your volume. To confirm that wp-content is linked you can peek inside container logs:

dokku logs wordpress

and it should contain:

Moving wp-content to blank volume..
Linking wp-content..

4. Adding your own themes and plugins

You can access docker containers from host operating system. Type:

ls -l /var/lib/docker/vfs/dir/

and look for recently created folder. Create symlink to access it easy

ln -s /var/lib/docker/vfs/dir/<your-id-here> wordpress

Inside you'll find wp-content folder which you can customise. In my installations it's often linked with it's own repository. Make sure you back up this volume as it would contain your uploaded files.

5. Advanced Use

This wordpress container comes with default wp-config.php file. If you want to tweak it, copy it to your /data volume, then run:

dokku deploy wordpress

You can also add your own .htaccess file to your data volume and it will be automatically used.

6. Logs

You often would like to access logs from your web server. This container configures your apache to send logs through stdout to docker in a normal way. You should be able to see your logs through:

dokku logs wordpress

7. Contributing

If you find that this container is not fully usable in your production environment, I would love to improve it as long as it's not compromise it's simplicity.

Start by forking this repository. Then grab the new repository SSH url and run on your local machine:

git remote add my <url>

Perform tweaks necessary, test them by doing

git push deploy master

and when everything is perfect,

git push my master

Once done, go to your repository on github.com and create pull request. Thank you for your contribution.

docker-wordpress's People

Contributors

dkinzer avatar elsonrodriguez avatar jbfink avatar jkerihuel avatar romaninsh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

docker-wordpress's Issues

Dokku volume

I created a volume but i don't see any files at /data folder, even after uplod of files. Is this correct?

Weird behaviour

I'm using WordPress by means of this dockerfile at a dokku-alt server. It's ok, BUT i'm having a weird issue: every time i have to restart the server, i can access the main page, but every other page, or blog posts, or any other link, returns 404 error. I'm able to login and access the wp-admin.

I am able to recover the site just restoring a backup that i have at Amazon S3. What can be this?

Fix ubuntu version

Suggestion to fix the ubuntu version to a working version like ubuntu:15.04. If you use ubuntu:latest you'll run into issues with package installation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.