How to run uploads:migrate_to_new_pattern rake task


(Tobias Eigen) #1

Can you explain step by step how to run this rake task? I am having problems with accessing attachments on my discourse and need to get this sorted out quickly. Any urgent assistance gratefully accepted! :heart_eyes:

Continuing the discussion from Attachment not found (Latest update):


.Gif files as profile pics?
(Régis Hanol) #2

Hmm, first you should update to latest. You should not have any problem accessing attachments.

Here’s how to run the rake task:

# ssh into server
cd /var/discourse
./launcher enter app
rake uploads:migrate_to_new_pattern

Best tools, materials & practices to onboard a hoarde of new users?
(Tobias Eigen) #3

this worked - thanks so much! :slight_smile:

update: hmm… this worked well on one of my sites but on another when I run the ./launcher enter app command I get an error. What’s this about you think?

root@discourse:/var/discourse# ./launcher enter app
Error: Command not found: exec
Error: Command not found: -it
Usage: docker [OPTIONS] COMMAND [arg...]
 -H=[unix:///var/run/docker.sock]: tcp://host:port to bind/connect to or unix://path/to/socket to use

A self-sufficient runtime for linux containers.

Commands:
    attach    Attach to a running container
    build     Build an image from a Dockerfile
    commit    Create a new image from a container's changes
    cp        Copy files/folders from a container's filesystem to the host path
    diff      Inspect changes on a container's filesystem
    events    Get real time events from the server
    export    Stream the contents of a container as a tar archive
    history   Show the history of an image
    images    List images
    import    Create a new filesystem image from the contents of a tarball
    info      Display system-wide information
    inspect   Return low-level information on a container
    kill      Kill a running container
    load      Load an image from a tar archive
    login     Register or log in to a Docker registry server
    logout    Log out from a Docker registry server
    logs      Fetch the logs of a container
    port      Lookup the public-facing port that is NAT-ed to PRIVATE_PORT
    pause     Pause all processes within a container
    ps        List containers
    pull      Pull an image or a repository from a Docker registry server
    push      Push an image or a repository to a Docker registry server
    restart   Restart a running container
    rm        Remove one or more containers
    rmi       Remove one or more images
    run       Run a command in a new container
    save      Save an image to a tar archive
    search    Search for an image on the Docker Hub
    start     Start a stopped container
    stop      Stop a running container
    tag       Tag an image into a repository
    top       Lookup the running processes of a container
    unpause   Unpause a paused container
    version   Show the Docker version information
    wait      Block until a container stops, then print its exit code

(Kane York) #4

Use ./launcher ssh app instead until you upgrade docker. To do that:

  1. make sure a normal sudo apt-get upgrade completes
  2. Do it again, you should see “lxc-docker held back”
  3. sudo apt-get upgrade lxc-docker

(Tobias Eigen) #5

hah - unintended consequence: today, a few days later the site logo stopped working… presumably because of this rake task that changed the URLs for accessing uploads, affecting the site assets topic.


(Régis Hanol) #6

It should have changed it in the site settings too… Cache issue? Does a restart of the application fix it?


(Tobias Eigen) #7

I didn’t restart - just changed the URLs in the site settings and the logos are back.

The missing images problem actually just showed up today suddenly - a day after I ran the rake task! So maybe I’m actually wrong about what caused it.