Amid the whining air raid sirens, the checkpoints, neighbourhood patrols, and enduring fears of Russian attacks – from the sea, air, or land – the historic and cosmopolitan Ukrainian resort city of Odesa is gently trying to reconnect with its famously relaxed holiday spirit, as if embracing it were a form of defiance against the Kremlin.

“Music is life. When music is silenced, anything can happen. Music is a way of protecting our minds,” said Olexandr Proletarskyi, a music critic, sitting on a bar stool in a dark cellar venue near the city centre.

But the recent reopening of clubs, beach restaurants, and nail salons across Odesa is not simply an expression of defiance, or an economic necessity. It also reflects growing local confidence in the course of the war against Russia, at least here on the Black Sea coast.

“The city is coming alive, I feel. I think the fear is going away a bit. People believe in our army, which is protecting us, and feel comfortable, feel safe. I don’t think the Russian army is winning,” said Alexander Hodosevich, a drummer for an instrumental psychedelic band, sitting with a group of friends after finishing an hour-long set at the More Music club.

The venue has just reopened, staging live (and live-streamed) concerts in the late afternoons, to give audiences enough time to get home before curfew.

North of the city, on windswept beach popular with summer tourists, razor wire, land mines and sandbags now block all access to the sea.

“I’ve seen Russian ships. But they pulled back. They know we’re a threat to them. We’ve had a lot of incoming fire. From rockets, over there. There have also been drones, dropping bombs. But they won’t succeed here. Let them try to land – we’ll make them pay a heavy price,” said Anatolii, 27, a Ukrainian soldier manning an anti-aircraft gun.

There is a logic to Odesa’s growing confidence.

Russia’s advance along the Black Sea coast has stalled. Ukrainian troops in the city of Mykolaiv have not only protected their strategic bridge but are now reported to be pushing Russian forces back to the east.

In Kherson, the first city to be seized by Russian troops a month ago, occupying security forces are now being accused of using excessive force against civilian protesters, and of abducting or arresting local leaders to try to contain popular unrest.

“When they started using this gas, smoke pellets and stun grenades, I started running. That was really scary,” said Lada Danik, a university lecturer in Kherson, speaking on a Skype call.

“[The Russians] started kidnapping people, going to their apartments and the places people live – protesters and activists. It seems they’re using more threatening techniques and tactics. I think they’re in panic,” she said.

In Odesa, there is enormous gratitude for the way Ukrainian soldiers in places like Mykolaiv and Voznesensk have stood their ground and blocked Russian land forces from moving further west. But what about an amphibious landing?

The security analyst Hanna Shelest believes that Odesa could have fallen to Russia if pro-Moscow leaders had engineered a surrender in the opening days of the war. But that option is now closed and, she believes, Russian troops would struggle to attack from the sea without first establishing a base on land.

“It seems to me that it’s just impossible. If you look at the technical conditions, the strategic terrain, Odesa has never been a city for easy taking (from the sea). History has proved it several times,” she said.

In the meantime, the city’s vast catacombs – perhaps 2,500km (1,553 miles) of underground tunnels dug over the course of the past two centuries – are being prepared once again as possible air raid shelters.

Mattresses and food supplies now sit in dark corners in the musty labyrinth-like network which was used by fleeing families, and by partisans, in both world wars as well as Russia’s Civil War.

“There’s graffiti here from the 1940s. This one says, ‘Death to Fascists,'” said caver and local historian Maxim Baranestski, 46, waving his flashlight at lettering on a sand-coloured stone wall deep underground.

But the firm hope in Odesa is that history will not repeat itself, and that Russia’s push west along the coast will remain thwarted.