1 # Migrating to a Docker Installation
3 If you for any reason wish to migrate a source or OTP install to a docker one,
6 You have a few options - your major one will be whether you want to keep your
7 reverse-proxy setup from before.
9 You probably should, in the first instance.
11 ### Prepare the system
13 * Install docker and docker-compose
14 * [Docker](https://docs.docker.com/engine/install/)
15 * [Docker-compose](https://docs.docker.com/compose/install/)
16 * This will usually just be a repository installation and a package manager invocation.
24 Clone the akkoma repository
27 git clone https://akkoma.dev/AkkomaGang/akkoma.git -b stable
31 ### Back up your old database
33 Change the database name as needed
36 pg_dump -d akkoma_prod --format c > akkoma_backup.sql
39 ### Getting your static files in the right place
41 This will vary by every installation. Copy your `instance` directory to `instance/` in
42 the akkoma source directory - this is where the docker container will look for it.
44 For *most* from-source installs it'll already be there.
46 And the same with `uploads`, make sure your uploads (if you have them on disk) are
47 located at `uploads/` in the akkoma source directory.
49 If you have them on a different disk, you will need to mount that disk into the docker-compose file,
50 with an entry that looks like this:
55 - .:/opt/akkoma # This should already be there
57 source: /path/to/your/uploads
58 target: /opt/akkoma/uploads
61 ### Set up basic configuration
64 cp docker-resources/env.example .env
65 echo "DOCKER_USER=$(id -u):$(id -g)" >> .env
68 This probably won't need to be changed, it's only there to set basic environment
69 variables for the docker-compose file.
73 You probably won't need to change your config. Provided your `config/prod.secret.exs` file
74 is still there, you're all good.
78 cp /etc/akkoma/config.exs config/prod.secret.exs
83 Set the following config in `config/prod.secret.exs`:
85 config :pleroma, Pleroma.Web.Endpoint,
87 http: [ip: {0, 0, 0, 0}, port: 4000]
89 config :pleroma, Pleroma.Repo,
97 ### Building the container
99 The container provided is a thin wrapper around akkoma's dependencies,
100 it does not contain the code itself. This is to allow for easy updates
101 and debugging if required.
104 ./docker-resources/build.sh
107 This will generate a container called `akkoma` which we can use
108 in our compose environment.
110 ### Setting up the docker resources
113 # These won't exist if you're migrating from OTP
120 ./docker-resources/manage.sh mix deps.get
121 ./docker-resources/manage.sh mix compile
124 ### Setting up the database
126 Now we can import our database to the container.
129 docker-compose run --rm --user akkoma -d db
130 docker-compose run --rm akkoma pg_restore -v -U akkoma -j $(grep -c ^processor /proc/cpuinfo) -d akkoma -h db akkoma_backup.sql
135 If you're just reusing your old proxy, you may have to uncomment the line in
136 the docker-compose file under `ports`. You'll find it.
138 Otherwise, you can use the same setup as the [docker installation guide](./docker_en.md#reverse-proxies).
146 You should now be at the same point as you were before, but with a docker install.
148 {! installation/frontends.include !}
150 See the [docker installation guide](./docker_en.md) for more information on how to
155 {! installation/further_reading.include !}
157 {! support.include !}