We study a model of a small open economy that specializes in the production of commodities and that exhibits frictions in the setting of both prices and wages. We study the optimal response of monetary and exchange rate policy following a positive (negative) shock to the price of the exportable that generates an appreciation (depreciation) of the local currency. According to the calibrated version of the model, deviations from full price stability can generate welfare gains that are equivalent to almost 0.5% of lifetime consumption, as long as there is a significant degree of rigidity in nominal wages. On the other hand, if the rigidity is concentrated in prices, the welfare gains can be at most 0.1% of lifetime consumption. We also show that a rule - formally defined in the paper - that resembles a "dirty floating" regime can approximate the optimal policy remarkably well.